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


    offscreenG.setColor(context.getPaintBackground());
    offscreenG.fillRect(0, 0, width, height + 1);

    // Reset for text rendering
    offscreenG.setColor(g.getColor());
    offscreenG.translate(-x, -y);

    // Render the wrapped painter into the offscreen buffer.  We offset
    // the y coordinate by one so that no content will be rendered into
    // the top pixel.
    super.paint(context, offscreenG, x, y + 1, width, height);
View Full Code Here

        // clear the exposed area
        offgc.setColor(getBackground());
        offgc.fillRect(0, 0, box.width, box.height);
        offgc.setColor(getForeground());
        // do normal redraw
        offgc.translate(-box.x, -box.y);
        paint(offgc);
        // transfer offscreen to window
        g.drawImage(offscreen, box.x, box.y, this);
    }
View Full Code Here

   * Returns an EpsGraphics2D object based on this Graphics object, but with a
   * new translation and clip area.
   */
  public Graphics create(int x, int y, int width, int height) {
    Graphics g = create();
    g.translate(x, y);
    g.clipRect(0, 0, width, height);
    return g;
  }

  /**
 
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);
    }
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);
    }

    //
    // methods for instances
    //
View Full Code Here

                }
            }
        }

        g.setColor(baseColor);
        g.translate(loc.getX(), loc.getY());
        double rotate = 0.0;
        if (facing != Direction.EAST && g instanceof Graphics2D) {
            rotate = -facing.toRadians();
            Graphics2D g2 = (Graphics2D) g;
            g2.rotate(rotate);
View Full Code Here

        } else if (shape == AppPreferences.SHAPE_DIN40700) {
            paintDinShape(painter, width, height, inputs);
        // SHAPE_SHAPED
        } else {
            if (negateOutput) {
                g.translate(-10, 0);
                paintShape(painter, width - 10, height);
                painter.drawDongle(5, 0);
                g.translate(10, 0);
            } else {
                paintShape(painter, width, height);
View Full Code Here

        } else {
            if (negateOutput) {
                g.translate(-10, 0);
                paintShape(painter, width - 10, height);
                painter.drawDongle(5, 0);
                g.translate(10, 0);
            } else {
                paintShape(painter, width, height);
            }
        }
View Full Code Here

        }

        if (rotate != 0.0) {
            ((Graphics2D) g).rotate(-rotate);
        }
        g.translate(-loc.getX(), -loc.getY());

        painter.drawLabel();
    }

    protected void setIconNames(String all) {
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.