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 GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
for GLPixelBuffer.allowRowStride
details.
If using allowRowStride == true
, user may needs to get the aligned image
since GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
will allow different width in this case.
Modifier and Type | Class and Description |
---|---|
static class |
AWTGLPixelBuffer.AWTGLPixelBufferProvider
Provider for
AWTGLPixelBuffer instances. |
static class |
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
Provider for singleton
AWTGLPixelBuffer instances. |
GLPixelBuffer.DefaultGLPixelBufferProvider, GLPixelBuffer.GLPixelAttributes, GLPixelBuffer.GLPixelBufferProvider, GLPixelBuffer.SingletonGLPixelBufferProvider
Modifier and Type | Field and Description |
---|---|
static GLPixelBuffer.GLPixelAttributes |
awtPixelAttributesIntRGB3 |
static GLPixelBuffer.GLPixelAttributes |
awtPixelAttributesIntRGBA4 |
BufferedImage |
image
The underlying
BufferedImage . |
allowRowStride, buffer, bufferElemSize, byteSize, defaultProviderNoRowStride, defaultProviderWithRowStride, 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.
|
BufferedImage |
getAlignedImage(int width,
int height)
Returns a width- and height-aligned image representation sharing data w/
image . |
boolean |
isDataBufferSource(BufferedImage imageU) |
String |
toString() |
StringBuilder |
toString(StringBuilder sb) |
capacity, clear, flip, getAllowRowStride, isValid, limit, position, position, requiresNewBuffer, rewind
public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGBA4
public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGB3
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 GLPixelAttributes
width
- 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 GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
.
If true
, user shall decide whether to use a width-aligned image
.public void dispose()
GLPixelBuffer
GLPixelBuffer.isValid()
.dispose
in class GLPixelBuffer
public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException
image
.width
- height
- IllegalArgumentException
- if requested size exceeds image sizepublic final boolean isDataBufferSource(BufferedImage imageU)
public StringBuilder toString(StringBuilder sb)
toString
in class GLPixelBuffer
public String toString()
toString
in class GLPixelBuffer
Copyright 2010 JogAmp Community.