Package java.awt

Examples of java.awt.Graphics.translate()


        Graphics g = painter.getGraphics();
        g.translate(x, y);
        Value pull = getPullValue(painter.getAttributeSet());
        Value actual = painter.getPort(0);
        paintBase(painter, pull, pull.getColor(), actual.getColor());
        g.translate(-x, -y);
        painter.drawPorts();
    }

    private void paintBase(InstancePainter painter, Value pullValue,
            Color inColor, Color outColor) {
View Full Code Here


        Graphics g = painter.getGraphics();
        Direction facing = painter.getAttributeValue(StdAttr.FACING);
        Location loc = painter.getLocation();
        int x = loc.getX();
        int y = loc.getY();
        g.translate(x, y);
        double rotate = 0.0;
        if (facing != null && facing != Direction.EAST && g instanceof Graphics2D) {
            rotate = -facing.toRadians();
            ((Graphics2D) g).rotate(rotate);
        }
View Full Code Here

        }

        if (rotate != 0.0) {
            ((Graphics2D) g).rotate(-rotate);
        }
        g.translate(-x, -y);
    }

    private void paintRectangularBase(Graphics g, InstancePainter painter) {
        GraphicsUtil.switchToWidth(g, 2);
        if (painter.getAttributeValue(ATTR_SIZE) == SIZE_NARROW) {
View Full Code Here

        Direction facing = painter.getAttributeValue(StdAttr.FACING);
        Location loc = painter.getLocation();
        int x = loc.getX();
        int y = loc.getY();
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        double rotate = 0.0;
        if (facing != Direction.EAST && g instanceof Graphics2D) {
            rotate = -facing.toRadians();
            ((Graphics2D) g).rotate(rotate);
        }
View Full Code Here

        g.drawPolyline(xp, yp, 4);

        if (rotate != 0.0) {
            ((Graphics2D) g).rotate(-rotate);
        }
        g.translate(-x, -y);
    }

    //
    // static methods - shared with other classes
    //
View Full Code Here

            g.drawRect(x, y, w - DEPTH, h - DEPTH);
            g.drawLine(x + w - DEPTH, y + h - DEPTH, x + w, y + h);
            g.drawPolygon(xp, yp, xp.length);
        }

        g.translate(depress, depress);
        g.setColor(painter.getAttributeValue(Io.ATTR_LABEL_COLOR));
        painter.drawLabel();
        g.translate(-depress, -depress);
        painter.drawPorts();
    }
View Full Code Here

        }

        g.translate(depress, depress);
        g.setColor(painter.getAttributeValue(Io.ATTR_LABEL_COLOR));
        painter.drawLabel();
        g.translate(-depress, -depress);
        painter.drawPorts();
    }

    public static class Poker extends InstancePoker {
        @Override
View Full Code Here

    public void paintInstance(InstancePainter painter) {
        Location loc = painter.getLocation();
        int x = loc.getX();
        int y = loc.getY();
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        g.setColor(Color.BLACK);
        paintGhost(painter);
        g.translate(-x, -y);
        painter.drawPorts();
    }
View Full Code Here

        int y = loc.getY();
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        g.setColor(Color.BLACK);
        paintGhost(painter);
        g.translate(-x, -y);
        painter.drawPorts();
    }

    //
    // methods for instances
View Full Code Here

    @Override
    public Canvas createSubcanvas(final int x, final int y, final int width, final int height) {
        final Graphics g = graphics.create();
        // this form of clipping must go here!
        g.translate(x, y);
        return new AwtCanvas(g, renderingArea, 0, 0, width, height);
    }

    @Override
    public void draw3DRectangle(final int x, final int y, final int width, final int height, final Color color,
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.