Package java.awt.geom

Examples of java.awt.geom.AffineTransform.scale()


    AffineTransform t2d = new AffineTransform();
    t2d.translate(pf.getImageableX(), pf.getImageableY());
    double xscale  = pf.getImageableWidth() / (double)bImage.getWidth();
    double yscale  = pf.getImageableHeight() / (double)bImage.getHeight();
    double scale = Math.min(xscale, yscale);
    t2d.scale(scale, scale);
    try {
      g2d.drawImage(bImage,t2d, this);
    }
    catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here


        AffineTransform af = new AffineTransform();
        af.translate(getTranslateX(),getTranslateY());

        af.translate(getAnchorX(),getAnchorY());
        af.rotate(Math.toRadians(getRotate()));
        af.scale(getScaleX(), getScaleY());
        af.translate(-getAnchorX(),-getAnchorY());

        Shape sh = af.createTransformedShape(r);
        Rectangle2D bds = sh.getBounds2D();
        return Util.toBounds(bds);
View Full Code Here

        AffineTransform af = new AffineTransform();
        af.translate(getTranslateX(),getTranslateY());
        af.translate(getAnchorX(),getAnchorY());
        af.rotate(Math.toRadians(getRotate()));
        af.scale(getScaleX(), getScaleY());
        af.translate(-getAnchorX(),-getAnchorY());
        Shape sh = af.createTransformedShape(poly);
        Rectangle2D bds = sh.getBounds2D();
        return Util.toBounds(bds);
    }
View Full Code Here

    private Point2D screenToModel(double x, double y) {
        AffineTransform af = new AffineTransform();
        af.translate(rect.getTranslateX(),rect.getTranslateY());
        af.translate(rect.getAnchorX(), rect.getAnchorY());
        af.rotate(Math.toRadians(rect.getRotate()));
        af.scale(rect.getScaleX(), rect.getScaleY());
        af.translate(-rect.getAnchorX(), -rect.getAnchorY());
        try {
            return af.inverseTransform(new Point2D.Double(x, y), null);
        } catch (NoninvertibleTransformException e) {
            e.printStackTrace();
View Full Code Here

    private Point2D modelToScreen(double x, double y) {
        AffineTransform af = new AffineTransform();
        af.translate(rect.getTranslateX(),rect.getTranslateY());
        af.translate(rect.getAnchorX(), rect.getAnchorY());
        af.rotate(Math.toRadians(rect.getRotate()));
        af.scale(rect.getScaleX(), rect.getScaleY());
        af.translate(-rect.getAnchorX(), -rect.getAnchorY());
        return af.transform(new Point2D.Double(x,y),null);
    }

    private void resetAnchor() {
View Full Code Here

        if(node != null) {
            AffineTransform af = new AffineTransform();
            af.translate(node.getTranslateX(),node.getTranslateY());
            af.translate(node.getAnchorX(),node.getAnchorY());
            af.rotate(Math.toRadians(node.getRotate()));
            af.scale(node.getScaleX(), node.getScaleY());
            af.translate(-node.getAnchorX(), -node.getAnchorY());
            Point2D pt2 = af.transform(pt, null);
            return new Point2D.Double(pt2.getX(),pt2.getY());
        }
        return new Point2D.Double(pt.getX(),pt.getY());
View Full Code Here

            try {
                AffineTransform af = new AffineTransform();
                af.translate(node.getTranslateX(),node.getTranslateY());
                af.translate(node.getAnchorX(),node.getAnchorY());
                af.rotate(Math.toRadians(node.getRotate()));
                af.scale(node.getScaleX(), node.getScaleY());
                af.translate(-node.getAnchorX(), -node.getAnchorY());
                Point2D pt2 = af.inverseTransform(pt, null);
                return new Point2D.Double(pt2.getX(),pt2.getY());
            } catch (NoninvertibleTransformException e) {
                e.printStackTrace();
View Full Code Here

            AffineTransform af = new AffineTransform();
            af.translate(getTranslateX(),getTranslateY());

            af.translate(getAnchorX(),getAnchorY());
            af.rotate(Math.toRadians(getRotate()));
            af.scale(getScaleX(), getScaleY());
            af.translate(-getAnchorX(),-getAnchorY());

            Shape sh = af.createTransformedShape(r);
            Rectangle2D bds = sh.getBounds2D();
            return Util.toBounds(bds);
View Full Code Here

        AffineTransform af = new AffineTransform();
        af.translate(getTranslateX(),getTranslateY());

        af.translate(getAnchorX(),getAnchorY());
        af.rotate(Math.toRadians(getRotate()));
        af.scale(getScaleX(), getScaleY());
        af.translate(-getAnchorX(),-getAnchorY());

        Shape sh = af.createTransformedShape(r);
        Rectangle2D bds = sh.getBounds2D();
        return Util.toBounds(bds);
View Full Code Here

    protected Shape transformShape(Shape sh) {
        AffineTransform af = new AffineTransform();
        af.translate(getTranslateX(),getTranslateY());
        af.translate(getAnchorX(),getAnchorY());
        af.rotate(Math.toRadians(getRotate()));
        af.scale(getScaleX(), getScaleY());
        af.translate(-getAnchorX(),-getAnchorY());
        return af.createTransformedShape(sh);
    }

    public static interface SShapeListener {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.