Shearing support from Mike T.
This commit is contained in:
@@ -97,6 +97,23 @@ public abstract class AbstractTransform implements Transform
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shear (float sx, float sy) {
|
||||
shearX(sx);
|
||||
shearY(sy);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shearX (float sx) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shearY (float sy) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform setTx (float tx) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -225,6 +225,21 @@ public class AffineTransform extends AbstractTransform
|
||||
return Transforms.multiply(this, 1, 0, 0, 1, 0, ty, this);
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shear (float sx, float sy) {
|
||||
return Transforms.multiply(this, 1, sy, sx, 1, 0, 0, this);
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shearX (float sx) {
|
||||
return Transforms.multiply(this, 1, 0, sx, 1, 0, 0, this);
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform shearY (float sy) {
|
||||
return Transforms.multiply(this, 1, sy, 0, 1, 0, 0, this);
|
||||
}
|
||||
|
||||
@Override // from Transform
|
||||
public Transform invert () {
|
||||
// compute the determinant, storing the subdeterminants for later use
|
||||
|
||||
@@ -137,6 +137,21 @@ public interface Transform
|
||||
* @throws UnsupportedOperationException if the transform is not rigid body or greater. */
|
||||
Transform translateY (float ty);
|
||||
|
||||
/** Shears this transform.
|
||||
* @return this instance, for chaining.
|
||||
* @throws UnsupportedOperationException if the transform is not affine or greater. */
|
||||
Transform shear (float tx, float ty);
|
||||
|
||||
/** Shears this transform in the x dimension.
|
||||
* @return this instance, for chaining.
|
||||
* @throws UnsupportedOperationException if the transform is not affine or greater. */
|
||||
Transform shearX (float tx);
|
||||
|
||||
/** Shears this transform in the y dimension.
|
||||
* @return this instance, for chaining.
|
||||
* @throws UnsupportedOperationException if the transform is not affine or greater. */
|
||||
Transform shearY (float ty);
|
||||
|
||||
/** Returns a new transform that represents the inverse of this transform.
|
||||
* @throws NoninvertibleTransformException if the transform is not invertible. */
|
||||
Transform invert ();
|
||||
|
||||
Reference in New Issue
Block a user