Package com.jogamp.nativewindow.awt
Class DirectDataBufferInt
- java.lang.Object
-
- java.awt.image.DataBuffer
-
- com.jogamp.nativewindow.awt.DirectDataBufferInt
-
public final class DirectDataBufferInt extends DataBuffer
DataBufferspecialization using NIO direct buffer of typeDataBuffer.TYPE_INTas storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDirectDataBufferInt.BufferedImageIntstatic classDirectDataBufferInt.DirectWritableRaster
-
Field Summary
-
Fields inherited from class java.awt.image.DataBuffer
TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT
-
-
Constructor Summary
Constructors Constructor Description DirectDataBufferInt(int size)Constructs an nio integer-basedDataBufferwith a single bank and the specified size.DirectDataBufferInt(int size, int numBanks)Constructs an nio integer-basedDataBufferwith the specified number of banks, all of which are the specified size.DirectDataBufferInt(ByteBuffer dataArray, int size)Constructs an nio integer-basedDataBufferwith a single bank using the specified array.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DirectDataBufferInt.BufferedImageIntcreateBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties)Creates aDirectDataBufferInt.BufferedImageIntusing adirect color modelinsRGB color space.
It uses aDirectDataBufferInt.DirectWritableRasterutilizingDirectDataBufferIntstorage.IntBuffergetData()Returns the default (first) int data array inDataBufferas anIntBufferrepresentation.IntBuffergetData(int bank)Returns the data array for the specified bank as anIntBufferrepresentation.ByteBuffergetDataBytes()Returns the default (first) int data array inDataBufferas aByteBufferrepresentation.ByteBuffergetDataBytes(int bank)Returns the data array for the specified bank as aByteBufferrepresentation.intgetElem(int i)Returns the requested data array element from the first (default) bank.intgetElem(int bank, int i)Returns the requested data array element from the specified bank.voidsetElem(int i, int val)Sets the requested data array element in the first (default) bank to the specified value.voidsetElem(int bank, int i, int val)Sets the requested data array element in the specified bank to the integer valuei.-
Methods inherited from class java.awt.image.DataBuffer
getDataType, getDataTypeSize, getElemDouble, getElemDouble, getElemFloat, getElemFloat, getNumBanks, getOffset, getOffsets, getSize, setElemDouble, setElemDouble, setElemFloat, setElemFloat
-
-
-
-
Constructor Detail
-
DirectDataBufferInt
public DirectDataBufferInt(int size)
Constructs an nio integer-basedDataBufferwith a single bank and the specified size.- Parameters:
size- The size of theDataBuffer.
-
DirectDataBufferInt
public DirectDataBufferInt(int size, int numBanks)Constructs an nio integer-basedDataBufferwith the specified number of banks, all of which are the specified size.- Parameters:
size- The size of the banks in theDataBuffer.numBanks- The number of banks in the aDataBuffer.
-
DirectDataBufferInt
public DirectDataBufferInt(ByteBuffer dataArray, int size)
Constructs an nio integer-basedDataBufferwith a single bank using the specified array.Only the first
sizeelements should be used by accessors of thisDataBuffer.dataArraymust be large enough to holdsizeelements.- Parameters:
dataArray- The NIOByteBufferarray, holding the integer data for theDataBuffer.size- The size of theDataBufferbank.
-
-
Method Detail
-
createBufferedImage
public static DirectDataBufferInt.BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties)
Creates aDirectDataBufferInt.BufferedImageIntusing adirect color modelinsRGB color space.
It uses aDirectDataBufferInt.DirectWritableRasterutilizingDirectDataBufferIntstorage.Note that due to using the custom storage type
DirectDataBufferInt, the resultingBufferedImage'simage-typeis ofTYPE_CUSTOM. We are not able to change this detail, since the AWT image implementation associates theimage-typewith a build-in storage-type. UseDirectDataBufferInt.BufferedImageInt.getCustomType()to retrieve the custom image-type, which will return theimageTypevalue passed here.- Parameters:
width-height-imageType- one ofTYPE_INT_ARGB,TYPE_INT_ARGB_PRE,TYPE_INT_RGBorTYPE_INT_BGR.location- origin, ifnull0/0 is assumed.properties-HashtableofString/Objectpairs. Used forBufferedImage.getProperty(String)etc.- Returns:
-
getData
public IntBuffer getData()
Returns the default (first) int data array inDataBufferas anIntBufferrepresentation.- Returns:
- The first integer data array.
- See Also:
getDataBytes()
-
getDataBytes
public ByteBuffer getDataBytes()
Returns the default (first) int data array inDataBufferas aByteBufferrepresentation.- Returns:
- The first integer data array.
- See Also:
getData()
-
getData
public IntBuffer getData(int bank)
Returns the data array for the specified bank as anIntBufferrepresentation.- Parameters:
bank- The bank whose data array you want to get.- Returns:
- The data array for the specified bank.
- See Also:
getDataBytes(int)
-
getDataBytes
public ByteBuffer getDataBytes(int bank)
Returns the data array for the specified bank as aByteBufferrepresentation.- Parameters:
bank- The bank whose data array you want to get.- Returns:
- The data array for the specified bank.
- See Also:
getData(int)
-
getElem
public int getElem(int i)
Returns the requested data array element from the first (default) bank.- Overrides:
getElemin classDataBuffer- Parameters:
i- The data array element you want to get.- Returns:
- The requested data array element as an integer.
- See Also:
setElem(int, int),setElem(int, int, int)
-
getElem
public int getElem(int bank, int i)Returns the requested data array element from the specified bank.- Specified by:
getElemin classDataBuffer- Parameters:
bank- The bank from which you want to get a data array element.i- The data array element you want to get.- Returns:
- The requested data array element as an integer.
- See Also:
setElem(int, int),setElem(int, int, int)
-
setElem
public void setElem(int i, int val)Sets the requested data array element in the first (default) bank to the specified value.- Overrides:
setElemin classDataBuffer- Parameters:
i- The data array element you want to set.val- The integer value to which you want to set the data array element.- See Also:
getElem(int),getElem(int, int)
-
setElem
public void setElem(int bank, int i, int val)Sets the requested data array element in the specified bank to the integer valuei.- Specified by:
setElemin classDataBuffer- Parameters:
bank- The bank in which you want to set the data array element.i- The data array element you want to set.val- The integer value to which you want to set the specified data array element.- See Also:
getElem(int),getElem(int, int)
-
-