Package java.awt

Examples of java.awt.Graphics2D.rotate()


    Graphics2D g2 = (Graphics2D) g.create();
    double cx = x + icon.getIconWidth() / 2.0;
    double cy = y + icon.getIconHeight() / 2.0;
    if (dir == Direction.WEST) {
      g2.rotate( Math.PI, cx, cy);
    } else if (dir == Direction.NORTH) {
      g2.rotate(-Math.PI / 2.0, cx, cy);
    } else if (dir == Direction.SOUTH) {
      g2.rotate( Math.PI / 2.0, cx, cy);
    } else {
View Full Code Here


    double cx = x + icon.getIconWidth() / 2.0;
    double cy = y + icon.getIconHeight() / 2.0;
    if (dir == Direction.WEST) {
      g2.rotate( Math.PI, cx, cy);
    } else if (dir == Direction.NORTH) {
      g2.rotate(-Math.PI / 2.0, cx, cy);
    } else if (dir == Direction.SOUTH) {
      g2.rotate( Math.PI / 2.0, cx, cy);
    } else {
      g2.translate(-x, -y);
    }
View Full Code Here

    if (dir == Direction.WEST) {
      g2.rotate( Math.PI, cx, cy);
    } else if (dir == Direction.NORTH) {
      g2.rotate(-Math.PI / 2.0, cx, cy);
    } else if (dir == Direction.SOUTH) {
      g2.rotate( Math.PI / 2.0, cx, cy);
    } else {
      g2.translate(-x, -y);
    }
    icon.paintIcon(dest, g2, x, y);
    g2.dispose();
View Full Code Here

    } else if (g instanceof Graphics2D){
      Graphics2D g2 = (Graphics2D) g.create();
      int yoffs = (tableHeight + headHeight + cellHeight + headerWidth) / 2;
      int headX = x + headFm.getAscent();
      int headY = y + yoffs;
      g2.rotate(-Math.PI / 2.0);
      g2.drawString(rowHeader, -headY, headX);
      g2.dispose();
    }
   
    x += headHeight;
View Full Code Here

    g.translate(loc.getX(), loc.getY());

    Direction from = painter.getAttributeValue(StdAttr.FACING);
    int degrees = Direction.EAST.toDegrees() - from.toDegrees();
    double radians = Math.toRadians((degrees + 360) % 360);
    g.rotate(radians);

    GraphicsUtil.switchToWidth(g, Wire.WIDTH);
    if (!isGhost && painter.getShowState()) {
      g.setColor(painter.getPort(0).getColor());
    }
View Full Code Here

    int m = flip ? 1 : -1;

    Graphics2D g = (Graphics2D) painter.getGraphics();
    Location loc = painter.getLocation();
    g.translate(loc.getX(), loc.getY());
    g.rotate(radians);

    Color gate;
    Color input;
    Color output;
    Color platform;
View Full Code Here

    // arrow (same color as platform)
    g.drawLine(-21, m * 6, -18, m * 3);
    g.drawLine(-21, 0, -18, m * 3);

    g.rotate(-radians);
    g.translate(-loc.getX(), -loc.getY());
  }
}
View Full Code Here

    g.translate(loc.getX(), loc.getY());

    Direction from = painter.getAttributeValue(StdAttr.FACING);
    int degrees = Direction.EAST.toDegrees() - from.toDegrees();
    double radians = Math.toRadians((degrees + 360) % 360);
    g.rotate(radians);

    GraphicsUtil.switchToWidth(g, Wire.WIDTH);
    if (!isGhost && painter.getShowState()) {
      g.setColor(painter.getPort(0).getColor());
    }
View Full Code Here

    int degrees = Direction.WEST.toDegrees() - facing.toDegrees();
    if (flip) degrees += 180;
    double radians = Math.toRadians((degrees + 360) % 360);

    Graphics2D g = (Graphics2D) painter.getGraphics().create();
    g.rotate(radians, bds.getX() + 20, bds.getY() + 20);
    g.translate(bds.getX(), bds.getY());
    GraphicsUtil.switchToWidth(g, Wire.WIDTH);
   
    Color gate0 = g.getColor();
    Color gate1 = gate0;
View Full Code Here

      for (int i = 0; i < mapWithHoly.length; i++) {
      mapWithHoly[i] = new Point((x - 1) - (int) mapWithHoly[i].getY(),
          (int) mapWithHoly[i].getX());
      }
     
      bgGraphic.rotate(90 * Math.PI / 180, 160.5, 160.5);
      bgGraphic.drawImage(imgBackground, 0, 0, null);
      break;
    case BOTTOMRIGHT:
      for (int i = 0; i < mapWithPath.length; i++) {
        mapWithPath[i] = new Point((x - 1)
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.