org.jzy3d.plot3d.rendering.image
Class GLImage
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.image.GLImage
-
public class GLImage extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description GLImage()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.nio.ByteBufferallocBytes(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.ByteBufferconvertImagePixels(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.static int[]flipPixels(int[] imgPixels, int imgw, int imgh)Flip an array of pixels verticallystatic java.nio.ByteBuffergetImageAsGlByteBuffer(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.ByteBuffertoByteBuffer(java.awt.Image img, int imgWidth, int imgHeight)
-
-
-
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:
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 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)
-
-
DMelt 3.0 © DataMelt by jWork.ORG