Java Code Examples for java.awt.geom.AffineTransform#createInverse()

The following examples show how to use java.awt.geom.AffineTransform#createInverse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttributeValues.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private static AffineTransform extractRotation(Point2D.Double pt,
    AffineTransform tx, boolean andTranslation) {

    tx.deltaTransform(pt, pt);
    AffineTransform rtx = AffineTransform.getRotateInstance(pt.x, pt.y);

    try {
        AffineTransform rtxi = rtx.createInverse();
        double dx = tx.getTranslateX();
        double dy = tx.getTranslateY();
        tx.preConcatenate(rtxi);
        if (andTranslation) {
            if (dx != 0 || dy != 0) {
                tx.setTransform(tx.getScaleX(), tx.getShearY(),
                                tx.getShearX(), tx.getScaleY(), 0, 0);
                rtx.setTransform(rtx.getScaleX(), rtx.getShearY(),
                                 rtx.getShearX(), rtx.getScaleY(), dx, dy);
            }
        }
    }
    catch (NoninvertibleTransformException e) {
        return null;
    }
    return rtx;
}
 
Example 2
Source File: AttributeValues.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static AffineTransform extractRotation(Point2D.Double pt,
    AffineTransform tx, boolean andTranslation) {

    tx.deltaTransform(pt, pt);
    AffineTransform rtx = AffineTransform.getRotateInstance(pt.x, pt.y);

    try {
        AffineTransform rtxi = rtx.createInverse();
        double dx = tx.getTranslateX();
        double dy = tx.getTranslateY();
        tx.preConcatenate(rtxi);
        if (andTranslation) {
            if (dx != 0 || dy != 0) {
                tx.setTransform(tx.getScaleX(), tx.getShearY(),
                                tx.getShearX(), tx.getScaleY(), 0, 0);
                rtx.setTransform(rtx.getScaleX(), rtx.getShearY(),
                                 rtx.getShearX(), rtx.getScaleY(), dx, dy);
            }
        }
    }
    catch (NoninvertibleTransformException e) {
        return null;
    }
    return rtx;
}
 
Example 3
Source File: AttributeValues.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static AffineTransform extractRotation(Point2D.Double pt,
    AffineTransform tx, boolean andTranslation) {

    tx.deltaTransform(pt, pt);
    AffineTransform rtx = AffineTransform.getRotateInstance(pt.x, pt.y);

    try {
        AffineTransform rtxi = rtx.createInverse();
        double dx = tx.getTranslateX();
        double dy = tx.getTranslateY();
        tx.preConcatenate(rtxi);
        if (andTranslation) {
            if (dx != 0 || dy != 0) {
                tx.setTransform(tx.getScaleX(), tx.getShearY(),
                                tx.getShearX(), tx.getScaleY(), 0, 0);
                rtx.setTransform(rtx.getScaleX(), rtx.getShearY(),
                                 rtx.getShearX(), rtx.getScaleY(), dx, dy);
            }
        }
    }
    catch (NoninvertibleTransformException e) {
        return null;
    }
    return rtx;
}
 
Example 4
Source File: AttributeValues.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static AffineTransform extractRotation(Point2D.Double pt,
    AffineTransform tx, boolean andTranslation) {

    tx.deltaTransform(pt, pt);
    AffineTransform rtx = AffineTransform.getRotateInstance(pt.x, pt.y);

    try {
        AffineTransform rtxi = rtx.createInverse();
        double dx = tx.getTranslateX();
        double dy = tx.getTranslateY();
        tx.preConcatenate(rtxi);
        if (andTranslation) {
            if (dx != 0 || dy != 0) {
                tx.setTransform(tx.getScaleX(), tx.getShearY(),
                                tx.getShearX(), tx.getScaleY(), 0, 0);
                rtx.setTransform(rtx.getScaleX(), rtx.getShearY(),
                                 rtx.getShearX(), rtx.getScaleY(), dx, dy);
            }
        }
    }
    catch (NoninvertibleTransformException e) {
        return null;
    }
    return rtx;
}
 
Example 5
Source File: Diagram.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
public RectTransform(Range ax, Range ay,
                     Range bx, Range by) {
    double ax1 = ax.getMin();
    double ax2 = ax.getMax();
    double ay1 = ay.getMin();
    double ay2 = ay.getMax();

    double bx1 = bx.getMin();
    double bx2 = bx.getMax();
    double by1 = by.getMin();
    double by2 = by.getMax();

    transformA2B = new AffineTransform();
    transformA2B.translate(bx1 - ax1 * (bx2 - bx1) / (ax2 - ax1),
                           by1 - ay1 * (by2 - by1) / (ay2 - ay1));
    transformA2B.scale((bx2 - bx1) / (ax2 - ax1),
                       (by2 - by1) / (ay2 - ay1));

    try {
        transformB2A = transformA2B.createInverse();
    } catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException();
    }
}
 
