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 |
|---|---|
BufferedImage |
image
The underlying
BufferedImage. |
allowRowStride, buffer, bufferElemSize, byteSize, defaultProviderNoRowStride, defaultProviderWithRowStride, depth, height, pack, pixelAttributes, width| Constructor and Description |
|---|
AWTGLPixelBuffer(PixelFormat.Composition hostPixelComp,
GLPixelBuffer.GLPixelAttributes pixelAttributes,
boolean pack,
int awtFormat,
int width,
int height,
int depth,
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. |
int |
getAWTFormat() |
PixelFormat.Composition |
getHostPixelComp() |
boolean |
isDataBufferSource(BufferedImage imageU) |
String |
toString() |
StringBuilder |
toString(StringBuilder sb) |
capacity, clear, flip, getAllowRowStride, isValid, limit, position, position, requiresNewBuffer, rewindpublic final BufferedImage image
BufferedImage.public AWTGLPixelBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int awtFormat, int width, int height, int depth, BufferedImage image, Buffer buffer, boolean allowRowStride)
hostPixelComp - the host PixelFormat.CompositionpixelAttributes - the desired GLPixelAttributespack - true for read mode GPU -> CPU, e.g. glReadPixels.
false for write mode CPU -> GPU, e.g. glTexImage2D.awtFormat - the used AWT format, i.e. AWTGLPixelBuffer.AWTGLPixelBufferProvider.getAWTFormat(GLProfile, int)width - in pixelsheight - in pixelsdepth - in pixelsimage - 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 final PixelFormat.Composition getHostPixelComp()
public final int getAWTFormat()
public void dispose()
GLPixelBufferGLPixelBuffer.isValid().dispose in class GLPixelBufferpublic 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 GLPixelBufferpublic String toString()
toString in class GLPixelBufferCopyright 2010 JogAmp Community.