org.jzy3d.io
Class GLImage

java.lang.Object
  extended by org.jzy3d.io.GLImage

public class GLImage
extends Object


Field Summary
protected static int SIZE_BYTE
           
 
Constructor Summary
GLImage()
           
 
Method Summary
static ByteBuffer allocBytes(byte[] bytearray)
          Same function as in GLApp.java.
static byte[] convertARGBtoRGBA(int[] jpixels)
          Convert pixels from java default ARGB int format to byte array in RGBA format.
static ByteBuffer convertImagePixels(int[] jpixels, int imgw, int imgh, boolean flipVertically)
          Convert ARGB pixels to a ByteBuffer containing RGBA pixels.
static int[] flipPixels(int[] imgPixels, int imgw, int imgh)
          Flip an array of pixels vertically
static ByteBuffer getImageAsGlByteBuffer(Image image, int width, int height)
           
static int[] getImagePixels(Image image, int width, int height)
          Return the image pixels in default Java int ARGB format.
static byte[] getRGBABytes(int[] jpixels)
           
static ByteBuffer toByteBuffer(Image img, int imgWidth, int imgHeight)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE_BYTE

protected static final int SIZE_BYTE
See Also:
Constant Field Values
Constructor Detail

GLImage

public GLImage()
Method Detail

getImageAsGlByteBuffer

public static ByteBuffer getImageAsGlByteBuffer(Image image,
                                                int width,
                                                int height)

getImagePixels

public static int[] getImagePixels(Image image,
                                   int width,
                                   int height)
Return the image pixels in default Java int ARGB format.


convertImagePixels

public static ByteBuffer convertImagePixels(int[] jpixels,
                                            int imgw,
                                            int imgh,
                                            boolean flipVertically)
Convert ARGB pixels to a ByteBuffer containing RGBA pixels.
Can be drawn in ORTHO mode using:
GL2.glDrawPixels(imgW, imgH, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, byteBuffer);
If flipVertically is true, pixels will be flipped vertically for OpenGL coord system.

Parameters:
imgFilename -
Returns:
ByteBuffer

flipPixels

public static int[] flipPixels(int[] imgPixels,
                               int imgw,
                               int imgh)
Flip an array of pixels vertically

Parameters:
imgPixels -
imgw -
imgh -
Returns:
int[]

convertARGBtoRGBA

public static byte[] convertARGBtoRGBA(int[] jpixels)
Convert pixels from java default ARGB int format to byte array in RGBA format.

Parameters:
jpixels -
Returns:

getRGBABytes

public static byte[] getRGBABytes(int[] jpixels)

allocBytes

public static ByteBuffer allocBytes(byte[] bytearray)
Same function as in GLApp.java. Allocates a ByteBuffer to hold the given array of bytes.

Parameters:
bytearray -
Returns:
ByteBuffer containing the contents of the byte array

toByteBuffer

public static ByteBuffer toByteBuffer(Image img,
                                      int imgWidth,
                                      int imgHeight)