public class PNGImage extends Object
Modifier and Type | Method and Description |
---|---|
static PNGImage |
createFromData(int width,
int height,
double dpiX,
double dpiY,
int bytesPerPixel,
boolean reversedChannels,
boolean isGLOriented,
ByteBuffer data)
Creates a PNGImage from data supplied by the end user.
|
int |
getBytesPerPixel()
Returns the bytes per pixel
|
ByteBuffer |
getData()
Returns the raw data for this texture in the correct
(bottom-to-top) order for calls to glTexImage2D.
|
double[] |
getDpi()
Returns the dpi of the image.
|
int |
getGLFormat()
Returns the OpenGL format for this texture; e.g.
|
int |
getGLType()
Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE.
|
boolean |
getHasReversedChannels()
Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected.
|
int |
getHeight()
Returns the height of the image.
|
int |
getWidth()
Returns the width of the image.
|
boolean |
isGLOriented()
Returns
true if the drawable is rendered in
OpenGL's coordinate system, origin at bottom left. |
static PNGImage |
read(InputStream in)
Reads a PNG image from the specified InputStream.
|
String |
toString() |
void |
write(File out,
boolean allowOverwrite) |
public static PNGImage createFromData(int width, int height, double dpiX, double dpiY, int bytesPerPixel, boolean reversedChannels, boolean isGLOriented, ByteBuffer data)
isGLOriented
.width
- height
- dpiX
- dpiY
- bytesPerPixel
- reversedChannels
- isGLOriented
- see isGLOriented()
.data
- public static PNGImage read(InputStream in) throws IOException
Implicitly flip image to GL orientation, see isGLOriented()
.
IOException
public int getWidth()
public int getHeight()
public boolean getHasReversedChannels()
public boolean isGLOriented()
true
if the drawable is rendered in
OpenGL's coordinate system, origin at bottom left.
Otherwise returns false
, i.e. origin at top left.
Default impl. is true
, i.e. OpenGL coordinate system.
public double[] getDpi()
public int getGLFormat()
public int getGLType()
public int getBytesPerPixel()
public ByteBuffer getData()
public void write(File out, boolean allowOverwrite) throws IOException
IOException
Copyright 2010 JogAmp Community.