public final class DirectDataBufferInt extends DataBuffer
DataBuffer
specialization using NIO direct buffer of type DataBuffer.TYPE_INT
as storage.Modifier and Type | Class and Description |
---|---|
static class |
DirectDataBufferInt.BufferedImageInt |
static class |
DirectDataBufferInt.DirectWritableRaster |
TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT
Constructor and Description |
---|
DirectDataBufferInt(ByteBuffer dataArray,
int size)
Constructs an nio integer-based
DataBuffer with a single bank using the
specified array. |
DirectDataBufferInt(int size)
Constructs an nio integer-based
DataBuffer with a single bank
and the specified size. |
DirectDataBufferInt(int size,
int numBanks)
Constructs an nio integer-based
DataBuffer with the specified number of
banks, all of which are the specified size. |
Modifier and Type | Method and Description |
---|---|
static DirectDataBufferInt.BufferedImageInt |
createBufferedImage(int width,
int height,
int imageType,
Point location,
Hashtable<?,?> properties)
Creates a
DirectDataBufferInt.BufferedImageInt using a direct color model in sRGB color space .It uses a DirectDataBufferInt.DirectWritableRaster utilizing DirectDataBufferInt storage. |
IntBuffer |
getData()
Returns the default (first) int data array in
DataBuffer as an IntBuffer representation. |
IntBuffer |
getData(int bank)
Returns the data array for the specified bank as an
IntBuffer representation. |
ByteBuffer |
getDataBytes()
Returns the default (first) int data array in
DataBuffer as a ByteBuffer representation. |
ByteBuffer |
getDataBytes(int bank)
Returns the data array for the specified bank as a
ByteBuffer 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 value
i . |
getDataType, getDataTypeSize, getElemDouble, getElemDouble, getElemFloat, getElemFloat, getNumBanks, getOffset, getOffsets, getSize, setElemDouble, setElemDouble, setElemFloat, setElemFloat
public DirectDataBufferInt(int size)
DataBuffer
with a single bank
and the specified size.size
- The size of the DataBuffer
.public DirectDataBufferInt(int size, int numBanks)
DataBuffer
with the specified number of
banks, all of which are the specified size.size
- The size of the banks in the DataBuffer
.numBanks
- The number of banks in the aDataBuffer
.public DirectDataBufferInt(ByteBuffer dataArray, int size)
DataBuffer
with a single bank using the
specified array.
Only the first size
elements should be used by accessors of
this DataBuffer
. dataArray
must be large enough to
hold size
elements.
dataArray
- The NIO ByteBuffer
array, holding the integer data for the DataBuffer
.size
- The size of the DataBuffer
bank.public static DirectDataBufferInt.BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties)
DirectDataBufferInt.BufferedImageInt
using a direct color model
in sRGB color space
.DirectDataBufferInt.DirectWritableRaster
utilizing DirectDataBufferInt
storage.
Note that due to using the custom storage type DirectDataBufferInt
, the resulting
BufferedImage
's image-type
is of TYPE_CUSTOM
.
We are not able to change this detail, since the AWT image implementation associates the image-type
with a build-in storage-type.
Use DirectDataBufferInt.BufferedImageInt.getCustomType()
to retrieve the custom image-type, which will return the imageType
value passed here.
width
- height
- imageType
- one of TYPE_INT_ARGB
, TYPE_INT_ARGB_PRE
,
TYPE_INT_RGB
or TYPE_INT_BGR
.location
- origin, if null
0/0 is assumed.properties
- Hashtable
of
String
/Object
pairs. Used for BufferedImage.getProperty(String)
etc.public IntBuffer getData()
DataBuffer
as an IntBuffer
representation.getDataBytes()
public ByteBuffer getDataBytes()
DataBuffer
as a ByteBuffer
representation.getData()
public IntBuffer getData(int bank)
IntBuffer
representation.bank
- The bank whose data array you want to get.getDataBytes(int)
public ByteBuffer getDataBytes(int bank)
ByteBuffer
representation.bank
- The bank whose data array you want to get.getData(int)
public int getElem(int i)
getElem
in class DataBuffer
i
- The data array element you want to get.setElem(int, int)
,
setElem(int, int, int)
public int getElem(int bank, int i)
getElem
in class DataBuffer
bank
- The bank from which you want to get a data array element.i
- The data array element you want to get.setElem(int, int)
,
setElem(int, int, int)
public void setElem(int i, int val)
setElem
in class DataBuffer
i
- The data array element you want to set.val
- The integer value to which you want to set the data array element.getElem(int)
,
getElem(int, int)
public void setElem(int bank, int i, int val)
i
.setElem
in class DataBuffer
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.getElem(int)
,
getElem(int, int)
Copyright 2010 JogAmp Community.