com.jogamp.opengl.util.texture.spi
Class PNGImage

java.lang.Object
  extended by com.jogamp.opengl.util.texture.spi.PNGImage

public class PNGImage
extends Object


Method Summary
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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createFromData

public 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. Shares data with the passed ByteBuffer. Assumes the data is already in the correct byte order for writing to disk, i.e., LUMINANCE, RGB or RGBA. Orientation is bottom-to-top (OpenGL coord. default) or top-to-bottom depending on isGLOriented.

Parameters:
width -
height -
dpiX -
dpiY -
bytesPerPixel -
reversedChannels -
isGLOriented - see isGLOriented().
data -
Returns:

read

public static PNGImage read(InputStream in)
                     throws IOException
Reads a PNG image from the specified InputStream.

Implicitly flip image to GL orientation, see isGLOriented().

Throws:
IOException

getWidth

public int getWidth()
Returns the width of the image.


getHeight

public int getHeight()
Returns the height of the image.


getHasReversedChannels

public boolean getHasReversedChannels()
Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected.


isGLOriented

public boolean isGLOriented()
Returns 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.


getDpi

public double[] getDpi()
Returns the dpi of the image.


getGLFormat

public int getGLFormat()
Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA.


getGLType

public int getGLType()
Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE.


getBytesPerPixel

public int getBytesPerPixel()
Returns the bytes per pixel


getData

public ByteBuffer getData()
Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D.


write

public void write(File out,
                  boolean allowOverwrite)
           throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright 2010 JogAmp Community.