Package java.awt

Examples of java.awt.Graphics.translate()


    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

                    Debug.output("ShapeLayer.paint(): " + omg.size() + " omg"
                            + " shadow=" + shadowX + "," + shadowY);

                if (shadowX != 0 || shadowY != 0) {
                    Graphics shadowG = g.create();
                    shadowG.translate(shadowX, shadowY);
                    omg.render(shadowG);
                } else {
                    omg.render(g);
                }
View Full Code Here

    public void paint(Graphics g) {
        super.paint(g);
        Graphics mainArea = g.create(0, getChartUIConfiguration()
                .getHeaderHeight(), (int) getBounds().getWidth(),
                (int) getBounds().getHeight());
        mainArea.translate(0, -getVerticalOffset());
        getPainter().setGraphics(mainArea);
        myResourceLoadRenderer.render();
        myBottomLineRenderer.setHeight(getBounds().height);
        myBottomLineRenderer.render();
        myBottomLineRenderer.getPrimitiveContainer().paint(getPainter(), mainArea);
View Full Code Here

    public BufferedImage getWholeImage() {
    BufferedImage chartImage = getChart(0, 0, getWidth(), getHeight(), getWidth(), getHeight());
        BufferedImage result = new BufferedImage(chartImage.getWidth()+myTaskImage.getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
        Graphics g = result.getGraphics();
        g.drawImage(myTaskImage,0,0,null);
        g.translate(myTaskImage.getWidth(), 0);
        g.drawImage(chartImage, 0,0,null);
        return result;
  }

View Full Code Here

  public Raster getTile(int tileX, int tileY) {
    if (myCurrentTile!=tileY) {
            int offsety = tileY*getTileHeight();
            BufferedImage tile = getChart(myTaskImage.getWidth(), offsety, getTileWidth(),getTileHeight(),  getWidth(), getHeight());
            Graphics g = tile.getGraphics();
            g.translate(0, -offsety);
            g.drawImage(myTaskImage,0,0,null);
            myCurrentRaster = tile.getRaster().createTranslatedChild(0, tileY*getTileHeight());
            myCurrentTile = tileY;
    }
    return myCurrentRaster;
View Full Code Here

    private BufferedImage getChart(int offsetx, int offsety,  int width, int height, int chartWidth, int chartHeight) {
        BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB );
        Graphics g2 = result.getGraphics();
        g2.setColor(Color.white);
        g2.fillRect(0, 0, width,height);
        g2.translate(offsetx, -offsety);
        g2.clipRect(0,offsety,width,height);
        myChartModel.setBounds(new Dimension(chartWidth, chartHeight));
        paintChart(g2);
        //myChartModel.setTuningOptions(ChartModelImpl.TuningOptions.DEFAULT);
        return result;
View Full Code Here

                    if(m.getName().equals(ActionMenu.SEPARATOR.getName())) {
                        int h = separator.getPreferredSize().height;
                        int sw = s.width - ( insets == null ? 0 : ( ( insets.left + insets.right ) / 2 ) ) - ( borderWidth * 2 );
                        separator.setBounds(0, 0, sw, h);
                        int sx = (s.width - sw ) / 2;
                        g.translate(sx, py);
                        separator.paint(g);
                        g.translate(-sx, -py);
                        py += h;
                    }
                    else {
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.