java.awt.geom.NoninvertibleTransformException Java Examples

The following examples show how to use java.awt.geom.NoninvertibleTransformException. 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: StandardGlyphVector.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #2
Source File: AbstractGraphics2D.java    From pumpernickel with MIT License 6 votes vote down vote up
@Override
public Shape getClip() {
	if (clipping == null)
		return null;

	try {
		Area area = new Area(clipping);
		area.transform(transform.createInverse());
		if (area.isRectangular())
			return area.getBounds2D();
		return area;
	} catch (NoninvertibleTransformException t) {
		RuntimeException e2 = new RuntimeException();
		e2.initCause(t);
		throw e2;
	}
}
 
Example #3
Source File: StandardGlyphVector.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #4
Source File: StandardGlyphVector.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #5
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 #6
Source File: StandardGlyphVector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #7
Source File: StandardGlyphVector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #8
Source File: StandardGlyphVector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #9
Source File: StandardGlyphVector.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #10
Source File: StandardGlyphVector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #11
Source File: StandardGlyphVector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #12
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 #13
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 #14
Source File: StandardGlyphVector.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #15
Source File: StandardGlyphVector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #16
Source File: StandardGlyphVector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Change the dtx for the strike refs we use.  Keeps a reference to the at.  At
 * must not contain translation.
 * Called by setRenderTransform, setDTX, initFontData.
 */
private final void resetDTX(AffineTransform at) {
    fsref = null;
    dtx = at;
    invdtx = null;
    if (!dtx.isIdentity()) {
        try {
            invdtx = dtx.createInverse();
        }
        catch (NoninvertibleTransformException e) {
            // we needn't care for rendering
        }
    }
    if (gti != null) {
        gti.strikesRef = null;
    }
}
 
Example #17
Source File: CurvedPolylineCreationUI.java    From pumpernickel with MIT License 6 votes vote down vote up
private Selection getSelection(MouseEvent evt)
		throws NoninvertibleTransformException {
	ShapeCreationPanel scp = (ShapeCreationPanel) evt.getComponent();
	AffineTransform tx = scp.getTransform();
	double r = scp.getHandleSize() / 2;
	Point2D mouseLoc = new Point2D.Float(evt.getX(), evt.getY());
	CurvedPolyline[] shapes = getMirror(scp);
	for (int shapeIndex = 0; shapeIndex < shapes.length; shapeIndex++) {
		if (scp.getHandlesActive().supports(scp, shapeIndex)) {
			for (int b = shapes[shapeIndex].getPointCount() - 1; b >= 0; b--) {
				Point2D p = tx.transform(
						shapes[shapeIndex].getPoint(b), null);
				Ellipse2D e = new Ellipse2D.Double(p.getX() - r,
						p.getY() - r, 2 * r, 2 * r);
				if (e.contains(mouseLoc))
					return new Selection(shapeIndex, b, null);
			}
		}
	}
	return getSelectedShape(scp, evt.getPoint());
}
 
Example #18
Source File: ColorTriangle.java    From darklaf with MIT License 6 votes vote down vote up
@Override
public Raster getRaster(final int x, final int y, final int w, final int h) {
    WritableRaster raster = getColorModel().createCompatibleWritableRaster(w, h);
    for (int j = 0; j < h; j++) {
        for (int i = 0; i < w; i++) {
            dummy.setLocation((x + i), (y + j));
            try {
                transform.inverseTransform(dummy, dummy);
                triangleInverse.transform(dummy, dummy);
                Point2D sv = getSaturationAndValue(dummy.getX(), dummy.getY());
                setPixel(raster, i, j, getColorRGB(getHue(), sv.getX(), sv.getY()));
            } catch (NoninvertibleTransformException ignored) {}
        }
    }
    return raster;
}
 
Example #19
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 #20
Source File: StandardGlyphVector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * !!! not used currently, but might be by getPixelbounds?
 */
public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) {
    if (renderFRC == null) {
        renderFRC = frc;
    }

    // it is a total pain that you have to copy the transform.

    AffineTransform at = renderFRC.getTransform();
    at.transform(loc, loc);
    pxResult.x = (int)loc.getX(); // but must not behave oddly around zero
    pxResult.y = (int)loc.getY();
    loc.setLocation(pxResult.x, pxResult.y);
    try {
        at.inverseTransform(loc, loc);
    }
    catch (NoninvertibleTransformException e) {
        throw new IllegalArgumentException("must be able to invert frc transform");
    }
}
 
