Transform

Instances of this class represent transformation matrices for points expressed as (x, y) pairs of floating point numbers. <p> Application code must explicitly invoke the <code>Transform.dispose()</code> method to release the operating system resources managed by each instance when those instances are no longer required. </p> <p> This class requires the operating system's advanced graphics subsystem which may not be available on some platforms. </p>

@see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: GraphicsExample</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

@since 3.1

Constructors

this
this(Device device)

Constructs a new identity Transform. <p> This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms. </p>

this
this(Device device, float[] elements)

Constructs a new Transform given an array of elements that represent the matrix that describes the transformation. <p> This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms. </p>

this
this(Device device, float m11, float m12, float m21, float m22, float dx, float dy)

Constructs a new Transform given all of the elements that represent the matrix that describes the transformation. <p> This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms. </p>

Members

Functions

getElements
void getElements(float[] elements)

Fills the parameter with the values of the transformation matrix that the receiver represents, in the order {m11, m12, m21, m22, dx, dy}.

identity
void identity()

Modifies the receiver such that the matrix it represents becomes the identity matrix.

invert
void invert()

Modifies the receiver such that the matrix it represents becomes the mathematical inverse of the matrix it previously represented.

isDisposed
bool isDisposed()

Returns <code>true</code> if the Transform has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the Transform. When a Transform has been disposed, it is an error to invoke any other method using the Transform.

isIdentity
bool isIdentity()

Returns <code>true</code> if the Transform represents the identity matrix and false otherwise.

multiply
void multiply(Transform matrix)

Modifies the receiver such that the matrix it represents becomes the the result of multiplying the matrix it previously represented by the argument.

rotate
void rotate(float angle)

Modifies the receiver so that it represents a transformation that is equivalent to its previous transformation rotated by the specified angle. The angle is specified in degrees and for the identity transform 0 degrees is at the 3 o'clock position. A positive value indicates a clockwise rotation while a negative value indicates a counter-clockwise rotation.

scale
void scale(float scaleX, float scaleY)

Modifies the receiver so that it represents a transformation that is equivalent to its previous transformation scaled by (scaleX, scaleY).

setElements
void setElements(float m11, float m12, float m21, float m22, float dx, float dy)

Modifies the receiver to represent a new transformation given all of the elements that represent the matrix that describes that transformation.

shear
void shear(float shearX, float shearY)

Modifies the receiver so that it represents a transformation that is equivalent to its previous transformation sheared by (shearX, shearY).

toString
String toString()

Returns a string containing a concise, human-readable description of the receiver.

transform
void transform(float[] pointArray)

Given an array containing points described by alternating x and y values, modify that array such that each point has been replaced with the result of applying the transformation represented by the receiver to that point.

translate
void translate(float offsetX, float offsetY)

Modifies the receiver so that it represents a transformation that is equivalent to its previous transformation translated by (offsetX, offsetY).

Variables

handle
double[] handle;

the OS resource for the Transform (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>

Inherited Members

From Resource

device
Device device;

the device where this resource was created

dispose
void dispose()

Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate.

getDevice
Device getDevice()

Returns the <code>Device</code> where this resource was created.

isDisposed
bool isDisposed()

Returns <code>true</code> if the resource has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the resource. When a resource has been disposed, it is an error to invoke any other method using the resource.

Meta