All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.image.DataBuffer
java.lang.Object
|
+----java.awt.image.DataBuffer
- public abstract class DataBuffer
- extends Object
This class exists to wrap one or more data arrays. Each data array in
the DataBuffer is referred to as a bank. Accessor methods for getting
and setting elements of the DataBuffer's banks exist with and without
a bank specifier. The without bank specifiers use the default 0th
bank. The DataBuffer can optionally take an offset per bank, so that
data in an existing array can be used even if the interesting data
doesn't start at array location zero. Getting or setting the 0th
element of a bank, uses the (0+offset)th element of the array. The
size field specifies how much of the data array is available for
use. The size + offset fields for a given bank should never be longer
than the array length of the associatied data array. Generally, an
object of class DataBuffer will be cast down to one of it's subclasses
for improved speed.
banks- The number of banks (or arrays in this DataBuffer).
BYTE_DATA- Tag for byte data.
dataType- The datatype of this DataBuffer.
DOUBLE_DATA- Tag for byte data.
FLOAT_DATA- Tag for byte data.
INT_DATA- Tag for int data.
LONG_DATA- Tag for long data.
offset- Offset into default (first) bank from which to get the first element.
offsets- Offsets into all banks.
SHORT_DATA- Tag for short data.
size- Usable size of the a bank.
DataBuffer(int, int)
- Constructs a DataBuffer containing one bank of the specified
data type and size.
DataBuffer(int, int, int)
- Constructs a DataBuffer containing the specified number of
banks.
DataBuffer(int, int, int, int)
- Constructs a DataBuffer which contains the specified number
of banks.
DataBuffer(int, int, int, int[])
- Constructs a DataBuffer which contains the specified number
of banks.
getDataType()
- This returns the data type of this DataBuffer.
getElem(int)
- Returns the requested data array element from the first (default) bank
as an integer.
getElem(int, int)
- Returns the requested data array element from the specified bank
as an integer.
getElemDouble(int)
- Returns the requested data array element from the first (default) bank
as a double.
getElemDouble(int, int)
- Returns the requested data array element from the specified bank
as a double.
getElemFloat(int)
- Returns the requested data array element from the first (default) bank
as a float.
getElemFloat(int, int)
- Returns the requested data array element from the specified bank
as a float.
getNumBanks()
- Returns the number of banks in this DataBuffer.
getOffset()
- Returns the offset of the default bank in array elements.
getOffsets()
- Returns the offsets of all the banks in array elements.
getSize()
- Returns the size of the default bank in array elements.
setElem(int, int)
- Sets the requested data array element in the first (default) bank
from the given integer.
setElem(int, int, int)
- Sets the requested data array element in the specified bank
from the given integer.
setElemDouble(int, double)
- Sets the requested data array element in the first (default) bank
from the given double.
setElemDouble(int, int, double)
- Sets the requested data array element in the specified bank
from the given double.
setElemFloat(int, float)
- Sets the requested data array element in the first (default) bank
from the given float.
setElemFloat(int, int, float)
- Sets the requested data array element in the specified bank
from the given float.
sizeOf(int)
- Size of the data type, given a datatype tag.
toIntArray(Object)
- Converts an input array of some primitive datatype (byte/short/int)
into an integer array.
BYTE_DATA
public static final int BYTE_DATA
- Tag for byte data.
SHORT_DATA
public static final int SHORT_DATA
- Tag for short data.
INT_DATA
public static final int INT_DATA
- Tag for int data.
LONG_DATA
public static final int LONG_DATA
- Tag for long data.
FLOAT_DATA
public static final int FLOAT_DATA
- Tag for byte data.
DOUBLE_DATA
public static final int DOUBLE_DATA
- Tag for byte data.
dataType
protected int dataType
- The datatype of this DataBuffer.
banks
protected int banks
- The number of banks (or arrays in this DataBuffer).
offset
protected int offset
- Offset into default (first) bank from which to get the first element.
size
protected int size
- Usable size of the a bank.
offsets
protected int[] offsets
- Offsets into all banks.
DataBuffer
protected DataBuffer(int dataType,
int size)
- Constructs a DataBuffer containing one bank of the specified
data type and size.
DataBuffer
protected DataBuffer(int dataType,
int size,
int numBanks)
- Constructs a DataBuffer containing the specified number of
banks. Each bank has the specified size and an offset of 0.
DataBuffer
protected DataBuffer(int dataType,
int size,
int numBanks,
int offset)
- Constructs a DataBuffer which contains the specified number
of banks. Each bank has the specified datatype, size and offset.
DataBuffer
protected DataBuffer(int dataType,
int size,
int numBanks,
int[] offsets)
- Constructs a DataBuffer which contains the specified number
of banks. Each bank has the specified datatype and size. The
offset for each bank corresponds to it's respective entry in
the offsets array.
sizeOf
public static int sizeOf(int type)
- Size of the data type, given a datatype tag.
toIntArray
public static int[] toIntArray(Object obj)
- Converts an input array of some primitive datatype (byte/short/int)
into an integer array. If the input array is of type int[], it
will be returned as is. Otherwise, an integer array will be
created and elements promoted to ints and copied. Masks will be
used to prevent sign extension on byte values. Returns null
if obj is not of type byte[], short[] or int[].
getDataType
public int getDataType()
- This returns the data type of this DataBuffer.
getSize
public int getSize()
- Returns the size of the default bank in array elements.
getOffset
public int getOffset()
- Returns the offset of the default bank in array elements.
getOffsets
public int[] getOffsets()
- Returns the offsets of all the banks in array elements.
getNumBanks
public int getNumBanks()
- Returns the number of banks in this DataBuffer.
getElem
public int getElem(int i)
- Returns the requested data array element from the first (default) bank
as an integer.
getElem
public abstract int getElem(int bank,
int i)
- Returns the requested data array element from the specified bank
as an integer.
setElem
public void setElem(int i,
int val)
- Sets the requested data array element in the first (default) bank
from the given integer.
setElem
public abstract void setElem(int bank,
int i,
int val)
- Sets the requested data array element in the specified bank
from the given integer.
getElemFloat
public float getElemFloat(int i)
- Returns the requested data array element from the first (default) bank
as a float.
getElemFloat
public float getElemFloat(int bank,
int i)
- Returns the requested data array element from the specified bank
as a float.
setElemFloat
public void setElemFloat(int i,
float val)
- Sets the requested data array element in the first (default) bank
from the given float.
setElemFloat
public void setElemFloat(int bank,
int i,
float val)
- Sets the requested data array element in the specified bank
from the given float.
getElemDouble
public double getElemDouble(int i)
- Returns the requested data array element from the first (default) bank
as a double.
getElemDouble
public double getElemDouble(int bank,
int i)
- Returns the requested data array element from the specified bank
as a double.
setElemDouble
public void setElemDouble(int i,
double val)
- Sets the requested data array element in the first (default) bank
from the given double.
setElemDouble
public void setElemDouble(int bank,
int i,
double val)
- Sets the requested data array element in the specified bank
from the given double.
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature