Package java.awt

Examples of java.awt.Graphics2D.fillRect()


                Integer count = map == null ? null : map.get(classNames[y]);
                if (count != null) {
                    int b = (int) ((float) count * maxcolor / max);

                    g.setColor(colors.get(b));
                    g.fillRect(CELL_PAD + x * (CELLS_SIZE + CELL_PAD),
                            CELL_PAD + y * (CELLS_SIZE + CELL_PAD),
                            CELLS_SIZE,
                            CELLS_SIZE);
                }
            }
View Full Code Here


    }
    BufferedImage image = new BufferedImage(
        (int)pattern.getWidth(), (int)pattern.getHeight(), BufferedImage.TYPE_INT_RGB);
    Graphics2D imageGraphics = (Graphics2D)image.getGraphics();
    imageGraphics.setColor(backgroundColor);
    imageGraphics.fillRect(0, 0, image.getWidth(), image.getHeight());
    // Get pattern image from cache
    BufferedImage patternImage = patternImages.get(pattern);
    if (patternImage == null) {
      try {
        InputStream imageInput = pattern.getImage().openStream();
View Full Code Here

      this.attributesPreviewComponent.setImage(attributesPreviewImage);
    }
    // Fill image with a white background
    Graphics2D g2D = (Graphics2D)attributesPreviewImage.getGraphics();
    g2D.setPaint(Color.WHITE);
    g2D.fillRect(0, 0, imageSize, imageSize);   
    BufferedImage textureImage = this.imageChoicePreviewComponent.getImage();
    if (textureImage != null) {
      // Draw the texture image as if it will be shown on a 250 x 250 cm wall
      g2D.setPaint(new TexturePaint(textureImage,
          new Rectangle2D.Float(0, 0,
View Full Code Here

      // Draw the texture image as if it will be shown on a 250 x 250 cm wall
      g2D.setPaint(new TexturePaint(textureImage,
          new Rectangle2D.Float(0, 0,
              this.controller.getWidth() / 250 * imageSize,
              this.controller.getHeight() / 250 * imageSize)));
      g2D.fillRect(0, 0, imageSize, imageSize);
    }
    g2D.dispose();
    this.attributesPreviewComponent.repaint();
  }
}
View Full Code Here

    Color bg = getBackground();
    Color bgWithAlpha = new Color(bg.getRed(), bg.getGreen(), bg.getBlue(), getAlpha());

    g2.setColor(bgWithAlpha);
    g2.fillRect(x, y, w, h);

    g2.dispose();
  }

  private int getAlpha() {
View Full Code Here

      BufferedImage image = new BufferedImage((int)Math.ceil(selectionBounds.getWidth() * clipboardScale + 2 * extraMargin),
              (int)Math.ceil(selectionBounds.getHeight() * clipboardScale + 2 * extraMargin), BufferedImage.TYPE_INT_RGB);     
      Graphics2D g2D = (Graphics2D)image.getGraphics();
      // Paint background in white
      g2D.setColor(Color.WHITE);
      g2D.fillRect(0, 0, image.getWidth(), image.getHeight());
      // Change component coordinates system to plan system
      g2D.scale(clipboardScale, clipboardScale);
      g2D.translate(-selectionBounds.getMinX() + extraMargin,
          -selectionBounds.getMinY() + extraMargin);
      setRenderingHints(g2D);
View Full Code Here

      // Fill the pixels of plan icon with texture image
      imageGraphics.setPaint(new TexturePaint(textureImage,
          new Rectangle2D.Float(0, 0, -getIconWidth() / pieceWidth * pieceTexture.getWidth(),
              -getIconHeight() / pieceDepth * pieceTexture.getHeight())));
      imageGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN));
      imageGraphics.fillRect(0, 0, getIconWidth(), getIconHeight());                 
      imageGraphics.dispose();
     
      setIcon(new ImageIcon(image));
    }
  }
View Full Code Here

       
        Point translation = getImageTranslation();
        float scale = getImageScale();
        // Fill image background
        g2D.setColor(UIManager.getColor("window"));
        g2D.fillRect(translation.x, translation.y, (int)(getImage().getWidth() * scale),
            (int)(getImage().getHeight() * scale));
       
        // Paint image with a 0.5 alpha
        paintImage(g2D, AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));       

View Full Code Here

            RenderingHints.VALUE_ANTIALIAS_ON);
       
        Point translation = getImageTranslation();
        // Fill image background
        g2D.setColor(UIManager.getColor("window"));
        g2D.fillRect(translation.x, translation.y, (int)(getImage().getWidth() * getImageScale()),
            (int)(getImage().getHeight() * getImageScale()));
       
        // Paint image with a 0.5 alpha
        paintImage(g, AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));       
       
View Full Code Here

       
        @Override
        protected void paintComponent(Graphics g) {
          Graphics2D g2D = (Graphics2D)g;
          g2D.setColor(getBackground());
          g2D.fillRect(0, 0, getWidth(), getHeight());
          super.paintComponent(g);
        }

        @Override
        protected void paintHomeItems(Graphics g, float planScale, Color backgroundColor, Color foregroundColor,
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.