Examples of createCompatibleImage()


Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    Border border = style.getBorderDown();
    Insets insets = border.getBorderInsets(null);
   
    // Image used as the template for the icons
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    BufferedImage image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
   
    // Active, not selected
    Graphics2D g = image.createGraphics();
    g.setColor(style.getForeground());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    g.dispose();
    defaultIcon = new ImageIcon(image);
   
    // Active, selected
    // Icon does not copy the image, so we need a new one
    BufferedImage image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image2.createGraphics();
    // Copy the old image to the background
    g.drawImage(image, 0, 0, null);
    // Draw the tick
    BasicStroke stroke = new BasicStroke(2);
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    drawTick(g, insets);
    g.dispose();
    defaultSelectedIcon = new ImageIcon(image2);
   
    // Inactive, not selected
    image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image2.createGraphics();
    g.setColor(style.getShadowColor());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
    g.setClip(0, 0, ICON_WIDTH, ICON_WIDTH);
    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
    g.dispose();
    disabledIcon = new ImageIcon(image2);
   
    // Inactive, selected
    image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image.createGraphics();
    // Copy unselected image
    g.drawImage(image2, 0, 0, null);
    g.setStroke(stroke);
    g.setColor(style.getHighLightColor());
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

  private Image makeModifiedImage(Sprite template, Color color) {
    final int width = template.getWidth();
    final int height = template.getHeight();
   
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    final BufferedImage image = gc.createCompatibleImage(width, height, Transparency.OPAQUE);
   
    Graphics2D g = image.createGraphics();
    template.draw(g, 0, 0);
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
    g.setColor(color);
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    public static BufferedImage createCompatibleImage(int width, int height) {
        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice screenDevice = environment.getDefaultScreenDevice();
        GraphicsConfiguration configuration = screenDevice.getDefaultConfiguration();
        return configuration.createCompatibleImage(width, height);
    }

    public static BufferedImage loadCompatibleImage(URL resource) throws IOException {
        BufferedImage image = ImageIO.read(resource);
        BufferedImage compatibleImage = createCompatibleImage(image.getWidth(), image.getHeight());
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

    } else {
      GraphicsConfiguration gc = ge.getDefaultScreenDevice()
          .getDefaultConfiguration();
//        int imageType = layerId.equals("backing") && false ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
//        img = new BufferedImage((int)b.width, (int)b.height, imageType);
      img = gc.createCompatibleImage(w, h,
          layerId.equals("backing") ? Transparency.OPAQUE
              : Transparency.TRANSLUCENT);
    }
    ctx = (Graphics2D) img.createGraphics();
    ctx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

            if (bufferedImage == null
                || bufferedImageGC != gc
                || bufferedImage.getWidth() < clipBounds.width
                || bufferedImage.getHeight() < clipBounds.height) {

                bufferedImage = gc.createCompatibleImage(clipBounds.width,
                    clipBounds.height, Transparency.OPAQUE);
                bufferedImageGC = gc;
            }

            if (bufferedImage != null) {
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

        BufferedImage argbImage = new BufferedImage(width, height, imageType);

        // from there, create an image with Transparency.BITMASK
        Graphics2D g = argbImage.createGraphics();
        GraphicsConfiguration gc = g.getDeviceConfiguration();
        argbImage = gc.createCompatibleImage(width, height, Transparency.BITMASK);
        g.dispose();
        // create a red rectangle
        g = argbImage.createGraphics();
        g.setColor(Color.red);
        g.fillRect(0, 0, width, height);
View Full Code Here

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()

                 || (this.chartBufferHeight != available.getHeight()))
         {
            this.chartBufferWidth = (int) available.getWidth();
            this.chartBufferHeight = (int) available.getHeight();
            GraphicsConfiguration gc = g2.getDeviceConfiguration();
            this.chartBuffer = gc.createCompatibleImage(
                    this.chartBufferWidth, this.chartBufferHeight,
                    Transparency.TRANSLUCENT);
            this.refreshBuffer = true;
         }
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.