Example 6
Source File: ColorTriangle.java    From darklaf with MIT License 6 votes vote down vote up
public void createShapes(final float x, final float y, final int size) {
    int outerSize = 15;
    AffineTransform rotationTransform = AffineTransform.getRotateInstance(rotation, centerX, centerY);

    circleShape = calculateCircleShape(x, y, size, outerSize);
    triangleShape = calculateTriangleShape(x, y, size, outerSize, rotationTransform);
    outerIndicator = createOuterIndicator(centerX, centerY, (innerRadius + outerRadius) / 2.0,
                                          rotationTransform, outerIndicatorRadius);
    innerIndicator = createInnerIndicator(rotationTransform, innerIndicatorRadius);

    invalid = false;
    try {
        // For calculating pick location. MouseEvents already respect the ui scaling.
        triangleInverse = rotationTransform.createInverse();
    } catch (NoninvertibleTransformException e) {
        e.printStackTrace();
    }
}
 
Example 7
Source File: AwtMatrixTransformer.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
@Override
public SvgMatrix inverse(final SvgMatrix svgMatrix) {
    try {
        AffineTransform tr = toAffineTransform(svgMatrix);
        tr = tr.createInverse();
        return toSvgMatrix(tr);
    }
    catch (final NoninvertibleTransformException e) {
        throw new IllegalArgumentException(
                "Failed to execute 'inverse' on 'SVGMatrix': The matrix is not invertible.");
    }
}
 
Example 8
Source File: TexturePaintContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 9
Source File: TexturePaintContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 10
Source File: TexturePaintContext.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 11
Source File: ProductSceneView.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
public AffineTransform getBaseImageToViewTransform() {
    AffineTransform viewToModelTransform = layerCanvas.getViewport().getViewToModelTransform();
    AffineTransform modelToImageTransform = getBaseImageLayer().getModelToImageTransform();
    viewToModelTransform.concatenate(modelToImageTransform);
    try {
        return viewToModelTransform.createInverse();
    } catch (NoninvertibleTransformException e) {
        throw new RuntimeException(e);
    }
}
 
Example 12
Source File: TexturePaintContext.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 13
Source File: TexturePaintContext.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 14
Source File: TexturePaintContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 15
Source File: TexturePaintContext.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 16
Source File: TexturePaintContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 17
Source File: TexturePaintContext.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 18
Source File: TexturePaintContext.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
TexturePaintContext(ColorModel cm, AffineTransform xform,
                    int bWidth, int bHeight, int maxw) {
    this.colorModel = getInternedColorModel(cm);
    this.bWidth = bWidth;
    this.bHeight = bHeight;
    this.maxWidth = maxw;

    try {
        xform = xform.createInverse();
    } catch (NoninvertibleTransformException e) {
        xform.setToScale(0, 0);
    }
    this.incXAcross = mod(xform.getScaleX(), bWidth);
    this.incYAcross = mod(xform.getShearY(), bHeight);
    this.incXDown = mod(xform.getShearX(), bWidth);
    this.incYDown = mod(xform.getScaleY(), bHeight);
    this.xOrg = xform.getTranslateX();
    this.yOrg = xform.getTranslateY();
    this.colincx = (int) incXAcross;
    this.colincy = (int) incYAcross;
    this.colincxerr = fractAsInt(incXAcross);
    this.colincyerr = fractAsInt(incYAcross);
    this.rowincx = (int) incXDown;
    this.rowincy = (int) incYDown;
    this.rowincxerr = fractAsInt(incXDown);
    this.rowincyerr = fractAsInt(incYDown);

}
 
