com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer

java.lang.Object
  extended by com.jogamp.opengl.util.GLPixelBuffer
      extended by com.jogamp.opengl.util.awt.AWTGLPixelBuffer

public class AWTGLPixelBuffer
extends GLPixelBuffer

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
static class AWTGLPixelBuffer.AWTGLPixelBufferProvider
          Provider for AWTGLPixelBuffer instances.
static class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
          Provider for singleton AWTGLPixelBuffer instances.
 
Nested classes/interfaces inherited from class com.jogamp.opengl.util.GLPixelBuffer
GLPixelBuffer.DefaultGLPixelBufferProvider, GLPixelBuffer.GLPixelAttributes, GLPixelBuffer.GLPixelBufferProvider, GLPixelBuffer.SingletonGLPixelBufferProvider
 
Field Summary
static GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGB3
           
static GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGBA4
           
 BufferedImage image
          The underlying BufferedImage.
 
Fields inherited from class com.jogamp.opengl.util.GLPixelBuffer
allowRowStride, buffer, bufferElemSize, byteSize, defaultProviderNoRowStride, defaultProviderWithRowStride, depth, height, pack, pixelAttributes, width
 
Constructor Summary
AWTGLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, Buffer buffer, boolean allowRowStride)
           
 
Method Summary
 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)
           
 
Methods inherited from class com.jogamp.opengl.util.GLPixelBuffer
capacity, clear, flip, getAllowRowStride, isValid, limit, position, position, requiresNewBuffer, rewind
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

awtPixelAttributesIntRGBA4

public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGBA4

awtPixelAttributesIntRGB3

public static final GLPixelBuffer.GLPixelAttributes awtPixelAttributesIntRGB3

image

public final BufferedImage image
The underlying BufferedImage.

Constructor Detail

AWTGLPixelBuffer

public AWTGLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes,
                        int width,
                        int height,
                        int depth,
                        boolean pack,
                        BufferedImage image,
                        Buffer buffer,
                        boolean allowRowStride)
Parameters:
pixelAttributes - the desired GLPixelAttributes
width - in pixels
height - in pixels
depth - in pixels
pack - true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
image - the AWT image
buffer - the backing array
allowRowStride - 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.
Method Detail

dispose

public void dispose()
Description copied from class: GLPixelBuffer
Dispose resources. See GLPixelBuffer.isValid().

Overrides:
dispose in class GLPixelBuffer

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 class GLPixelBuffer

toString

public String toString()
Overrides:
toString in class GLPixelBuffer


Copyright 2010 JogAmp Community.