Package java.awt.geom

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


        group.addShape(r);
    }

    public void translate(int x, int y) {
        AffineTransform at = new AffineTransform();
        at.translate(x, y);
        transform.concatenate(at);
    }

    public void clip(Shape shape) {
        this.clip = transform.createTransformedShape(shape);
View Full Code Here


    }

    Graphics2D g2d = (Graphics2D)g;
    //g2d.translate(pf.getImageableX(), pf.getImageableY());
    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 {
View Full Code Here

    @Override
    public Bounds getTransformedBounds() {
        java.awt.geom.Rectangle2D r = new Rectangle2D.Double(getX(),getY(),getWidth(),getHeight());
        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());
View Full Code Here

    public Bounds getTransformedBounds() {
        java.awt.geom.Rectangle2D r = new Rectangle2D.Double(getX(),getY(),getWidth(),getHeight());
        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);
View Full Code Here

        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

        for(int i=0; i<points.length; i+=2) {
            poly.addPoint((int)points[i],(int)points[i+1]);
        }

        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);
View Full Code Here

            poly.addPoint((int)points[i],(int)points[i+1]);
        }

        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();
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

        resetAnchor();
    }

    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 {
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);
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.