Package java.awt

Examples of java.awt.Graphics.translate()


                clipRect.width + 1, clipRect.height + 1);
        if (image == null) {
            return;
        }
        Graphics offscreenGraphics = image.getGraphics();
        offscreenGraphics.translate(-clipRect.x, -clipRect.y);
        offscreenGraphics.setClip(clipRect);
        doubleBufferingRoot = true;
        try {
            paint(getComponentGraphics(offscreenGraphics));
            g.drawImage(image, clipRect.x, clipRect.y, this);
View Full Code Here


      double scale = Math.min(1.0, Math.min(scaleX, scaleY));
     
      Graphics gCopy = g.create();
      int borderX = (int) ((size.width - bds.getWidth() * scale) / 2);
      int borderY = (int) ((size.height - bds.getHeight() * scale) / 2);
      gCopy.translate(borderX, borderY);
      if (scale != 1.0 && g instanceof Graphics2D) {
        ((Graphics2D) gCopy).scale(scale, scale);
      }
      gCopy.translate(-bds.getX(), -bds.getY());
     
View Full Code Here

      int borderY = (int) ((size.height - bds.getHeight() * scale) / 2);
      gCopy.translate(borderX, borderY);
      if (scale != 1.0 && g instanceof Graphics2D) {
        ((Graphics2D) gCopy).scale(scale, scale);
      }
      gCopy.translate(-bds.getX(), -bds.getY());
     
      ComponentDrawContext context = new ComponentDrawContext(this, circuit,
          circuitState, g, gCopy);
      context.setShowState(false);
      context.setShowColor(false);
View Full Code Here

  public final void paintIcon(ComponentDrawContext context,
      int x, int y, AttributeSet attrs) {
    InstancePainter painter = context.getInstancePainter();
    painter.setFactory(this, attrs);
    Graphics g = painter.getGraphics();
    g.translate(x, y);
    paintIcon(painter);
    g.translate(-x, -y);
   
    if (painter.getFactory() == null) {
      Icon i = icon;
View Full Code Here

    InstancePainter painter = context.getInstancePainter();
    painter.setFactory(this, attrs);
    Graphics g = painter.getGraphics();
    g.translate(x, y);
    paintIcon(painter);
    g.translate(-x, -y);
   
    if (painter.getFactory() == null) {
      Icon i = icon;
      if (i == null) {
        String n = iconName;
View Full Code Here

  public final void drawGhost(ComponentDrawContext context, Color color,
      int x, int y, AttributeSet attrs) {
    InstancePainter painter = context.getInstancePainter();
    Graphics g = painter.getGraphics();
    g.setColor(color);
    g.translate(x, y);
    painter.setFactory(this, attrs);
    paintGhost(painter);
    g.translate(-x, -y);
    if (painter.getFactory() == null) {
      super.drawGhost(context, color, x, y, attrs);
View Full Code Here

    Graphics g = painter.getGraphics();
    g.setColor(color);
    g.translate(x, y);
    painter.setFactory(this, attrs);
    paintGhost(painter);
    g.translate(-x, -y);
    if (painter.getFactory() == null) {
      super.drawGhost(context, color, x, y, attrs);
    }
  }
 
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

  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);
    Value pull = getPullValue(painter.getAttributeSet());
    Value actual = painter.getPort(0);
    paintBase(painter, pull, pull.getColor(), actual.getColor());
    g.translate(-x, -y);
    painter.drawPorts();
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.