Java Code Examples for java.awt.GraphicsConfiguration#createCompatibleImage()

The following examples show how to use java.awt.GraphicsConfiguration#createCompatibleImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncorrectAlphaConversionBicubic.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc,
                                             int type) {
    BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type);
    Graphics2D g2d = img.createGraphics();
    g2d.setColor(RGB);
    g2d.fillRect(0, 0, SIZE, SIZE);
    g2d.dispose();
    final DataBuffer db = img.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            img.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return img;
}
 
Example 2
Source File: ImageUtils.java    From dsworkbench with Apache License 2.0 6 votes vote down vote up
/**Optimize an image or create a copy of an image if the image was created by getBufferedImage()*/
public static BufferedImage optimizeImage(BufferedImage image) {
    // obtain the current system graphical settings
    GraphicsConfiguration gfx_config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();

    /*
     * if image is already compatible and optimized for current system
     * settings, simply return it
     */
    if (image.getColorModel().equals(gfx_config.getColorModel())) {
        return image;
    }

    // image is not optimized, so create a new image that is
    BufferedImage new_image = gfx_config.createCompatibleImage(image.getWidth(), image.getHeight(), image.getTransparency());

    // get the graphics context of the new image to draw the old image on
    Graphics2D g2d = (Graphics2D) new_image.getGraphics();

    // actually draw the image and dispose of context no longer needed
    g2d.drawRenderedImage(image, AffineTransform.getTranslateInstance(0, 0));
    g2d.dispose();

    // return the new optimized image
    return new_image;
}
 
Example 3
Source File: NonOpaqueDestLCDAATest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void initImages(int w, int h) {
    if (images == null) {
        images = new Image[6];
        GraphicsConfiguration gc = getGraphicsConfiguration();
        for (int i = OPAQUE; i <= TRANSLUCENT; i++) {
            VolatileImage vi =
                gc.createCompatibleVolatileImage(w,h/images.length,i);
            images[i-1] = vi;
            vi.validate(gc);
            String s = "LCD AA Text rendered to " + tr[i - 1] + " HW destination";
            render(vi, i, s);

            s = "LCD AA Text rendered to " + tr[i - 1] + " SW destination";
            images[i-1+3] = gc.createCompatibleImage(w, h/images.length, i);
            render(images[i-1+3], i, s);
        }
    }
}
 
Example 4
Source File: IntermediateImages.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
    * Draws both the direct and intermediate-image versions of a 
    * smiley face, timing both variations.
    */
   private void drawSmiley(Graphics g) {
       long startTime, endTime, totalTime;

       // Draw smiley directly
       startTime = System.nanoTime();
       for (int i = 0; i < 100; ++i) {
           renderSmiley(g, SMILEY_X, DIRECT_Y);
       }
       endTime = System.nanoTime();
       totalTime = (endTime - startTime) / 1000000;
       g.setColor(Color.BLACK);
       g.drawString("Direct: " + ((float)totalTime/100) + " ms", 
               SMILEY_X, DIRECT_Y + SMILEY_SIZE + 20);
       System.out.println("Direct: " + totalTime);
       
       // Intermediate Smiley
       // First, create the intermediate image if necessary
if (smileyImage == null) {
  GraphicsConfiguration gc = getGraphicsConfiguration();
  smileyImage = gc.createCompatibleImage(
                 SMILEY_SIZE + 1, SMILEY_SIZE + 1, Transparency.BITMASK);
  Graphics2D gImg = (Graphics2D)smileyImage.getGraphics();
  renderSmiley(gImg, 0, 0);
  gImg.dispose();
}
       // Now, copy the intermediate image
       startTime = System.nanoTime();
       for (int i = 0; i < 100; ++i) {
           g.drawImage(smileyImage, SMILEY_X, INTERMEDIATE_Y, null);
       }
       endTime = System.nanoTime();
       totalTime = (endTime - startTime) / 1000000;
       g.drawString("Intermediate: " + ((float)totalTime/100) + " ms", 
               SMILEY_X, INTERMEDIATE_Y + SMILEY_SIZE + 20);
       System.out.println("intermediate smiley: " + totalTime);
   }
 
