public class PowerOfTwoPaddedImage extends Object
| Modifier and Type | Field and Description | 
|---|---|
protected int | 
height  | 
protected BufferedImage | 
image  | 
protected int | 
width  | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
PowerOfTwoPaddedImage(BufferedImage image,
                     int width,
                     int height)  | 
| Modifier and Type | Method and Description | 
|---|---|
static PowerOfTwoPaddedImage | 
fromBufferedImage(BufferedImage image)
Returns a new PowerOfTwoPaddedImage by converting the specified  
image to a new image with
 power-of-two dimensions. | 
static PowerOfTwoPaddedImage | 
fromPath(String path)
Returns a new PowerOfTwoPaddedImage from the specified  
path, or null if the file referenced by
 path cannot be read, or is not a readable image. | 
int | 
getOriginalHeight()
Returns the height of the original non-power-of-two image, in pixels. 
 | 
int | 
getOriginalWidth()
Returns the width of the original non-power-of-two image, in pixels. 
 | 
int | 
getPowerOfTwoHeight()
Returns the height of the power-of-two image, in pixels. 
 | 
BufferedImage | 
getPowerOfTwoImage()
Returns a copy of the original image as a  
BufferedImage with power-of-two dimensions. | 
int | 
getPowerOfTwoWidth()
Returns the width of the power-of-two image, in pixels. 
 | 
protected int height
protected BufferedImage image
protected int width
protected PowerOfTwoPaddedImage(BufferedImage image, int width, int height)
public static PowerOfTwoPaddedImage fromBufferedImage(BufferedImage image)
image to a new image with
 power-of-two dimensions. Any pixels not covered by the original image are completely transparent. If the
 specified image has power-of-two dimensions, this maintains a reference to the original image
 instead of creating a copy. However, if the specified image has no alpha channel, this creates a
 copy of the original image with an alpha channel, regardless of the specified image's dimensions.
 This guarantees that the method getPowerOfTwoImage() always returns a BufferedImage with an alpha
 channel. This is a useful property when converting images to OpenGL texture's, when both power-of-two and
 non-power-of-two textures must have an alpha channel for consistent handling.image - the BufferedImage to convert to an image with power-of-two dimensions.image.IllegalArgumentException - if the image is null.public static PowerOfTwoPaddedImage fromPath(String path)
path, or null if the file referenced by
 path cannot be read, or is not a readable image. The path must be a local file path, or
 a valid resource on the classpath. This uses ImageIO to read the specified
 path as a BufferedImage. Otherwise, this treats the resultant BufferedImage
 exactly as fromBufferedImage(java.awt.image.BufferedImage).path - a local file path, or a valid resource on the classpath.path, or null if the image file reference by path cannot be read.IllegalArgumentException - if the path is null.public int getOriginalHeight()
public int getOriginalWidth()
public int getPowerOfTwoHeight()
public BufferedImage getPowerOfTwoImage()
BufferedImage with power-of-two dimensions. Any
 pixels not covered by the original image are completely transparent.public int getPowerOfTwoWidth()