com.sun.opengl.util.awt
Class ImageUtil

java.lang.Object
  extended by com.sun.opengl.util.awt.ImageUtil

public class ImageUtil
extends Object

Utilities for dealing with images.


Method Summary
static BufferedImage createCompatibleImage(int width, int height)
          Creates a BufferedImage with a pixel format compatible with the graphics environment.
static BufferedImage createThumbnail(BufferedImage image, int thumbWidth)
          Creates a thumbnail from an image.
static void flipImageVertically(BufferedImage image)
          Flips the supplied BufferedImage vertically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

flipImageVertically

public static void flipImageVertically(BufferedImage image)
Flips the supplied BufferedImage vertically. This is often a necessary conversion step to display a Java2D image correctly with OpenGL and vice versa.


createCompatibleImage

public static BufferedImage createCompatibleImage(int width,
                                                  int height)
Creates a BufferedImage with a pixel format compatible with the graphics environment. The returned image can thus benefit from hardware accelerated operations in Java2D API.

Parameters:
width - The width of the image to be created
height - The height of the image to be created
Returns:
A instance of BufferedImage with a type compatible with the graphics card.

createThumbnail

public static BufferedImage createThumbnail(BufferedImage image,
                                            int thumbWidth)
Creates a thumbnail from an image. A thumbnail is a scaled down version of the original picture. This method will retain the width to height ratio of the original picture and return a new instance of BufferedImage. The original picture is not modified.

Parameters:
image - The original image to sample down
thumbWidth - The width of the thumbnail to be created
Returns:
A thumbnail with the requested width or the original picture if thumbWidth = image.getWidth()
Throws:
IllegalArgumentException - If thumbWidth is greater than image.getWidth()


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.