Example 5
Source File: IncorrectUnmanagedImageRotatedClip.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void test(final BufferedImage bi) throws IOException {
    GraphicsEnvironment ge = GraphicsEnvironment
            .getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice()
                                 .getDefaultConfiguration();
    VolatileImage vi = gc.createCompatibleVolatileImage(500, 200,
                                                        TRANSLUCENT);
    BufferedImage gold = gc.createCompatibleImage(500, 200, TRANSLUCENT);
    // draw to compatible Image
    draw(bi, gold);
    // draw to volatile image
    int attempt = 0;
    BufferedImage snapshot;
    while (true) {
        if (++attempt > 10) {
            throw new RuntimeException("Too many attempts: " + attempt);
        }
        vi.validate(gc);
        if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
            continue;
        }
        draw(bi, vi);
        snapshot = vi.getSnapshot();
        if (vi.contentsLost()) {
            continue;
        }
        break;
    }
    // validate images
    for (int x = 0; x < gold.getWidth(); ++x) {
        for (int y = 0; y < gold.getHeight(); ++y) {
            if (gold.getRGB(x, y) != snapshot.getRGB(x, y)) {
                ImageIO.write(gold, "png", new File("gold.png"));
                ImageIO.write(snapshot, "png", new File("bi.png"));
                throw new RuntimeException("Test failed.");
            }
        }
    }
}
 
Example 6
Source File: TextBoxFactory.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text box sprite.
 *
 * @param text the text inside the box
 * @param width maximum width of the text in the box in pixels
 * @param textColor color of the text
 * @param fillColor background color
 * @param isTalking true if the box should look like a chat bubble
 *
 * @return sprite of the text box
 */
public Sprite createTextBox(final String text, final int width, final Color textColor,
		final Color fillColor, final boolean isTalking) {
	List<AttributedCharacterIterator> lines = createFormattedLines(text, textColor, width);
	// Find the actual width of the text
	final int lineLengthPixels = getMaxPixelWidth(lines);
	final int numLines = lines.size();

	final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
	final int imageWidth;
	if (lineLengthPixels + BUBBLE_OFFSET < width) {
		imageWidth = (lineLengthPixels + BUBBLE_OFFSET) + ARC_DIAMETER;
	} else {
		imageWidth = width + BUBBLE_OFFSET + ARC_DIAMETER;
	}

	final int imageHeight = LINE_HEIGHT * numLines + 2 * MARGIN_WIDTH;

	final BufferedImage image = gc.createCompatibleImage(imageWidth, imageHeight, TransparencyMode.TRANSPARENCY);

	final Graphics2D g2d = image.createGraphics();
	g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	// Background image
	if (fillColor != null) {
		if (isTalking) {
			drawBubble(g2d, fillColor, textColor, imageWidth - BUBBLE_OFFSET, imageHeight);
		} else {
			drawRectangle(g2d, fillColor, textColor, imageWidth - BUBBLE_OFFSET, imageHeight);
		}
	}

	// Text
	drawTextLines(g2d, lines, textColor, MARGIN_WIDTH + BUBBLE_OFFSET, MARGIN_WIDTH);
	g2d.dispose();

	return new ImageSprite(image);
}
 
Example 7
Source File: IncorrectClipSurface2SW.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getCompatibleImage(GraphicsConfiguration gc,
                                                int size) {
    BufferedImage image = gc.createCompatibleImage(size, size);
    Graphics2D g2d = image.createGraphics();
    g2d.setColor(Color.GREEN);
    g2d.fillRect(0, 0, size, size);
    return image;
}
 
Example 8
Source File: SourceClippingBlitTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static Image getBMImage(GraphicsConfiguration gc,
                        int w, int h)
{
    Image image =
        gc.createCompatibleImage(w, h, Transparency.BITMASK);
    initImage(gc, image);
    return image;
}
 
Example 9
Source File: IncorrectClipXorModeSurface2Surface.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getSourceGold(GraphicsConfiguration gc,
                                           int size) {
    final BufferedImage bi = gc.createCompatibleImage(size, size);
    Graphics2D g2d = bi.createGraphics();
    g2d.setColor(Color.RED);
    g2d.fillRect(0, 0, size, size);
    g2d.dispose();
    return bi;
}
 
Example 10
Source File: IncorrectClipXorModeSurface2Surface.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getSourceGold(GraphicsConfiguration gc,
                                           int size) {
    final BufferedImage bi = gc.createCompatibleImage(size, size);
    Graphics2D g2d = bi.createGraphics();
    g2d.setColor(Color.RED);
    g2d.fillRect(0, 0, size, size);
    g2d.dispose();
    return bi;
}
 
