Package com.jogamp.opengl.util.awt
Class ImageUtil
java.lang.Object
com.jogamp.opengl.util.awt.ImageUtil
Utilities for dealing with images.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
createCompatibleImage
(int width, int height) Creates aBufferedImage
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.
-
Method Details
-
flipImageVertically
Flips the supplied BufferedImage vertically. This is often a necessary conversion step to display a Java2D image correctly with OpenGL and vice versa. -
createCompatibleImage
Creates aBufferedImage
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 createdheight
- The height of the image to be created- Returns:
- A instance of
BufferedImage
with a type compatible with the graphics card.
-
createThumbnail
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 ofBufferedImage
. The original picture is not modified.- Parameters:
image
- The original image to sample downthumbWidth
- 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()
-