Example 19
Source File: MirageTransition2D.java    From pumpernickel with MIT License 4 votes vote down vote up
@Override
public Transition2DInstruction[] getInstructions(float progress,
		Dimension size) {
	float ySize = (size.height) * .1f;
	float xSize = (size.width) * .1f;
	List<Rectangle2D> v = new ArrayList<Rectangle2D>();
	for (float y = 0; y < size.height; y += ySize) {
		for (float x = 0; x < size.width; x += xSize) {
			v.add(new Rectangle2D.Float(x, y, xSize, ySize));
		}
	}
	Transition2DInstruction[] instr = new Transition2DInstruction[2 * v
			.size()];
	Random random = new Random();
	Point2D center = new Point2D.Double(size.width / 2, size.height / 2);
	double max = Math.sqrt(size.width * size.width / 4 + size.height
			* size.height / 4);
	Point2D p1, p2;
	try {
		for (int a = 0; a < v.size(); a++) {
			float progress2 = (float) Math.pow(progress,
					.9 + .2 * random.nextFloat());
			Rectangle2D r = v.get(a);
			AffineTransform transform = new AffineTransform();
			Shape shape;

			transform.setToRotation(-Math.PI + Math.PI * (1 - progress2),
					size.width / 2, size.height / 2);
			p1 = new Point2D.Double(r.getCenterX(), r.getCenterY());
			p2 = new Point2D.Double();
			transform.transform(p1, p2);
			// transform.setToTranslation(p1.getX()-p2.getX(),p1.getY()-p2.getY());
			transform.setToTranslation(p2.getX() - p1.getX(), p2.getY()
					- p1.getY());
			shape = transform.createInverse().createTransformedShape(r);
			if (a == 0) {
				instr[a] = new ImageInstruction(true);
			} else {
				instr[2 * a + 0] = new ImageInstruction(true, 0, transform,
						shape);
			}
			transform.setToRotation(-1 * Math.PI * (1 - progress),
					size.width / 2, size.height / 2);
			transform.translate(size.width / 2, size.height / 2);
			transform.scale(1 / progress2, 1 / progress2);
			transform.translate(-size.width / 2, -size.height / 2);

			p1 = new Point2D.Double(r.getCenterX(), r.getCenterY());
			p2 = new Point2D.Double();
			transform.transform(p1, p2);
			// transform.setToTranslation(p1.getX()-p2.getX(),p1.getY()-p2.getY());
			transform.setToTranslation(p2.getX() - p1.getX(), p2.getY()
					- p1.getY());
			shape = r; // transform.createInverse().createTransformedShape(r);
			float progress3 = (float) ((1 - progress2) * (1 - p1
					.distance(center) / max));
			/**
			 * This doesn't look terrible if you don't use opacity... but it
			 * looks better with it...
			 * 
			 */
			// instr[2*a+1] = new
			// ImageInstruction(false,transform.createInverse(),shape);
			instr[2 * a + 1] = new ImageInstruction(false, 1 - progress3,
					transform.createInverse(), shape);
		}
	} catch (Exception e) {

	}
	return instr;
}
 
Example 20
Source File: MirageTransition2D.java    From Pixelitor with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Transition2DInstruction[] getInstructions(float progress,
                                                 Dimension size) {
    float ySize = size.height * 0.1f;
    float xSize = size.width * 0.1f;
    List<Rectangle2D> v = new ArrayList<>();
    for (float y = 0; y < size.height; y += ySize) {
        for (float x = 0; x < size.width; x += xSize) {
            v.add(new Rectangle2D.Float(x, y, xSize, ySize));
        }
    }
    Transition2DInstruction[] instr = new Transition2DInstruction[2 * v.size()];
    Random random = new Random();
    Point2D center = new Point2D.Double(size.width / 2, size.height / 2);
    double max = Math.sqrt(size.width * size.width / 4 + size.height * size.height / 4);
    Point2D p1, p2;
    try {
        for (int a = 0; a < v.size(); a++) {
            float progress2 = (float) Math.pow(progress, 0.9 + 0.2 * random.nextFloat());
            Rectangle2D r = v.get(a);
            AffineTransform transform = new AffineTransform();
            Shape shape;

            transform.setToRotation(-PI + PI * (1 - progress2), size.width / 2, size.height / 2);
            p1 = new Point2D.Double(r.getCenterX(), r.getCenterY());
            p2 = new Point2D.Double();
            transform.transform(p1, p2);
            //transform.setToTranslation(p1.getX()-p2.getX(),p1.getY()-p2.getY());
            transform.setToTranslation(p2.getX() - p1.getX(), p2.getY() - p1.getY());
            shape = transform.createInverse().createTransformedShape(r);
            if (a == 0) {
                instr[a] = new ImageInstruction(true);
            } else {
                instr[2 * a + 0] = new ImageInstruction(true, 0, transform, shape);
            }
            transform.setToRotation(-1 * PI * (1 - progress), size.width / 2, size.height / 2);
            transform.translate(size.width / 2, size.height / 2);
            transform.scale(1 / progress2, 1 / progress2);
            transform.translate(-size.width / 2, -size.height / 2);

            p1 = new Point2D.Double(r.getCenterX(), r.getCenterY());
            p2 = new Point2D.Double();
            transform.transform(p1, p2);
            //transform.setToTranslation(p1.getX()-p2.getX(),p1.getY()-p2.getY());
            transform.setToTranslation(p2.getX() - p1.getX(), p2.getY() - p1.getY());
            shape = r; //transform.createInverse().createTransformedShape(r);
            float progress3 = (float) ((1 - progress2) * (1 - p1.distance(center) / max));
            /* This doesn't look terrible if you don't use opacity... but it looks better with it...

             */
            //instr[2*a+1] = new ImageInstruction(false,transform.createInverse(),shape);
            instr[2 * a + 1] = new ImageInstruction(false, 1 - progress3, transform.createInverse(), shape);
        }
    } catch (Exception e) {

    }
    return instr;
}