本文整理了Java中org.eclipse.swt.graphics.Transform
类的一些代码示例,展示了Transform
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform
类的具体详情如下:
包路径:org.eclipse.swt.graphics.Transform
类名称:Transform
[英]Instances of this class represent transformation matrices for points expressed as (x, y) pairs of floating point numbers.
Application code must explicitly invoke the Transform.dispose()
method to release the operating system resources managed by each instance when those instances are no longer required.
[中]此类的实例表示以(x,y)对浮点数表示的点的变换矩阵。
当不再需要由每个实例管理的操作系统资源时,应用程序代码必须显式调用Transform.dispose()
方法来释放这些资源。
代码示例来源:origin: pentaho/pentaho-kettle
public void setTransform( float translationX, float translationY, int shadowsize, float magnification ) {
if ( transform != null ) { // dispose of previous to prevent leaking of handles
transform.dispose();
}
transform = new Transform( gc.getDevice() );
transform.translate( translationX + shadowsize * magnification, translationY + shadowsize * magnification );
transform.scale( magnification, magnification );
gc.setTransform( transform );
currentMagnification = magnification;
}
代码示例来源:origin: pentaho/pentaho-kettle
public void dispose() {
gc.dispose();
if ( transform != null && transform.isDisposed() == false ) {
transform.dispose();
}
for ( Color color : colors ) {
color.dispose();
}
for ( Font font : fonts ) {
font.dispose();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
if ( ( (Transform) object ).isDisposed() ) {
return;
String string = ( (Transform) object ).toString();
gc.drawString( string, 0, 0 );
return;
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Applies a translation.
*
* @param x the translation along the x-axis.
* @param y the translation along the y-axis.
*/
@Override
public void translate(int x, int y) {
Transform swtTransform = new Transform(this.gc.getDevice());
this.gc.getTransform(swtTransform);
swtTransform.translate(x, y);
this.gc.setTransform(swtTransform);
swtTransform.dispose();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the receiver
*/
@Override
public String toString() {
if (isDisposed()) return "Transform {*DISPOSED*}";
float[] elements = new float[6];
getElements(elements);
return "Transform {" + elements [0] + "," + elements [1] + "," +elements [2] + "," +elements [3] + "," +elements [4] + "," +elements [5] + "}";
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns <code>true</code> if the Transform represents the identity matrix and false otherwise.
*
* @return <code>true</code> if the receiver is an identity Transform, and <code>false</code>
* otherwise
*/
public boolean isIdentity() {
if( isDisposed() ) {
SWT.error( SWT.ERROR_GRAPHIC_DISPOSED );
}
return Arrays.equals( elements, IDENTITY_MATRIX );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
SWT.error( SWT.ERROR_NULL_ARGUMENT );
if( transform.isDisposed() ) {
SWT.error( SWT.ERROR_INVALID_ARGUMENT );
transform.setElements( elements[ 0 ],
elements[ 1 ],
elements[ 2 ],
代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt
@Override
public void drawText ( final String string, final int x, final int y, final Float rotate )
{
final Transform t;
if ( rotate != null )
{
t = new Transform ( this.gc.getDevice () );
t.rotate ( rotate );
this.gc.setTransform ( t );
}
else
{
t = null;
}
this.gc.drawText ( string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT );
if ( t != null )
{
this.gc.setTransform ( null );
t.dispose ();
}
}
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Applies a scale transform.
*
* @param scaleX the scale factor along the x-axis.
* @param scaleY the scale factor along the y-axis.
*/
@Override
public void scale(double scaleX, double scaleY) {
Transform swtTransform = new Transform(this.gc.getDevice());
this.gc.getTransform(swtTransform);
swtTransform.scale((float) scaleX, (float) scaleY);
this.gc.setTransform(swtTransform);
swtTransform.dispose();
}
代码示例来源:origin: org.xworker/xworker_swt
Transform t = new Transform(newImage.getDevice());
t.rotate(1f * degree);
gc.setTransform(t);
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Concatenates the specified transform to the existing transform.
*
* @param t the transform.
*/
@Override
public void transform(AffineTransform t) {
Transform swtTransform = new Transform(this.gc.getDevice());
this.gc.getTransform(swtTransform);
swtTransform.multiply(getSwtTransformFromPool(t));
this.gc.setTransform(swtTransform);
swtTransform.dispose();
}
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Internal method to convert a AWT transform object into
* a SWT transform resource. If a corresponding SWT transform
* instance is already in the pool, it will be used
* instead of creating a new one. This is used in
* {@link #setTransform()} for instance.
*
* @param awtTransform The AWT transform to convert.
* @return A SWT transform instance.
*/
private Transform getSwtTransformFromPool(AffineTransform awtTransform) {
Transform t = (Transform) this.transformsPool.get(awtTransform);
if (t == null) {
t = new Transform(this.gc.getDevice());
double[] matrix = new double[6];
awtTransform.getMatrix(matrix);
t.setElements((float) matrix[0], (float) matrix[1],
(float) matrix[2], (float) matrix[3],
(float) matrix[4], (float) matrix[5]);
addToResourcePool(t);
this.transformsPool.put(awtTransform, t);
}
return t;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
if( isDisposed() ) {
SWT.error( SWT.ERROR_GRAPHIC_DISPOSED );
SWT.error( SWT.ERROR_NULL_ARGUMENT );
if( matrix.isDisposed() ) {
SWT.error( SWT.ERROR_INVALID_ARGUMENT );
matrix.getElements( elements );
multiply( elements[ 0 ],
elements[ 1 ],
elements[ 2 ],
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Returns the current transform.
*
* @return The current transform.
*/
@Override
public AffineTransform getTransform() {
Transform swtTransform = new Transform(this.gc.getDevice());
this.gc.getTransform(swtTransform);
AffineTransform awtTransform = toAwtTransform(swtTransform);
swtTransform.dispose();
return awtTransform;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]);
代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer
public void translate(double tx, double ty) {
if (_transform == null) {
_transform = new Transform(_gc.getDevice());
}
_transform.translate((int) tx, (int) ty);
_gc.setTransform(_transform);
if (_clippingArea != null) {
AffineTransform t = new AffineTransform();
t.translate(-tx, -ty);
_clippingArea.transform(t);
}
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
if (handle == null) SWT.error(SWT.ERROR_NO_HANDLES);
handle.retain();
setElements(m11, m12, m21, m22, dx, dy);
init();
} finally {
if (pool != null) pool.release();
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
handle = Gdip.Matrix_new(m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy));
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
init();
代码示例来源:origin: org.piccolo2d/piccolo2d-swt
/**
* Constructor for SWTGraphics2D.
*
* @param gc The Eclipse Graphics Context onto which all Graphics2D
* operations are delegating
* @param device Device onto which ultimately all gc operations are drawn
* onto
*/
public SWTGraphics2D(final GC gc, final Device device) {
this.gc = gc;
this.device = device;
swtTransform = new Transform(device);
gc.setAntialias(SWT.ON);
}
代码示例来源:origin: org.jfree/swtgraphics2d
/**
* Converts an SWT transform into the equivalent AWT transform.
*
* @param swtTransform the SWT transform.
*
* @return The AWT transform.
*/
private AffineTransform toAwtTransform(Transform swtTransform) {
float[] elements = new float[6];
swtTransform.getElements(elements);
AffineTransform awtTransform = new AffineTransform(elements);
return awtTransform;
}
内容来源于网络,如有侵权,请联系作者删除!