Package java.awt

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


    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

      // 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

    final Graphics2D g = (Graphics2D) graphics.create();
    // draw background
    if (background != null)
    {
      g.setBackground(background);
      g.clearRect(0, 0, (int) drawArea.getWidth(), (int) drawArea.getHeight());
    }

    g.translate(drawArea.getX() - adjustX, drawArea.getY() - adjustY);
    final int radius = (int) (drawArea.getWidth() < drawArea.getHeight() ? drawArea.getWidth() : drawArea.getHeight());
    // draw a filled circle form its center to its edge with the background color
View Full Code Here

    final Graphics2D g = (Graphics2D) g2.create();
    g.translate(drawArea.getX(), drawArea.getY());
    if (background != null)
    {
      g.setBackground(background);
      g.clearRect(0, 0, (int) drawArea.getWidth(), height);
    }

    if (data == null || data.length == 0)
    {
      g.dispose();
View Full Code Here

    Graphics2D g = thumbnail.createGraphics();
    try {
      g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
          RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      g.setBackground(Color.BLACK);
      g.clearRect(0, 0, thumbnailWidth, thumbnailHeight);
      g.drawImage(image, 0, 0, thumbnailWidth, thumbnailHeight, null);
    } finally {
      g.dispose();
    }
    return thumbnail;
View Full Code Here

     
      try {
        if (data._bgColor != 0) {
          Color color = new Color(data._bgColor);
          graphics.setBackground(color);
          graphics.clearRect(0, 0, data._width, data._height);
        }
       
        MethodBinding paint = (MethodBinding) UIComponentBase.restoreAttachedState(facesContext, data._paint);
        paint.invoke(facesContext, new Object[] {graphics,data._data});
      } finally {
View Full Code Here

      // 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

      // 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

        Dimension pageDimension = new Dimension( (int)widthPt, (int)heightPt );
           
        BufferedImage retval = new BufferedImage( widthPx, heightPx, imageType );
        Graphics2D graphics = (Graphics2D)retval.getGraphics();
        graphics.setBackground( Color.WHITE );
        graphics.clearRect( 0, 0, retval.getWidth(), retval.getHeight() );
        graphics.scale( scaling, scaling );
        PageDrawer drawer = new PageDrawer();
        drawer.drawPage( graphics, this, pageDimension );

        //TODO This could be done directly by manipulating the transformation matrix before painting.
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.