Example 11
Source File: TrafficLight.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public BufferedImage createGreenOnImage(final int WIDTH, final int HEIGHT) {
    final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    if (WIDTH <= 0 || HEIGHT <= 0) {
        return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT);
    }
    final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT);
    final Graphics2D G2 = IMAGE.createGraphics();
    G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

    final int IMAGE_WIDTH = IMAGE.getWidth();
    final int IMAGE_HEIGHT = IMAGE.getHeight();
    final Ellipse2D LIGHT_ON = new Ellipse2D.Double(0.17346938775510204 * IMAGE_WIDTH, 0.6942446043165468 * IMAGE_HEIGHT, 0.6530612244897959 * IMAGE_WIDTH, 0.2302158273381295 * IMAGE_HEIGHT);
    G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.8093525179856115 * IMAGE_HEIGHT), (0.32653061224489793f * IMAGE_WIDTH), new float[]{0.0f, 1.0f}, new Color[]{new Color(0.3333333333f, 0.7254901961f, 0.4823529412f, 1f), new Color(0f, 0.1215686275f, 0f, 1f)}));
    G2.fill(LIGHT_ON);

    final GeneralPath GLOW = new GeneralPath();
    GLOW.setWindingRule(Path2D.WIND_EVEN_ODD);
    GLOW.moveTo(0.0 * IMAGE_WIDTH, 0.8129496402877698 * IMAGE_HEIGHT);
    GLOW.curveTo(0.0 * IMAGE_WIDTH, 0.9100719424460432 * IMAGE_HEIGHT, 0.22448979591836735 * IMAGE_WIDTH, 0.9892086330935251 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.9892086330935251 * IMAGE_HEIGHT);
    GLOW.curveTo(0.7755102040816326 * IMAGE_WIDTH, 0.9892086330935251 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.9100719424460432 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.8093525179856115 * IMAGE_HEIGHT);
    GLOW.curveTo(0.9081632653061225 * IMAGE_WIDTH, 0.7517985611510791 * IMAGE_HEIGHT, 0.7040816326530612 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT);
    GLOW.curveTo(0.2857142857142857 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT, 0.08163265306122448 * IMAGE_WIDTH, 0.7517985611510791 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.8129496402877698 * IMAGE_HEIGHT);
    GLOW.closePath();
    G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.8093525179856115 * IMAGE_HEIGHT), (0.5153061224489796f * IMAGE_WIDTH), new float[]{0.0f, 1.0f}, new Color[]{new Color(0.2549019608f, 0.7333333333f, 0.4941176471f, 1f), new Color(0.0156862745f, 0.1450980392f, 0.0313725490f, 0f)}));
    G2.fill(GLOW);

    G2.dispose();
    return IMAGE;
}
 
