Constructor: |
protected DataBuffer(int dataType,
int size) {
this(UNTRACKABLE, dataType, size);
}
Constructs a DataBuffer containing one bank of the specified
data type and size. Parameters:
dataType - the data type of this DataBuffer
size - the size of the banks
|
DataBuffer(State initialState,
int dataType,
int size) {
this.theTrackable = StateTrackableDelegate.createInstance(initialState);
this.dataType = dataType;
this.banks = 1;
this.size = size;
this.offset = 0;
this.offsets = new int[1]; // init to 0 by new
}
Constructs a DataBuffer containing one bank of the specified
data type and size with the indicated initial State . Parameters:
initialState - the initial State state of the data
dataType - the data type of this DataBuffer
size - the size of the banks
- since:
1.7 -
|
protected DataBuffer(int dataType,
int size,
int numBanks) {
this(UNTRACKABLE, dataType, size, numBanks);
}
Constructs a DataBuffer containing the specified number of
banks. Each bank has the specified size and an offset of 0. Parameters:
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
|
DataBuffer(State initialState,
int dataType,
int size,
int numBanks) {
this.theTrackable = StateTrackableDelegate.createInstance(initialState);
this.dataType = dataType;
this.banks = numBanks;
this.size = size;
this.offset = 0;
this.offsets = new int[banks]; // init to 0 by new
}
Constructs a DataBuffer containing the specified number of
banks with the indicated initial State .
Each bank has the specified size and an offset of 0. Parameters:
initialState - the initial State state of the data
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
- since:
1.7 -
|
protected DataBuffer(int dataType,
int size,
int numBanks,
int offset) {
this(UNTRACKABLE, dataType, size, numBanks, offset);
}
Constructs a DataBuffer that contains the specified number
of banks. Each bank has the specified datatype, size and offset. Parameters:
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
offset - the offset for each bank
|
protected DataBuffer(int dataType,
int size,
int numBanks,
int[] offsets) {
this(UNTRACKABLE, dataType, size, numBanks, offsets);
}
Constructs a DataBuffer which contains the specified number
of banks. Each bank has the specified datatype and size. The
offset for each bank is specified by its respective entry in
the offsets array. Parameters:
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
offsets - an array containing an offset for each bank.
Throws:
ArrayIndexOutOfBoundsException - if numBanks
does not equal the length of offsets
|
DataBuffer(State initialState,
int dataType,
int size,
int numBanks,
int offset) {
this.theTrackable = StateTrackableDelegate.createInstance(initialState);
this.dataType = dataType;
this.banks = numBanks;
this.size = size;
this.offset = offset;
this.offsets = new int[numBanks];
for (int i = 0; i < numBanks; i++) {
this.offsets[i] = offset;
}
}
Constructs a DataBuffer that contains the specified number
of banks with the indicated initial State .
Each bank has the specified datatype, size and offset. Parameters:
initialState - the initial State state of the data
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
offset - the offset for each bank
- since:
1.7 -
|
DataBuffer(State initialState,
int dataType,
int size,
int numBanks,
int[] offsets) {
if (numBanks != offsets.length) {
throw new ArrayIndexOutOfBoundsException("Number of banks" +
" does not match number of bank offsets");
}
this.theTrackable = StateTrackableDelegate.createInstance(initialState);
this.dataType = dataType;
this.banks = numBanks;
this.size = size;
this.offset = offsets[0];
this.offsets = (int[])offsets.clone();
}
Constructs a DataBuffer which contains the specified number
of banks with the indicated initial State .
Each bank has the specified datatype and size. The
offset for each bank is specified by its respective entry in
the offsets array. Parameters:
initialState - the initial State state of the data
dataType - the data type of this DataBuffer
size - the size of the banks
numBanks - the number of banks in this
DataBuffer
offsets - an array containing an offset for each bank.
Throws:
ArrayIndexOutOfBoundsException - if numBanks
does not equal the length of offsets
- since:
1.7 -
|
Method from java.awt.image.DataBuffer Detail: |
public int getDataType() {
return dataType;
}
Returns the data type of this DataBuffer. |
public static int getDataTypeSize(int type) {
if (type < TYPE_BYTE || type > TYPE_DOUBLE) {
throw new IllegalArgumentException("Unknown data type "+type);
}
return dataTypeSize[type];
}
Returns the size (in bits) of the data type, given a datatype tag. |
public int getElem(int i) {
return getElem(0,i);
}
Returns the requested data array element from the first (default) bank
as an integer. |
abstract public int getElem(int bank,
int i)
Returns the requested data array element from the specified bank
as an integer. |
public double getElemDouble(int i) {
return (double)getElem(i);
}
Returns the requested data array element from the first (default) bank
as a double. The implementation in this class is to cast
#getElem(int)
to a double. Subclasses can override this method if another
implementation is needed. |
public double getElemDouble(int bank,
int i) {
return (double)getElem(bank,i);
}
Returns the requested data array element from the specified bank as
a double. The implementation in this class is to cast getElem(bank, i)
to a double. Subclasses may override this method if another
implementation is needed. |
public float getElemFloat(int i) {
return (float)getElem(i);
}
Returns the requested data array element from the first (default) bank
as a float. The implementation in this class is to cast getElem(i)
to a float. Subclasses may override this method if another
implementation is needed. |
public float getElemFloat(int bank,
int i) {
return (float)getElem(bank,i);
}
Returns the requested data array element from the specified bank
as a float. The implementation in this class is to cast
#getElem(int, int)
to a float. Subclasses can override this method if another
implementation is needed. |
public int getNumBanks() {
return banks;
}
Returns the number of banks in this DataBuffer. |
public int getOffset() {
return offset;
}
Returns the offset of the default bank in array elements. |
public int[] getOffsets() {
return (int[])offsets.clone();
}
Returns the offsets (in array elements) of all the banks. |
public int getSize() {
return size;
}
Returns the size (in array elements) of all banks. |
public void setElem(int i,
int val) {
setElem(0,i,val);
}
Sets the requested data array element in the first (default) bank
from the given integer. |
abstract public void setElem(int bank,
int i,
int val)
Sets the requested data array element in the specified bank
from the given integer. |
public void setElemDouble(int i,
double val) {
setElem(i,(int)val);
}
Sets the requested data array element in the first (default) bank
from the given double. The implementation in this class is to cast
val to an int and call #setElem(int, int) . Subclasses can
override this method if another implementation is needed. |
public void setElemDouble(int bank,
int i,
double val) {
setElem(bank,i,(int)val);
}
Sets the requested data array element in the specified bank
from the given double. The implementation in this class is to cast
val to an int and call #setElem(int, int) . Subclasses can
override this method if another implementation is needed. |
public void setElemFloat(int i,
float val) {
setElem(i,(int)val);
}
Sets the requested data array element in the first (default) bank
from the given float. The implementation in this class is to cast
val to an int and call #setElem(int, int) . Subclasses
can override this method if another implementation is needed. |
public void setElemFloat(int bank,
int i,
float val) {
setElem(bank,i,(int)val);
}
Sets the requested data array element in the specified bank
from the given float. The implementation in this class is to cast
val to an int and call #setElem(int, int) . Subclasses can
override this method if another implementation is needed. |
static int[] toIntArray(Object obj) {
if (obj instanceof int[]) {
return (int[])obj;
} else if (obj == null) {
return null;
} else if (obj instanceof short[]) {
short sdata[] = (short[])obj;
int idata[] = new int[sdata.length];
for (int i = 0; i < sdata.length; i++) {
idata[i] = (int)sdata[i] & 0xffff;
}
return idata;
} else if (obj instanceof byte[]) {
byte bdata[] = (byte[])obj;
int idata[] = new int[bdata.length];
for (int i = 0; i < bdata.length; i++) {
idata[i] = 0xff & (int)bdata[i];
}
return idata;
}
return null;
}
|