return ret;
}
private static BufferedImage checkCompatibility( BufferedImage im ) {
// 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 ( im.getColorModel().equals( gfx_config.getColorModel() ) ) {
return im;
}
// image is not optimized, so create a new image that is
BufferedImage new_image = gfx_config.createCompatibleImage(
im.getWidth(), im.getHeight(), im.getTransparency() );
// get the graphics context of the new image to draw the old image on
Graphics2D g2d = (Graphics2D) new_image.getGraphics();