Package com.jogamp.nativewindow.awt
Class DirectDataBufferInt
java.lang.Object
java.awt.image.DataBuffer
com.jogamp.nativewindow.awt.DirectDataBufferInt
DataBuffer
specialization using NIO direct buffer of type DataBuffer.TYPE_INT
as storage.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
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
ConstructorsConstructorDescriptionDirectDataBufferInt
(int size) Constructs an nio integer-basedDataBuffer
with a single bank and the specified size.DirectDataBufferInt
(int size, int numBanks) Constructs an nio integer-basedDataBuffer
with the specified number of banks, all of which are the specified size.DirectDataBufferInt
(ByteBuffer dataArray, int size) Constructs an nio integer-basedDataBuffer
with a single bank using the specified array. -
Method Summary
Modifier and TypeMethodDescriptioncreateBufferedImage
(int width, int height, int imageType, Point location, Hashtable<?, ?> properties) Creates aDirectDataBufferInt.BufferedImageInt
using adirect color model
insRGB color space
.
It uses aDirectDataBufferInt.DirectWritableRaster
utilizingDirectDataBufferInt
storage.getData()
Returns the default (first) int data array inDataBuffer
as anIntBuffer
representation.getData
(int bank) Returns the data array for the specified bank as anIntBuffer
representation.Returns the default (first) int data array inDataBuffer
as aByteBuffer
representation.getDataBytes
(int bank) Returns the data array for the specified bank as aByteBuffer
representation.int
getElem
(int i) Returns the requested data array element from the first (default) bank.int
getElem
(int bank, int i) Returns the requested data array element from the specified bank.void
setElem
(int i, int val) Sets the requested data array element in the first (default) bank to the specified value.void
setElem
(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 Details
-
DirectDataBufferInt
public DirectDataBufferInt(int size) Constructs an nio integer-basedDataBuffer
with a single bank and the specified size.- Parameters:
size
- The size of theDataBuffer
.
-
DirectDataBufferInt
public DirectDataBufferInt(int size, int numBanks) Constructs an nio integer-basedDataBuffer
with 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
Constructs an nio integer-basedDataBuffer
with a single bank using the specified array.Only the first
size
elements should be used by accessors of thisDataBuffer
.dataArray
must be large enough to holdsize
elements.- Parameters:
dataArray
- The NIOByteBuffer
array, holding the integer data for theDataBuffer
.size
- The size of theDataBuffer
bank.
-
-
Method Details
-
createBufferedImage
public static DirectDataBufferInt.BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?, ?> properties) Creates aDirectDataBufferInt.BufferedImageInt
using adirect color model
insRGB color space
.
It uses aDirectDataBufferInt.DirectWritableRaster
utilizingDirectDataBufferInt
storage.Note that due to using the custom storage type
DirectDataBufferInt
, the resultingBufferedImage
'simage-type
is ofTYPE_CUSTOM
. We are not able to change this detail, since the AWT image implementation associates theimage-type
with a build-in storage-type. UseDirectDataBufferInt.BufferedImageInt.getCustomType()
to retrieve the custom image-type, which will return theimageType
value passed here.- Parameters:
width
-height
-imageType
- one ofTYPE_INT_ARGB
,TYPE_INT_ARGB_PRE
,TYPE_INT_RGB
orTYPE_INT_BGR
.location
- origin, ifnull
0/0 is assumed.properties
-Hashtable
ofString
/Object
pairs. Used forBufferedImage.getProperty(String)
etc.- Returns:
-
getData
Returns the default (first) int data array inDataBuffer
as anIntBuffer
representation.- Returns:
- The first integer data array.
- See Also:
-
getDataBytes
Returns the default (first) int data array inDataBuffer
as aByteBuffer
representation.- Returns:
- The first integer data array.
- See Also:
-
getData
Returns the data array for the specified bank as anIntBuffer
representation.- Parameters:
bank
- The bank whose data array you want to get.- Returns:
- The data array for the specified bank.
- See Also:
-
getDataBytes
Returns the data array for the specified bank as aByteBuffer
representation.- Parameters:
bank
- The bank whose data array you want to get.- Returns:
- The data array for the specified bank.
- See Also:
-
getElem
public int getElem(int i) Returns the requested data array element from the first (default) bank.- Overrides:
getElem
in classDataBuffer
- Parameters:
i
- The data array element you want to get.- Returns:
- The requested data array element as an integer.
- See Also:
-
getElem
public int getElem(int bank, int i) Returns the requested data array element from the specified bank.- Specified by:
getElem
in 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
public void setElem(int i, int val) Sets the requested data array element in the first (default) bank to the specified value.- Overrides:
setElem
in 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:
-
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:
setElem
in 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:
-