Example 12
Source File: TrafficLight.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public BufferedImage createGreenLightImage(final int WIDTH, final int HEIGHT) {
    final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    if (WIDTH <= 0 || HEIGHT <= 0) {
        return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT);
    }
    final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT);
    final Graphics2D G2 = IMAGE.createGraphics();
    G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

    final int IMAGE_WIDTH = IMAGE.getWidth();
    final int IMAGE_HEIGHT = IMAGE.getHeight();
    final Ellipse2D FRAME = new Ellipse2D.Double(0.10204081632653061 * IMAGE_WIDTH, 0.6654676258992805 * IMAGE_HEIGHT, 0.7959183673469388 * IMAGE_WIDTH, 0.2805755395683453 * IMAGE_HEIGHT);
    G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.6654676258992805 * IMAGE_HEIGHT), new Point2D.Double(0.5 * IMAGE_WIDTH, 0.9460431654676259 * IMAGE_HEIGHT), new float[]{0.0f, 0.05f, 0.1f, 0.17f, 0.27f, 1.0f}, new Color[]{new Color(1f, 1f, 1f, 1f), new Color(0.8f, 0.8f, 0.8f, 1f), new Color(0.6f, 0.6f, 0.6f, 1f), new Color(0.4f, 0.4f, 0.4f, 1f), new Color(0.2f, 0.2f, 0.2f, 1f), new Color(0.0039215686f, 0.0039215686f, 0.0039215686f, 1f)}));
    G2.fill(FRAME);

    final Ellipse2D INNER_CLIP = new Ellipse2D.Double(0.10204081632653061 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT, 0.7959183673469388 * IMAGE_WIDTH, 0.2589928057553957 * IMAGE_HEIGHT);
    G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT), new Point2D.Double(0.5 * IMAGE_WIDTH, 0.9460431654676259 * IMAGE_HEIGHT), new float[]{0.0f, 0.35f, 0.66f, 1.0f}, new Color[]{new Color(0f, 0f, 0f, 1f), new Color(0.0156862745f, 0.0156862745f, 0.0156862745f, 1f), new Color(0f, 0f, 0f, 1f), new Color(0.0039215686f, 0.0039215686f, 0.0039215686f, 1f)}));
    G2.fill(INNER_CLIP);

    final Ellipse2D LIGHT_EFFECT = new Ellipse2D.Double(0.14285714285714285 * IMAGE_WIDTH, 0.6834532374100719 * IMAGE_HEIGHT, 0.7142857142857143 * IMAGE_WIDTH, 0.2517985611510791 * IMAGE_HEIGHT);
    G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.8093525179856115 * IMAGE_HEIGHT), (0.3622448979591837f * IMAGE_WIDTH), new float[]{0.0f, 0.88f, 0.95f, 1.0f}, new Color[]{new Color(0f, 0f, 0f, 1f), new Color(0f, 0f, 0f, 1f), new Color(0.3686274510f, 0.3686274510f, 0.3686274510f, 1f), new Color(0.0039215686f, 0.0039215686f, 0.0039215686f, 1f)}));
    G2.fill(LIGHT_EFFECT);

    final Ellipse2D INNER_SHADOW = new Ellipse2D.Double(0.14285714285714285 * IMAGE_WIDTH, 0.6834532374100719 * IMAGE_HEIGHT, 0.7142857142857143 * IMAGE_WIDTH, 0.2517985611510791 * IMAGE_HEIGHT);
    G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.6870503597122302 * IMAGE_HEIGHT), new Point2D.Double(0.5 * IMAGE_WIDTH, 0.9172661870503597 * IMAGE_HEIGHT), new float[]{0.0f, 1.0f}, new Color[]{new Color(0f, 0f, 0f, 1f), new Color(0.0039215686f, 0.0039215686f, 0.0039215686f, 0f)}));
    G2.fill(INNER_SHADOW);

    G2.dispose();
    return IMAGE;
}
 
Example 13
Source File: IncorrectClipXorModeSurface2Surface.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getTargetGold(GraphicsConfiguration gc,
                                           int size) {
    BufferedImage image = gc.createCompatibleImage(size, size);
    Graphics2D g2d = image.createGraphics();
    g2d.setColor(Color.GREEN);
    g2d.fillRect(0, 0, size, size);
    g2d.dispose();
    return image;
}
 
Example 14
Source File: IncorrectClipXorModeSW2Surface.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getCompatibleImage(GraphicsConfiguration gc,
                                                int size) {
    BufferedImage image = gc.createCompatibleImage(size, size);
    Graphics2D g2d = image.createGraphics();
    g2d.setColor(Color.GREEN);
    g2d.fillRect(0, 0, size, size);
    g2d.dispose();
    return image;
}
 
Example 15
Source File: IncorrectClipXorModeSW2Surface.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage getCompatibleImage(GraphicsConfiguration gc,
                                                int size) {
    BufferedImage image = gc.createCompatibleImage(size, size);
    Graphics2D g2d = image.createGraphics();
    g2d.setColor(Color.GREEN);
    g2d.fillRect(0, 0, size, size);
    g2d.dispose();
    return image;
}
 
Example 16
Source File: HexSprite.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new empty transparent image for this HexSprite. The
 * size follows the current values of <code>bounds</code>. 
 */
protected Image createNewHexImage() {
    GraphicsConfiguration config = GraphicsEnvironment
            .getLocalGraphicsEnvironment().getDefaultScreenDevice()
            .getDefaultConfiguration();

    // a compatible image should be ideal for blitting to the screen
    return config.createCompatibleImage(bounds.width, bounds.height,
            Transparency.TRANSLUCENT);
}
 
Example 17
Source File: ImageTests.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Image makeImage(TestEnvironment env, int w, int h) {
    Canvas c = env.getCanvas();
    GraphicsConfiguration gc = c.getGraphicsConfiguration();
    return gc.createCompatibleImage(w, h, transparency);
}
 
Example 18
Source File: ImageTests.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Image makeImage(TestEnvironment env, int w, int h) {
    Canvas c = env.getCanvas();
    GraphicsConfiguration gc = c.getGraphicsConfiguration();
    return gc.createCompatibleImage(w, h, transparency);
}
 
