Here you can find the source of boostBufferedImagePerformance(BufferedImage image, boolean translucent)
public static final BufferedImage boostBufferedImagePerformance(BufferedImage image, boolean translucent)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.Transparency; import java.awt.image.BufferedImage; public class Main { public static final BufferedImage boostBufferedImagePerformance(BufferedImage image, boolean translucent) { GraphicsConfiguration gfx_config = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration(); if (image.getColorModel().equals(gfx_config.getColorModel())) return image; BufferedImage newImage;// ww w . j a v a 2 s.co m if (translucent) { newImage = gfx_config.createCompatibleImage(image.getWidth(), image.getHeight(), Transparency.TRANSLUCENT); } else { newImage = gfx_config.createCompatibleImage(image.getWidth(), image.getHeight(), Transparency.BITMASK); } Graphics2D g = (Graphics2D) newImage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); return newImage; } }