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
AWTGLPixelBufferbacked by anBufferedImageof typeBufferedImage.TYPE_INT_ARGBorBufferedImage.TYPE_INT_RGB.Implementation uses an array backed
IntBuffer.AWTGLPixelBuffercan be produced viaAWTGLPixelBuffer.AWTGLPixelBufferProvider'sallocate(..).See
GLPixelBuffer.requiresNewBuffer(GL, int, int, int)forGLPixelBuffer.allowRowStridedetails.If using
allowRowStride == true, user may needs to get thealigned imagesinceGLPixelBuffer.requiresNewBuffer(GL, int, int, int)will allow different width in this case.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAWTGLPixelBuffer.AWTGLPixelBufferProviderProvider forAWTGLPixelBufferinstances.static classAWTGLPixelBuffer.SingleAWTGLPixelBufferProviderProvider for singletonAWTGLPixelBufferinstances.-
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 BufferedImageimageThe 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 voiddispose()Dispose resources.BufferedImagegetAlignedImage(int width, int height)Returns a width- and height-aligned image representation sharing data w/image.intgetAWTFormat()PixelFormat.CompositiongetHostPixelComp()booleanisDataBufferSource(BufferedImage imageU)StringtoString()StringBuildertoString(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.CompositionpixelAttributes- the desiredGLPixelBuffer.GLPixelAttributespack-truefor read mode GPU -> CPU, e.g.glReadPixels.falsefor 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:GLPixelBufferDispose resources. SeeGLPixelBuffer.isValid().- Overrides:
disposein 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:
toStringin classGLPixelBuffer
-
toString
public String toString()
- Overrides:
toStringin classGLPixelBuffer
-
-