类java.awt.geom.NoninvertibleTransformException源码实例Demo

下面列出了怎么用java.awt.geom.NoninvertibleTransformException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: darklaf   文件: ColorTriangle.java
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();
    }
}
 
源代码2 项目: darklaf   文件: ColorTriangle.java
@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;
}
 
源代码3 项目: jdk8u-jdk   文件: AttributeValues.java
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;
}
 
源代码4 项目: dragonwell8_jdk   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码5 项目: dragonwell8_jdk   文件: AttributeValues.java
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;
}
 
源代码6 项目: TencentKona-8   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码7 项目: TencentKona-8   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码8 项目: pumpernickel   文件: AbstractGraphics2D.java
@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;
	}
}
 
源代码9 项目: openjdk-8-source   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码10 项目: openjdk-8-source   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码11 项目: jdk8u60   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码12 项目: jdk8u_jdk   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码13 项目: openjdk-jdk8u   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码14 项目: openjdk-jdk8u   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码15 项目: jdk8u_jdk   文件: AttributeValues.java
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;
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码17 项目: openjdk-8   文件: StandardGlyphVector.java
/**
 * 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;
    }
}
 
源代码18 项目: hottub   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码19 项目: pumpernickel   文件: CurvedPolylineCreationUI.java
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());
}
 
源代码20 项目: openjdk-jdk9   文件: StandardGlyphVector.java
/**
 * !!! 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");
    }
}
 
源代码21 项目: openstock   文件: FXGraphics2D.java
/**
 * Returns the user clipping region.  The initial default value is 
 * {@code null}.
 * 
 * @return The user clipping region (possibly {@code null}).
 * 
 * @see #setClip(java.awt.Shape)
 */
@Override
public Shape getClip() {
    if (this.clip == null) {
        return null;
    }
    AffineTransform inv;
    try {
        inv = this.transform.createInverse();
        return inv.createTransformedShape(this.clip);
    } catch (NoninvertibleTransformException ex) {
        return null;
    }
}
 
源代码22 项目: darklaf   文件: MouseEventUI.java
private Point transformPoint(final JXLayer<? extends V> layer, final Point point) {
    AffineTransform transform = this.getTransform(layer);
    if (transform != null) {
        try {
            transform.inverseTransform(point, point);
        } catch (NoninvertibleTransformException e) {
            e.printStackTrace();
        }
    }
    return point;
}
 
@Override
protected void saveTransformForUndo() {
  try {
    AffineTransform inverse = bufferedTransform.createInverse();
    bufferedFigure.willChange();
    bufferedFigure.transform(inverse);
    bufferedFigure.changed();
  }
  catch (NoninvertibleTransformException e) {
    LOG.warn("Exception inverting transform.", e);
  }
}
 
源代码24 项目: hottub   文件: MultiGradientTest.java
private void updatePoints(int x, int y) {
    Point2D inv = new Point2D.Double(x, y);

    try {
        inv = transform.inverseTransform(inv, null);
    } catch (NoninvertibleTransformException e) {
        e.printStackTrace();
    }

    x = (int)inv.getX();
    y = (int)inv.getY();

    switch (paintType) {
    default:
    case BASIC:
    case LINEAR:
        // pick the closest point to move
        if (inv.distance(startX, startY) < inv.distance(endX, endY)) {
            startX = x;
            startY = y;
        } else {
            endX = x;
            endY = y;
        }
        break;

    case RADIAL:
        // pick the closest point to move
        if (inv.distance(ctrX, ctrY) < inv.distance(focusX, focusY)) {
            ctrX = x;
            ctrY = y;
        } else {
            focusX = x;
            focusY = y;
        }
        break;
    }

    updatePaint();
}
 
源代码25 项目: dragonwell8_jdk   文件: TexturePaintContext.java
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);

}
 
源代码26 项目: dragonwell8_jdk   文件: SunGraphics2D.java
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);
    }
}
 
源代码27 项目: coordination_oru   文件: PathEditor2.java
private Point2D getMousePositionInMap() {
	Point2D mousePositionInMap = null;
	AffineTransform geomToScreen = panel.getMapTransform();
	try {
		AffineTransform geomToScreenInv = geomToScreen.createInverse();
		mousePositionInMap = geomToScreenInv.transform(new Point2D.Double(panel.getMousePosition().x,panel.getMousePosition().y), null);
		//System.out.println(mousePosition);
	} catch (NoninvertibleTransformException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	}
	return mousePositionInMap;
}
 
源代码28 项目: dragonwell8_jdk   文件: LayoutPathImpl.java
public boolean pointToPath(Point2D pt, Point2D result) {
    result.setLocation(pt);
    if (tx != null) {
        try {
            tx.inverseTransform(pt, result);
        }
        catch (NoninvertibleTransformException ex) {
        }
    }
    return result.getX() > 0;
}
 
源代码29 项目: openjdk-8-source   文件: TexturePaintContext.java
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);

}
 
源代码30 项目: dragonwell8_jdk   文件: Test8004859.java
public static void main(final String[] args)
        throws NoninvertibleTransformException {
    final BufferedImage bi = new BufferedImage(300, 300,
                                               BufferedImage.TYPE_INT_RGB);
    final Graphics2D g = (Graphics2D) bi.getGraphics();
    test(g);
    g.translate(2.0, 2.0);
    test(g);
    g.translate(-4.0, -4.0);
    test(g);
    g.scale(2.0, 2.0);
    test(g);
    g.scale(-4.0, -4.0);
    test(g);
    g.rotate(Math.toRadians(90));
    test(g);
    g.rotate(Math.toRadians(90));
    test(g);
    g.rotate(Math.toRadians(90));
    test(g);
    g.rotate(Math.toRadians(90));
    test(g);
    g.dispose();
    if (!status) {
        throw new RuntimeException("Test failed");
    }
}
 
 类所在包
 类方法
 同包方法