org.jzy3d.io
Class GLImage

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

public class GLImage
extends java.lang.Object


Constructor Summary
GLImage()
           
 
Method Summary
static java.nio.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 java.nio.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 java.nio.ByteBuffer getImageAsGlByteBuffer(java.awt.Image image, int width, int height)
           
static int[] getImagePixels(java.awt.Image image, int width, int height)
          Return the image pixels in default Java int ARGB format.
static byte[] getRGBABytes(int[] jpixels)
           
static java.nio.ByteBuffer toByteBuffer(java.awt.Image img, int imgWidth, int imgHeight)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLImage

public GLImage()
Method Detail

getImageAsGlByteBuffer

public static java.nio.ByteBuffer getImageAsGlByteBuffer(java.awt.Image image,
                                                         int width,
                                                         int height)

getImagePixels

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


convertImagePixels

public static java.nio.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:
GL.glDrawPixels(imgW, imgH, GL.GL_RGBA, GL.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 java.nio.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 java.nio.ByteBuffer toByteBuffer(java.awt.Image img,
                                               int imgWidth,
                                               int imgHeight)