Example #21
Source File: NativeStrike.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private int getNativePointSize() {
    /* Make a copy of the glyphTX in which we will store the
     * font transform, inverting the devTx if necessary
     */
    double[] mat = new double[4];
    desc.glyphTx.getMatrix(mat);
    fontTx = new AffineTransform(mat);

    /* Now work backwards to get the font transform */
    if (!desc.devTx.isIdentity() &&
        desc.devTx.getType() != AffineTransform.TYPE_TRANSLATION) {
        try {
            invertDevTx = desc.devTx.createInverse();
            fontTx.concatenate(invertDevTx);
        } catch (NoninvertibleTransformException e) {
            e.printStackTrace();
        }
    }

    /* At this point the fontTx may be a simple +ve scale, or it
     * may be something more complex.
     */
    Point2D.Float pt = new Point2D.Float(1f,1f);
    fontTx.deltaTransform(pt, pt);
    double ptSize = Math.abs(pt.y);
    int ttype = fontTx.getType();
    if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
        fontTx.getScaleY() <= 0) {
        /* We need to create an inverse transform that doesn't
         * include the point size (strictly the uniform scale)
         */
        fontTx.scale(1/ptSize, 1/ptSize);
    } else {
        fontTx = null; // no need
    }
    return (int)ptSize;
}
 
Example #22
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 #23
Source File: NodeUtils.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Transforms the given {@link Point} from the parent coordinate system of
 * the given {@link Node} into the local coordinate system of the
 * {@link Node}.
 *
 * @param n
 *            The {@link Node} used to determine the transformation matrix.
 * @param p
 *            The {@link Point} to transform.
 * @return The new, transformed {@link Point}.
 */
public static Point parentToLocal(Node n, Point p) {
	// retrieve transform from scene to target parent, by inverting target
	// parent to scene
	AffineTransform localToParentTx = FX2Geometry
			.toAffineTransform(n.getLocalToParentTransform());
	AffineTransform parentToLocalTx = null;
	try {
		parentToLocalTx = localToParentTx.getCopy().invert();
	} catch (NoninvertibleTransformException e) {
		// TODO: How do we recover from this?!
		throw new IllegalStateException(e);
	}
	return parentToLocalTx.getTransformed(p);
}
 
Example #24
Source File: AffineTransform.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link AffineTransform} that represents the inverse
 * transformation of this {@link AffineTransform}.
 *
 * @return a new {@link AffineTransform} that represents the inverse
 *         transformation of this {@link AffineTransform}
 */
public AffineTransform getInverse() {
	try {
		return new AffineTransform(delegate.createInverse());
	} catch (NoninvertibleTransformException e) {
		throw new IllegalArgumentException(e);
	}
}
 
Example #25
Source File: NativeStrike.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private int getNativePointSize() {
    /* Make a copy of the glyphTX in which we will store the
     * font transform, inverting the devTx if necessary
     */
    double[] mat = new double[4];
    desc.glyphTx.getMatrix(mat);
    fontTx = new AffineTransform(mat);

    /* Now work backwards to get the font transform */
    if (!desc.devTx.isIdentity() &&
        desc.devTx.getType() != AffineTransform.TYPE_TRANSLATION) {
        try {
            invertDevTx = desc.devTx.createInverse();
            fontTx.concatenate(invertDevTx);
        } catch (NoninvertibleTransformException e) {
            e.printStackTrace();
        }
    }

    /* At this point the fontTx may be a simple +ve scale, or it
     * may be something more complex.
     */
    Point2D.Float pt = new Point2D.Float(1f,1f);
    fontTx.deltaTransform(pt, pt);
    double ptSize = Math.abs(pt.y);
    int ttype = fontTx.getType();
    if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
        fontTx.getScaleY() <= 0) {
        /* We need to create an inverse transform that doesn't
         * include the point size (strictly the uniform scale)
         */
        fontTx.scale(1/ptSize, 1/ptSize);
    } else {
        fontTx = null; // no need
    }
    return (int)ptSize;
}
 
Example #26
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 #27
Source File: PerspectiveTransform.java    From pumpernickel with MIT License 5 votes vote down vote up
/**
 * Returns a new PerpectiveTransform that is the inverse of the current
 * transform.
 * 
 * @throws NoninvertibleTransformException
 *             if transform cannot be inverted
 */
public PerspectiveTransform createInverse()
		throws NoninvertibleTransformException {

	PerspectiveTransform tx = (PerspectiveTransform) clone();
	tx.makeAdjoint();
	if (Math.abs(tx.m22) < PERSPECTIVE_DIVIDE_EPSILON) {
		throw new NoninvertibleTransformException(
				JaiI18N.getString("PerspectiveTransform0"));
	}
	tx.normalize();
	return tx;
}
 
Example #28
Source File: SunGraphics2D.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Shape untransformShape(Shape s) {
    if (s == null) {
        return null;
    }
    if (transformState > TRANSFORM_INT_TRANSLATE) {
        try {
            return transformShape(transform.createInverse(), s);
        } catch (NoninvertibleTransformException e) {
            return null;
        }
    } else {
        return transformShape(-transX, -transY, s);
    }
}
 
Example #29
Source File: TexturePaintContext.java    From openjdk-jdk8u 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 #30
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);

}