com.sun.opengl.util
Class ImageUtil
Utilities for dealing with images.
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.
|
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.
width
- The width of the image to be createdheight
- The height of the image to be created
- 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.
image
- The original image to sample downthumbWidth
- The width of the thumbnail to be created
- A thumbnail with the requested width or the original picture if thumbWidth = image.getWidth()
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.
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.