AffineTransform implements Cloneable, Serializable { public void setToShear(double shx, double shy) { m00 = m11 = 1; m02 = m12 = 0; m01 = shx; m10 = shy; if (shx != 0.0 || shy != 0.0) { type = TYPE_UNKNOWN; } else { type = TYPE_IDENTITY; } } AffineTransform();  AffineTransform(AffineTransform t);  AffineTransform(double m00, double m10, double m01, double m11, double m02, double m12);  AffineTransform(float[] matrix);  AffineTransform(double[] matrix); int getType(); double getScaleX(); double getScaleY(); double getShearX(); double getShearY(); double getTranslateX(); double getTranslateY(); boolean isIdentity(); void getMatrix(float[] matrix); void getMatrix(double[] matrix); double getDeterminant(); void setTransform(float m00, float m10, float m01, float m11, float m02, float m12); void setTransform(double m00, double m10, double m01, double m11, double m02, double m12); void setTransform(AffineTransform t); void setToIdentity(); void setToTranslation(double mx, double my); void setToScale(double scx, double scy); void setToShear(double shx, double shy); void setToRotation(double angle); void setToRotation(double angle, double px, double py); static AffineTransform getTranslateInstance(double mx, double my); static AffineTransform getScaleInstance(double scx, double scY); static AffineTransform getShearInstance(double shx, double shy); static AffineTransform getRotateInstance(double angle); static AffineTransform getRotateInstance(double angle, double x, double y); void translate(double mx, double my); void scale(double scx, double scy); void shear(double shx, double shy); void rotate(double angle); void rotate(double angle, double px, double py); void concatenate(AffineTransform t); void preConcatenate(AffineTransform t); AffineTransform createInverse(); Point transform(Point src, Point dst); void transform(Point[] src, int srcOff, Point[] dst, int dstOff, int length); void transform(double[] src, int srcOff, double[] dst, int dstOff, int length); void transform(float[] src, int srcOff, float[] dst, int dstOff, int length); void transform(float[] src, int srcOff, double[] dst, int dstOff, int length); void transform(double[] src, int srcOff, float[] dst, int dstOff, int length); Point deltaTransform(Point src, Point dst); void deltaTransform(double[] src, int srcOff, double[] dst, int dstOff, int length); Point inverseTransform(Point src, Point dst); void inverseTransform(double[] src, int srcOff, double[] dst, int dstOff, int length); void inverseTransform(float[] src, int srcOff, float[] dst, int dstOff, int length); @Override AffineTransform clone(); @Override boolean equals(Object o); @Override int hashCode(); static final int TYPE_IDENTITY; static final int TYPE_TRANSLATION; static final int TYPE_UNIFORM_SCALE; static final int TYPE_GENERAL_SCALE; static final int TYPE_QUADRANT_ROTATION; static final int TYPE_GENERAL_ROTATION; static final int TYPE_GENERAL_TRANSFORM; static final int TYPE_FLIP; static final int TYPE_MASK_SCALE; static final int TYPE_MASK_ROTATION; }
@Test public void setToShearTypeIdentityTest() { double shx = 0d; double shy = 0d; AffineTransform expected = new AffineTransform(1, shx, shy, 1, 0, 0); AffineTransform result = new AffineTransform(); result.setToShear(shx, shy); Assert.assertEquals(expected, result); }
@Test public void setToShearTypeUnknownTest() { double shx = 1d; double shy = 1d; AffineTransform expected = new AffineTransform(1, shx, shy, 1, 0, 0); AffineTransform result = new AffineTransform(); result.setToShear(shx, shy); Assert.assertEquals(expected, result); }