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
DataBuffer
specialization using NIO direct buffer of typeDataBuffer.TYPE_INT
as storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DirectDataBufferInt.BufferedImageInt
static class
DirectDataBufferInt.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-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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.IntBuffer
getData()
Returns the default (first) int data array inDataBuffer
as anIntBuffer
representation.IntBuffer
getData(int bank)
Returns the data array for the specified bank as anIntBuffer
representation.ByteBuffer
getDataBytes()
Returns the default (first) int data array inDataBuffer
as aByteBuffer
representation.ByteBuffer
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 Detail
-
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
public DirectDataBufferInt(ByteBuffer dataArray, int size)
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 Detail
-
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
public IntBuffer getData()
Returns the default (first) int data array inDataBuffer
as anIntBuffer
representation.- Returns:
- The first integer data array.
- See Also:
getDataBytes()
-
getDataBytes
public ByteBuffer getDataBytes()
Returns the default (first) int data array inDataBuffer
as aByteBuffer
representation.- Returns:
- The first integer data array.
- See Also:
getData()
-
getData
public IntBuffer getData(int bank)
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(int)
-
getDataBytes
public ByteBuffer getDataBytes(int bank)
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:
getData(int)
-
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:
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:
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(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:
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:
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:
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:
getElem(int)
,getElem(int, int)
-
-