Package com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer
- java.lang.Object
-
- com.jogamp.opengl.util.GLPixelBuffer
-
- com.jogamp.opengl.util.awt.AWTGLPixelBuffer
-
public class AWTGLPixelBuffer extends GLPixelBuffer
AWTGLPixelBuffer
backed by anBufferedImage
of typeBufferedImage.TYPE_INT_ARGB
orBufferedImage.TYPE_INT_RGB
.Implementation uses an array backed
IntBuffer
.AWTGLPixelBuffer
can be produced viaAWTGLPixelBuffer.AWTGLPixelBufferProvider
'sallocate(..)
.See
GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
forGLPixelBuffer.allowRowStride
details.If using
allowRowStride == true
, user may needs to get thealigned image
sinceGLPixelBuffer.requiresNewBuffer(GL, int, int, int)
will allow different width in this case.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AWTGLPixelBuffer.AWTGLPixelBufferProvider
Provider forAWTGLPixelBuffer
instances.static class
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
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
Fields Modifier and Type Field Description BufferedImage
image
The underlyingBufferedImage
.-
Fields inherited from class com.jogamp.opengl.util.GLPixelBuffer
allowRowStride, buffer, bufferElemSize, byteSize, defaultProviderNoRowStride, defaultProviderWithRowStride, depth, height, pack, pixelAttributes, width
-
-
Constructor Summary
Constructors Constructor Description AWTGLPixelBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int awtFormat, int width, int height, int depth, BufferedImage image, Buffer buffer, boolean allowRowStride)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Methods inherited from class com.jogamp.opengl.util.GLPixelBuffer
capacity, clear, flip, getAllowRowStride, isValid, limit, position, position, requiresNewBuffer, rewind
-
-
-
-
Field Detail
-
image
public final BufferedImage image
The underlyingBufferedImage
.
-
-
Constructor Detail
-
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 Detail
-
getHostPixelComp
public final PixelFormat.Composition getHostPixelComp()
-
getAWTFormat
public final int getAWTFormat()
-
dispose
public void dispose()
Description copied from class:GLPixelBuffer
Dispose resources. SeeGLPixelBuffer.isValid()
.- Overrides:
dispose
in classGLPixelBuffer
-
getAlignedImage
public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException
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
public final boolean isDataBufferSource(BufferedImage imageU)
-
toString
public StringBuilder toString(StringBuilder sb)
- Overrides:
toString
in classGLPixelBuffer
-
toString
public String toString()
- Overrides:
toString
in classGLPixelBuffer
-
-