public class Transform extends Resource
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.
Constructor and Description |
---|
Transform(Device device)
Constructs a new identity Transform.
|
Transform(Device device,
float[] elements)
Constructs a new Transform given an array of elements that represent the matrix that describes
the transformation.
|
Transform(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.
|
Modifier and Type | Method and Description |
---|---|
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}.
|
void |
identity()
Modifies the receiver such that the matrix it represents becomes the identity matrix.
|
void |
invert()
Modifies the receiver such that the matrix it represents becomes the mathematical inverse of
the matrix it previously represented.
|
boolean |
isIdentity()
Returns
true if the Transform represents the identity matrix and false otherwise. |
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.
|
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.
|
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).
|
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.
|
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).
|
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the receiver.
|
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.
|
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).
|
dispose, getDevice, isDisposed
public Transform(Device device)
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
device
- the device on which to allocate the Transformjava.lang.IllegalArgumentException
- Resource.dispose()
public Transform(Device device, float[] elements)
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
device
- the device on which to allocate the Transformelements
- an array of floats that describe the transformation matrixjava.lang.IllegalArgumentException
- Resource.dispose()
public Transform(Device device, float m11, float m12, float m21, float m22, float dx, float dy)
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
device
- the device on which to allocate the Transformm11
- the first element of the first row of the matrixm12
- the second element of the first row of the matrixm21
- the first element of the second row of the matrixm22
- the second element of the second row of the matrixdx
- the third element of the first row of the matrixdy
- the third element of the second row of the matrixjava.lang.IllegalArgumentException
- Resource.dispose()
public void getElements(float[] elements)
elements
- array to hold the matrix valuesSWTException
- java.lang.IllegalArgumentException
- public void setElements(float m11, float m12, float m21, float m22, float dx, float dy)
m11
- the first element of the first row of the matrixm12
- the second element of the first row of the matrixm21
- the first element of the second row of the matrixm22
- the second element of the second row of the matrixdx
- the third element of the first row of the matrixdy
- the third element of the second row of the matrixSWTException
- public void identity()
SWTException
- public boolean isIdentity()
true
if the Transform represents the identity matrix and false otherwise.true
if the receiver is an identity Transform, and false
otherwisepublic void invert()
SWTException
- public void multiply(Transform matrix)
matrix
- the matrix to multiply the receiver bySWTException
- java.lang.IllegalArgumentException
- public void translate(float offsetX, float offsetY)
offsetX
- the distance to translate in the X directionoffsetY
- the distance to translate in the Y directionSWTException
- public void scale(float scaleX, float scaleY)
scaleX
- the amount to scale in the X directionscaleY
- the amount to scale in the Y directionSWTException
- public void rotate(float angle)
angle
- the angle to rotate the transformation bySWTException
- public void shear(float shearX, float shearY)
shearX
- the shear factor in the X directionshearY
- the shear factor in the Y directionSWTException
- public void transform(float[] pointArray)
pointArray
- an array of alternating x and y values to be transformedjava.lang.IllegalArgumentException
- SWTException
- public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) EclipseSource and others 2002, 2017.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0