public class AWTGLPixelBuffer extends GLPixelBuffer
GLPixelBuffer backed by an BufferedImage of type
BufferedImage.TYPE_INT_ARGB or BufferedImage.TYPE_INT_RGB.
Implementation uses an array backed IntBuffer.
AWTGLPixelBuffer can be produced via AWTGLPixelBuffer.AWTGLPixelBufferProvider's
allocate(..).
See requiresNewBuffer(GL, int, int, int) for allowRowStride details.
| Modifier and Type | Class and Description |
|---|---|
static class |
AWTGLPixelBuffer.AWTGLPixelBufferProvider
Provider for
AWTGLPixelBuffer instances. |
static class |
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
Provider for singleton
AWTGLPixelBuffer instances. |
GLPixelBuffer.GLPixelAttributes, GLPixelBuffer.GLPixelBufferProvider, GLPixelBuffer.SingletonGLPixelBufferProvider| Modifier and Type | Field and Description |
|---|---|
boolean |
allowRowStride
|
static GLPixelBuffer.GLPixelAttributes |
awtPixelAttributesIntRGB3 |
static GLPixelBuffer.GLPixelAttributes |
awtPixelAttributesIntRGBA4 |
BufferedImage |
image
The underlying
BufferedImage. |
buffer, bufferElemSize, byteSize, defaultProvider, depth, height, pack, pixelAttributes, width| Constructor and Description |
|---|
AWTGLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes,
int width,
int height,
int depth,
boolean pack,
BufferedImage image,
Buffer buffer,
boolean allowRowStride) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Dispose resources.
|
boolean |
requiresNewBuffer(GL gl,
int newWidth,
int newHeight,
int minByteSize)
Returns true, if
invalid or implementation requires a new buffer based on the new size
due to pixel alignment or byte size, otherwise false. |
String |
toString() |
StringBuffer |
toString(StringBuffer sb) |
public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGBA4
public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGB3
public final boolean allowRowStride
public final BufferedImage image
BufferedImage.public AWTGLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, Buffer buffer, boolean allowRowStride)
pixelAttributes - the desired GLPixelBuffer.GLPixelAttributeswidth - in pixelsheight - in pixelsdepth - in pixelspack - true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPUimage - the AWT imagebuffer - the backing arrayallowRowStride - If true, allow row-stride, otherwise not. See requiresNewBuffer(GL, int, int, int).public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int minByteSize)
invalid or implementation requires a new buffer based on the new size
due to pixel alignment or byte size, otherwise false.
It is assumed that pixelAttributes, depth and pack stays the same!
The minimum required byte size equals to minByteSize, if > 0,
otherwise utilize GLBuffers.sizeof(..)
to calculate it.
If ,
method returns allowRowStride = falsetrue if the new size ≠ current size.
If , see allowRowStride = trueAWTGLPixelBufferProvider#AWTGLPixelBufferProvider(boolean),
method returns true only if the new size > current size. Assuming user utilizes the row-stride
when dealing w/ the data, i.e. GL2GL3.GL_PACK_ROW_LENGTH.
requiresNewBuffer in class GLPixelBuffergl - the corresponding current GL context objectnewWidth - new width in pixelsnewHeight - new height in pixelsminByteSize - if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)public void dispose()
GLPixelBufferGLPixelBuffer.isValid().dispose in class GLPixelBufferpublic StringBuffer toString(StringBuffer sb)
toString in class GLPixelBufferpublic String toString()
toString in class GLPixelBufferCopyright 2010 JogAmp Community.