Examples of clearRect()


Examples of java.awt.Graphics2D.clearRect()

  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

Examples of java.awt.Graphics2D.clearRect()

        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

Examples of java.awt.Graphics2D.clearRect()

        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

Examples of java.awt.Graphics2D.clearRect()

        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

Examples of java.awt.Graphics2D.clearRect()

        }

        @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

Examples of java.awt.Graphics2D.clearRect()

      }
      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

Examples of java.awt.Graphics2D.clearRect()

                                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

Examples of java.awt.Graphics2D.clearRect()

                                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);
           
            int index = 0;
View Full Code Here

Examples of java.awt.Graphics2D.clearRect()

    public BufferedImage createImage() {
        final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        final Graphics2D g = (Graphics2D) image.getGraphics();
        g.setBackground(Color.white);
        g.clearRect(0, 0, width, height);
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f));

        if (tree.root().isPresent()) {
            final List<RectangleDepth> nodeDepths = getNodeDepthsSortedByDepth(tree.root().get());
            drawNode(g, nodeDepths);
View Full Code Here

Examples of java.awt.Graphics2D.clearRect()

      // Copy the scaled image into the new one
      BufferedImage imageBuf = new BufferedImage(chosenWidth, chosenHeight, BufferedImage.TYPE_INT_RGB);
      Graphics2D newImage = imageBuf.createGraphics();
      newImage.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      newImage.setBackground(hexToColor(bgColor)); // Set the background color
      newImage.clearRect(0, 0, chosenWidth, chosenHeight);
      newImage.drawImage(imgScaled, getImageOffset(chosenWidth, newWidth), getImageOffset(chosenHeight, newHeight),
         newWidth, newHeight, null);

      return imageBuf;
   }
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.