Package com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer
java.lang.Object
com.jogamp.opengl.util.GLPixelBuffer
com.jogamp.opengl.util.awt.AWTGLPixelBuffer
AWT
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Provider forAWTGLPixelBuffer
instances.static class
Provider for singletonAWTGLPixelBuffer
instances.Nested classes/interfaces inherited from class com.jogamp.opengl.util.GLPixelBuffer
GLPixelBuffer.DefaultGLPixelBufferProvider, GLPixelBuffer.GLPixelAttributes, GLPixelBuffer.GLPixelBufferProvider, GLPixelBuffer.SingletonGLPixelBufferProvider
-
Field Summary
FieldsFields inherited from class com.jogamp.opengl.util.GLPixelBuffer
allowRowStride, buffer, bufferElemSize, byteSize, defaultProviderNoRowStride, defaultProviderWithRowStride, depth, height, pack, pixelAttributes, width
-
Constructor Summary
ConstructorsConstructorDescriptionAWTGLPixelBuffer
(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int awtFormat, int width, int height, int depth, BufferedImage image, Buffer buffer, boolean allowRowStride) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Dispose resources.getAlignedImage
(int width, int height) Returns a width- and height-aligned image representation sharing data w/image
.final int
final PixelFormat.Composition
final boolean
isDataBufferSource
(BufferedImage imageU) toString()
Methods inherited from class com.jogamp.opengl.util.GLPixelBuffer
capacity, clear, flip, getAllowRowStride, isValid, limit, position, position, requiresNewBuffer, rewind
-
Field Details
-
image
The underlyingBufferedImage
.
-
-
Constructor Details
-
AWTGLPixelBuffer
public AWTGLPixelBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int awtFormat, int width, int height, int depth, BufferedImage image, Buffer buffer, boolean allowRowStride) - Parameters:
hostPixelComp
- the hostPixelFormat.Composition
pixelAttributes
- the desiredGLPixelBuffer.GLPixelAttributes
pack
-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
- Iftrue
, allow row-stride, otherwise not. SeeGLPixelBuffer.requiresNewBuffer(GL, int, int, int)
. Iftrue
, user shall decide whether to use awidth-aligned image
.
-
-
Method Details
-
getHostPixelComp
-
getAWTFormat
public final int getAWTFormat() -
dispose
public void dispose()Description copied from class:GLPixelBuffer
Dispose resources. SeeGLPixelBuffer.isValid()
.- Overrides:
dispose
in classGLPixelBuffer
-
getAlignedImage
Returns a width- and height-aligned image representation sharing data w/image
.- Parameters:
width
-height
-- Returns:
- Throws:
IllegalArgumentException
- if requested size exceeds image size
-
isDataBufferSource
-
toString
- Overrides:
toString
in classGLPixelBuffer
-
toString
- Overrides:
toString
in classGLPixelBuffer
-