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, 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.
 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.
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,
                                      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., RGB or RGBA bottom-to-top (OpenGL coord).


read

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

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.


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_BGR or GL.GL_BGRA.


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.