Example 19
Source File: ImageTests.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public Image makeImage(TestEnvironment env, int w, int h) {
    Canvas c = env.getCanvas();
    GraphicsConfiguration gc = c.getGraphicsConfiguration();
    return gc.createCompatibleImage(w, h, transparency);
}
 
Example 20
Source File: TrafficLight2.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public BufferedImage create3LightsHousingImage(final int WIDTH, final int HEIGHT) {
    final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    if (WIDTH <= 0 || HEIGHT <= 0) {
        return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT);
    }
    final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT);
    final Graphics2D G2 = IMAGE.createGraphics();
    G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

    final int IMAGE_WIDTH = IMAGE.getWidth();
    final int IMAGE_HEIGHT = IMAGE.getHeight();
    final RoundRectangle2D BACKGROUND = new RoundRectangle2D.Double(0.125 * IMAGE_WIDTH, 0.055 * IMAGE_HEIGHT, 0.75 * IMAGE_WIDTH, 0.9 * IMAGE_HEIGHT, 0.75 * IMAGE_WIDTH, 0.3 * IMAGE_HEIGHT);
    G2.setPaint(new Color(0.8f, 0.8f, 0.8f, 0.5f));
    G2.fill(BACKGROUND);

    final GeneralPath FRAME = new GeneralPath();
    FRAME.setWindingRule(Path2D.WIND_EVEN_ODD);
    FRAME.moveTo(0.125 * IMAGE_WIDTH, 0.205 * IMAGE_HEIGHT);
    FRAME.curveTo(0.125 * IMAGE_WIDTH, 0.12 * IMAGE_HEIGHT, 0.2875 * IMAGE_WIDTH, 0.055 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.055 * IMAGE_HEIGHT);
    FRAME.curveTo(0.7125 * IMAGE_WIDTH, 0.055 * IMAGE_HEIGHT, 0.875 * IMAGE_WIDTH, 0.12 * IMAGE_HEIGHT, 0.875 * IMAGE_WIDTH, 0.205 * IMAGE_HEIGHT);
    FRAME.curveTo(0.875 * IMAGE_WIDTH, 0.205 * IMAGE_HEIGHT, 0.875 * IMAGE_WIDTH, 0.805 * IMAGE_HEIGHT, 0.875 * IMAGE_WIDTH, 0.805 * IMAGE_HEIGHT);
    FRAME.curveTo(0.875 * IMAGE_WIDTH, 0.89 * IMAGE_HEIGHT, 0.7125 * IMAGE_WIDTH, 0.955 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.955 * IMAGE_HEIGHT);
    FRAME.curveTo(0.2875 * IMAGE_WIDTH, 0.955 * IMAGE_HEIGHT, 0.125 * IMAGE_WIDTH, 0.89 * IMAGE_HEIGHT, 0.125 * IMAGE_WIDTH, 0.805 * IMAGE_HEIGHT);
    FRAME.curveTo(0.125 * IMAGE_WIDTH, 0.805 * IMAGE_HEIGHT, 0.125 * IMAGE_WIDTH, 0.205 * IMAGE_HEIGHT, 0.125 * IMAGE_WIDTH, 0.205 * IMAGE_HEIGHT);
    FRAME.closePath();
    FRAME.moveTo(0.0 * IMAGE_WIDTH, 0.2 * IMAGE_HEIGHT);
    FRAME.curveTo(0.0 * IMAGE_WIDTH, 0.2 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.8 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.8 * IMAGE_HEIGHT);
    FRAME.curveTo(0.0 * IMAGE_WIDTH, 0.91 * IMAGE_HEIGHT, 0.225 * IMAGE_WIDTH, 1.0 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 1.0 * IMAGE_HEIGHT);
    FRAME.curveTo(0.775 * IMAGE_WIDTH, 1.0 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.91 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.8 * IMAGE_HEIGHT);
    FRAME.curveTo(1.0 * IMAGE_WIDTH, 0.8 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.2 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.2 * IMAGE_HEIGHT);
    FRAME.curveTo(1.0 * IMAGE_WIDTH, 0.09 * IMAGE_HEIGHT, 0.775 * IMAGE_WIDTH, 0.0 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.0 * IMAGE_HEIGHT);
    FRAME.curveTo(0.225 * IMAGE_WIDTH, 0.0 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.09 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.2 * IMAGE_HEIGHT);
    FRAME.closePath();
    G2.setPaint(new Color(0.2f, 0.2f, 0.2f, 0.5f));
    G2.fill(FRAME);

    G2.dispose();
    return IMAGE;
}