org.placelab.util.swt
Class AffineTransform
java.lang.Object
org.placelab.util.swt.AffineTransform
- public class AffineTransform
- extends java.lang.Object
Pocket PCs don't have java.awt.geom.AffineTransform so I made this
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
matrix
protected double[][] matrix
inverse
protected AffineTransform inverse
inverseValid
protected boolean inverseValid
NEAREST_NEIGHBOR
public static int NEAREST_NEIGHBOR
AffineTransform
public AffineTransform()
- Returns the AffineTransform for the identity matrix
AffineTransform
public AffineTransform(AffineTransform Tx)
AffineTransform
public AffineTransform(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
AffineTransform
public AffineTransform(double[][] matrix)
getRotateInstance
public static AffineTransform getRotateInstance(double theta)
getRotateInstance
public static AffineTransform getRotateInstance(double theta,
double anchorX,
double anchorY)
getScaleInstance
public static AffineTransform getScaleInstance(double sx,
double sy)
getShearInstance
public static AffineTransform getShearInstance(double shx,
double shy)
getTranslateInstance
public static AffineTransform getTranslateInstance(double tx,
double ty)
clone
public java.lang.Object clone()
toString
public java.lang.String toString()
concatenate
public void concatenate(AffineTransform Tx)
preConcatenate
public void preConcatenate(AffineTransform Cx)
inverseTransform
public org.eclipse.swt.graphics.Point inverseTransform(org.eclipse.swt.graphics.Point src)
throws AffineTransform.NotInvertibleException
- Throws:
AffineTransform.NotInvertibleException
inverseTransform
public AffineTransform.DoublePoint inverseTransform(AffineTransform.DoublePoint src)
throws AffineTransform.NotInvertibleException
- Throws:
AffineTransform.NotInvertibleException
transform
public org.eclipse.swt.graphics.Point transform(org.eclipse.swt.graphics.Point src)
transform
public AffineTransform.DoublePoint transform(AffineTransform.DoublePoint src)
getMatrix
public double[][] getMatrix()
getScaleX
public double getScaleX()
getScaleY
public double getScaleY()
getTranslateX
public double getTranslateX()
getTranslateY
public double getTranslateY()
getShearX
public double getShearX()
getShearY
public double getShearY()
copyMatrix
public static double[][] copyMatrix(double[][] a)
createInverse
public AffineTransform createInverse()
throws AffineTransform.NotInvertibleException
- Throws:
AffineTransform.NotInvertibleException
multiply
public static double[][] multiply(double[][] a,
double[][] b)
invert
public static double[][] invert(double[][] a)
throws AffineTransform.NotInvertibleException
- Throws:
AffineTransform.NotInvertibleException
getBoundingRect
public org.eclipse.swt.graphics.Rectangle getBoundingRect(org.eclipse.swt.graphics.Rectangle rect)
- Supposing we applied this AffineTransform to the passed in Rectangle,
this returns the rectangle that would be necessary to just contain
the translated one
transformPoints
public org.eclipse.swt.graphics.Point[] transformPoints(org.eclipse.swt.graphics.Point[] points)
transformImage
public org.eclipse.swt.graphics.ImageData transformImage(org.eclipse.swt.graphics.ImageData original,
int method)
throws AffineTransform.NotInvertibleException
- Transforms an image according to this AffineTransform using the
specified algorithm for transformation (only NEAREST_NEIGHBOR is
currently implemented)
Note that the resulting image is the smallest possible image that
can contain the transformed image. So if there is a translation
associated with this transform you will need to then draw the resulting
image with the appropriate x and y offsets to complete the transform
onscreen.
- Parameters:
original - the image to transformmethod - the interpolation technique
- Returns:
- a transformed version of the image interpolated
- Throws:
AffineTransform.NotInvertibleException