java.awt.image
public abstract class DataBuffer extends Object
Field Summary | |
---|---|
protected int | banks The number of banks in this buffer. |
protected int | dataType The type of the data elements stored in the data buffer. |
protected int | offset Offset into the default (0'th) bank). |
protected int[] | offsets Offset into each bank. |
protected int | size The size of the banks. |
static int | TYPE_BYTE
A constant representing a data type that uses byte primitives
as the storage unit. |
static int | TYPE_DOUBLE
A constant representing a data type that uses double
primitives as the storage unit. |
static int | TYPE_FLOAT
A constant representing a data type that uses float
primitives as the storage unit. |
static int | TYPE_INT
A constant representing a data type that uses int
primitives as the storage unit. |
static int | TYPE_SHORT
A constant representing a data type that uses short
primitives as the storage unit. |
static int | TYPE_UNDEFINED
A constant representing an undefined data type. |
static int | TYPE_USHORT
A constant representing a data type that uses short
primitives as the storage unit. |
Constructor Summary | |
---|---|
protected | DataBuffer(int dataType, int size)
Creates a new DataBuffer with the specified data type and
size. |
protected | DataBuffer(int dataType, int size, int numBanks)
Creates a new DataBuffer with the specified data type,
size and number of banks. |
protected | DataBuffer(int dataType, int size, int numBanks, int offset)
Creates a new DataBuffer with the specified data type,
size and number of banks. |
protected | DataBuffer(int dataType, int size, int numBanks, int[] offsets)
Creates a new DataBuffer with the specified data type,
size and number of banks. |
Method Summary | |
---|---|
int | getDataType()
Returns the type of the data elements in the data buffer. |
static int | getDataTypeSize(int dataType)
Returns the size (number of bits) of the specified data type. |
int | getElem(int i)
Returns an element from the first data bank. |
abstract int | getElem(int bank, int i)
Returns an element from a particular data bank. |
double | getElemDouble(int i)
Returns an element from the first data bank, converted to a
double . |
double | getElemDouble(int bank, int i)
Returns an element from a particular data bank, converted to a
double . |
float | getElemFloat(int i)
Returns an element from the first data bank, converted to a
float . |
float | getElemFloat(int bank, int i)
Returns an element from a particular data bank, converted to a
float . |
int | getNumBanks()
Returns the number of data banks for this DataBuffer . |
int | getOffset()
Returns the element offset for the first data bank.
|
int[] | getOffsets()
Returns the offsets for all the data banks used by this
DataBuffer .
|
int | getSize()
Returns the size of the data buffer.
|
void | setElem(int i, int val)
Sets an element in the first data bank. |
abstract void | setElem(int bank, int i, int val)
Sets an element in a particular data bank. |
void | setElemDouble(int i, double val)
Sets an element in the first data bank. |
void | setElemDouble(int bank, int i, double val)
Sets an element in a particular data bank. |
void | setElemFloat(int i, float val)
Sets an element in the first data bank. |
void | setElemFloat(int bank, int i, float val)
Sets an element in a particular data bank. |
byte
primitives
as the storage unit.double
primitives as the storage unit.float
primitives as the storage unit.int
primitives as the storage unit.short
primitives as the storage unit.short
primitives as the storage unit.DataBuffer
with the specified data type and
size. The dataType
should be one of the constants
{@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
{@link #TYPE_INT}, {@link #TYPE_FLOAT} and {@link #TYPE_DOUBLE}.
The physical (array-based) storage is allocated by a subclass.
Parameters: dataType the data type. size the number of elements in the buffer.
DataBuffer
with the specified data type,
size and number of banks. The dataType
should be one of
the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
{@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
{@link #TYPE_DOUBLE}.
The physical (array-based) storage is allocated by a subclass.
Parameters: dataType the data type. size the number of elements in the buffer. numBanks the number of data banks.
DataBuffer
with the specified data type,
size and number of banks. An offset (which applies to all banks) is
also specified. The dataType
should be one of
the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
{@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
{@link #TYPE_DOUBLE}.
The physical (array-based) storage is allocated by a subclass.
Parameters: dataType the data type. size the number of elements in the buffer. numBanks the number of data banks. offset the offset to the first element for all banks.
DataBuffer
with the specified data type,
size and number of banks. An offset (which applies to all banks) is
also specified. The dataType
should be one of
the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
{@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
{@link #TYPE_DOUBLE}.
The physical (array-based) storage is allocated by a subclass.
Parameters: dataType the data type. size the number of elements in the buffer. numBanks the number of data banks. offsets the offsets to the first element for all banks.
Throws: ArrayIndexOutOfBoundsException if
numBanks != offsets.length
.
Returns: The type.
Parameters: dataType the data type.
Returns: The number of bits for the specified data type.
Throws: IllegalArgumentException if dataType < 0
or
dataType > TYPE_DOUBLE
.
i
before accessing the
underlying data array.
Parameters: i the element index.
Returns: The element.
i
before accessing the
underlying data array.
Parameters: bank the bank index. i the element index.
Returns: The element.
double
. The offset (specified in the constructor) is added
to i
before accessing the underlying data array.
Parameters: i the element index.
Returns: The element.
double
. The offset (specified in the constructor) is
added to i
before accessing the underlying data array.
Parameters: bank the bank index. i the element index.
Returns: The element.
float
. The offset (specified in the constructor) is added
to i
before accessing the underlying data array.
Parameters: i the element index.
Returns: The element.
float
. The offset (specified in the constructor) is
added to i
before accessing the underlying data array.
Parameters: bank the bank index. i the element index.
Returns: The element.
DataBuffer
.Returns: The number of data banks.
Returns: The element offset.
DataBuffer
.
Returns: The offsets.
Returns: The size.
i
before updating the underlying
data array.
Parameters: i the element index. val the new element value.
i
before updating the underlying
data array.
Parameters: bank the data bank index. i the element index. val the new element value.
i
before updating the underlying
data array.
Parameters: i the element index. val the new element value.
i
before updating the underlying
data array.
Parameters: bank the data bank index. i the element index. val the new element value.
i
before updating the underlying
data array.
Parameters: i the element index. val the new element value.
i
before updating the underlying
data array.
Parameters: bank the data bank index. i the element index. val the new element value.