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 methods without a bank specifier 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. Size offset for a given bank should never be greater than the length of the associated data array. The data type of a data buffer indicates the type of the data array(s) and may also indicate additional semantics, e.g. storing unsigned 8-bit data in elements of a byte array. The data type may be TYPE_UNDEFINED or one of the types defined below. Other types may be added in the future. Generally, an object of class DataBuffer will be cast down to one of its data type specific subclasses to access data type specific methods for improved performance. Currently, the Java 2D(tm) API image classes use TYPE_BYTE, TYPE_USHORT, TYPE_INT, TYPE_SHORT, TYPE_FLOAT, and TYPE_DOUBLE DataBuffers to store image data.
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 methods without a bank specifier 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. Size offset for a given bank should never be greater than the length of the associated data array. The data type of a data buffer indicates the type of the data array(s) and may also indicate additional semantics, e.g. storing unsigned 8-bit data in elements of a byte array. The data type may be TYPE_UNDEFINED or one of the types defined below. Other types may be added in the future. Generally, an object of class DataBuffer will be cast down to one of its data type specific subclasses to access data type specific methods for improved performance. Currently, the Java 2D(tm) API image classes use TYPE_BYTE, TYPE_USHORT, TYPE_INT, TYPE_SHORT, TYPE_FLOAT, and TYPE_DOUBLE DataBuffers to store image data.
Static Constant.
Tag for unsigned byte data.
type: int
Static Constant. Tag for unsigned byte data. type: int
Static Constant.
Tag for double data. Placeholder for future use.
type: int
Static Constant. Tag for double data. Placeholder for future use. type: int
Static Constant.
Tag for float data. Placeholder for future use.
type: int
Static Constant. Tag for float data. Placeholder for future use. type: int
Static Constant.
Tag for int data.
type: int
Static Constant. Tag for int data. type: int
Static Constant.
Tag for signed short data. Placeholder for future use.
type: int
Static Constant. Tag for signed short data. Placeholder for future use. type: int
Static Constant.
Tag for undefined data.
type: int
Static Constant. Tag for undefined data. type: int
Static Constant.
Tag for unsigned short data.
type: int
Static Constant. Tag for unsigned short data. type: int
(*get-data-type-size type)
Returns the size (in bits) of the data type, given a datatype tag.
type - the value of one of the defined datatype tags - int
returns: the size of the data type - int
throws: java.lang.IllegalArgumentException - if type is less than zero or greater than TYPE_DOUBLE
Returns the size (in bits) of the data type, given a datatype tag. type - the value of one of the defined datatype tags - `int` returns: the size of the data type - `int` throws: java.lang.IllegalArgumentException - if type is less than zero or greater than TYPE_DOUBLE
(get-data-type this)
Returns the data type of this DataBuffer.
returns: the data type of this DataBuffer. - int
Returns the data type of this DataBuffer. returns: the data type of this DataBuffer. - `int`
(get-elem this i)
(get-elem this bank i)
Returns the requested data array element from the specified bank as an integer.
bank - the specified bank - int
i - the index of the requested data array element - int
returns: the data array element at the specified index from the
specified bank at the specified index. - int
Returns the requested data array element from the specified bank as an integer. bank - the specified bank - `int` i - the index of the requested data array element - `int` returns: the data array element at the specified index from the specified bank at the specified index. - `int`
(get-elem-double this i)
(get-elem-double this 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.
bank - the specified bank - int
i - the specified index - int
returns: a double value representing the element from the specified
bank at the specified index in the data array. - double
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. bank - the specified bank - `int` i - the specified index - `int` returns: a double value representing the element from the specified bank at the specified index in the data array. - `double`
(get-elem-float this i)
(get-elem-float this 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.
bank - the specified bank - int
i - the index of the requested data array element - int
returns: a float value representing the data array element from the
specified bank at the specified index. - float
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. bank - the specified bank - `int` i - the index of the requested data array element - `int` returns: a float value representing the data array element from the specified bank at the specified index. - `float`
(get-num-banks this)
Returns the number of banks in this DataBuffer.
returns: the number of banks. - int
Returns the number of banks in this DataBuffer. returns: the number of banks. - `int`
(get-offset this)
Returns the offset of the default bank in array elements.
returns: the offset of the default bank. - int
Returns the offset of the default bank in array elements. returns: the offset of the default bank. - `int`
(get-offsets this)
Returns the offsets (in array elements) of all the banks.
returns: the offsets of all banks. - int[]
Returns the offsets (in array elements) of all the banks. returns: the offsets of all banks. - `int[]`
(get-size this)
Returns the size (in array elements) of all banks.
returns: the size of all banks. - int
Returns the size (in array elements) of all banks. returns: the size of all banks. - `int`
(set-elem this i val)
(set-elem this bank i val)
Sets the requested data array element in the specified bank from the given integer.
bank - the specified bank - int
i - the specified index into the data array - int
val - the data to set the element in the specified bank at the specified index in the data array - int
Sets the requested data array element in the specified bank from the given integer. bank - the specified bank - `int` i - the specified index into the data array - `int` val - the data to set the element in the specified bank at the specified index in the data array - `int`
(set-elem-double this i val)
(set-elem-double this bank i 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.
bank - the specified bank - int
i - the specified index - int
val - the value to set the element in the specified bank at the specified index of the data array - double
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. bank - the specified bank - `int` i - the specified index - `int` val - the value to set the element in the specified bank at the specified index of the data array - `double`
(set-elem-float this i val)
(set-elem-float this bank i 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.
bank - the specified bank - int
i - the specified index - int
val - the value to set the element in the specified bank at the specified index in the data array - float
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. bank - the specified bank - `int` i - the specified index - `int` val - the value to set the element in the specified bank at the specified index in the data array - `float`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close