Class ImageUtils
java.lang.Object
com.blackrook.gloop.opengl.util.ImageUtils
Image utility class.
All of these methods can be called outside of the graphics thread.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of image resizing hints -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagecreateMipMapImage(BufferedImage source, ImageUtils.ResizeQuality quality) Creates an image that contains the source image and all of its mipmap levels.static BufferedImage[]createMipMaps(BufferedImage source, ImageUtils.ResizeQuality quality) Creates a series of texture mipmaps from an original image.static BufferedImageperformFlip(BufferedImage source, boolean flipX, boolean flipY) Flips an image across one or two axes.static BufferedImageperformResize(BufferedImage source, ImageUtils.ResizeQuality quality, int newWidth, int newHeight) Resizes an image using nearest filtering.static BufferedImage[]splitMipMapImage(BufferedImage source) Creates a series of images from an image that contains a primary image and all of its mipmap levels.static BufferedImage[]splitTextureGrid(BufferedImage source, int rows, int columns) Creates a series of images from a larger image, such that the resultant images are made from dividing up the source image into a grid of equally-sized images.
-
Method Details
-
performResize
public static BufferedImage performResize(BufferedImage source, ImageUtils.ResizeQuality quality, int newWidth, int newHeight) Resizes an image using nearest filtering.- Parameters:
source- the source image.quality- the rendering quality to use.newWidth- the new image width.newHeight- the new image height.- Returns:
- the resized image.
-
performFlip
Flips an image across one or two axes.- Parameters:
source- the source image.flipX- if true, flips horizontally.flipY- if true, flips vertically.- Returns:
- an output image where the contents are flipped according to parameters.
-
createMipMaps
Creates a series of texture mipmaps from an original image. The first image returned is the original, and each subsequent image is a smaller map. Best used with square images whose width and height are powers of two.- Parameters:
source- the source image.quality- the resize quality.- Returns:
- the array of images in texture mipmap level ordering (largest to smallest).
-
createMipMapImage
public static BufferedImage createMipMapImage(BufferedImage source, ImageUtils.ResizeQuality quality) Creates an image that contains the source image and all of its mipmap levels. The first image returned is the original, and each subsequent image is a smaller map. Best used with square images whose width and height are powers of two.- Parameters:
source- the source image.quality- the resize quality.- Returns:
- the resultant image.
- See Also:
-
splitMipMapImage
Creates a series of images from an image that contains a primary image and all of its mipmap levels.This assumes a composition pattern as though it were created with
createMipMapImage(BufferedImage, ResizeQuality).- Parameters:
source- the source image.- Returns:
- the resultant image.
-
splitTextureGrid
Creates a series of images from a larger image, such that the resultant images are made from dividing up the source image into a grid of equally-sized images.- Parameters:
source- the source image.rows- the amount of grid rows.columns- the amount of grid columns.- Returns:
- the resultant images, in row-major order.
-