Package java.awt

Examples of java.awt.Graphics2D.clearRect()


      //prepare image
      peerloadPicture = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
        final Graphics2D g = peerloadPicture.createGraphics();
        g.setBackground(Color.decode("0x"+COL_LOAD_BG));
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.clearRect(0,0,width,height);

        final int circ_w = Math.min(width,height)-20; //width of the circle (r*2)
        final int circ_x = width-circ_w-10;           //x-coordinate of circle-left
        final int circ_y = 10;                        //y-coordinate of circle-top
        int curr_angle = 0;                       //remember current angle
View Full Code Here


        final int bgG = (int) ((this.backgroundCol >> 8) & 0xff);
        final int bgB = (int) (this.backgroundCol & 0xff);

        final Graphics2D gr = image.createGraphics();
        gr.setBackground(new Color(bgR, bgG, bgB));
        gr.clearRect(0, 0, width, height);
    }
   
    public void setDrawMode(final DrawMode drawMode) {
        this.defaultMode = drawMode;
    }
View Full Code Here

      // super.paint( g );
      final Graphics2D g2d = (Graphics2D) g;
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
          RenderingHints.VALUE_ANTIALIAS_ON);
      g2d.setBackground(backgroundColor);
      g2d.clearRect(0, 0, this.getWidth(), this.getHeight());
      final GradientPaint gp = new GradientPaint(0f, 0f, backgroundColor, 0f,
          this.getHeight() / 2.f, textColor, true);
      g2d.setPaint(gp);
      g2d.setFont(font);
      final FontMetrics metrics = g2d.getFontMetrics();
View Full Code Here

  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D graphics = (Graphics2D) g;
    graphics.setBackground(getBackground());
    graphics.clearRect(0, 0, getWidth(), getHeight());
    if (image != null) {
      graphics.drawImage(image, transformation, this);
    }
    g.dispose();
  }
View Full Code Here

        Graphics2D graphics = image.createGraphics();

        // Background
        final Color background = new Color(226, 226, 222);
        graphics.setBackground(background);
        graphics.clearRect(0, 0, bounds.width, bounds.height);

        paintComponent(graphics);

        return image;
    }
View Full Code Here

        w = x2 - x1 + 1;
        h = y2 - y1 + 1;

        g2d.setBackground(Color.darkGray);
        g2d.clearRect(x1, y1, w, h);

        free_memory  = RUNTIME.freeMemory();
        total_memory = RUNTIME.totalMemory();

        // percentage of memory used
View Full Code Here

        if (emptyBackground)
        {
            this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            Graphics2D gfx = (Graphics2D) this.image.getGraphics();
            gfx.setBackground(Color.WHITE);
            gfx.clearRect(0, 0, width, height);           
        }
    }
   
    /**
     * Renders this image
View Full Code Here

        }

        @Override
        public void paint(Graphics gr) {
            Graphics2D g = (Graphics2D)gr;
            g.clearRect(0, 0, getWidth(), getHeight());
            g.translate(panelTranslationX, panelTranslationY);
           
                for(Cell c : cacheImpl.getCells())
                    drawCell(c, g);
        }
View Full Code Here

      }
      BufferedImage destBufferedImage = new BufferedImage(destWidth,
          destHeight, BufferedImage.TYPE_INT_RGB);
      Graphics2D graphics2D = destBufferedImage.createGraphics();
      graphics2D.setBackground(Color.WHITE);
      graphics2D.clearRect(0, 0, destWidth, destHeight);
      graphics2D.drawImage(srcBufferedImage.getScaledInstance(imgWidth,
          imgHeight, Image.SCALE_SMOOTH), (destWidth / 2)
          - (imgWidth / 2), (destHeight / 2) - (imgHeight / 2), null);
      graphics2D.dispose();
      ImageIO.write(destBufferedImage, "JPEG", new File(destPath));
View Full Code Here

                                RenderingHints.VALUE_ANTIALIAS_ON);

            int w = getWidth();
            int h = getHeight();

            g2.clearRect(0, 0, w, h);
           
            g2.setPaint(Color.black);
            g2.drawRect(0, 0, w - 1, h - 1);
           
            for (Vector2D point : points) {
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.