Class Overview
This class extends DataBuffer
and allows access to
native data via the DataBuffer methods. Note that, unlike other
DataBuffer classes, the data is not stored in this class but
has been created and stored elsewhere and this class is used
merely to access that data. Note also that this class subclasses
from DataBuffer and not from any of the standard subclasses
(e.g., DataBufferInt); those subclasses allow the user to
get a pointer to the data and manipulate it directly. That
operation may not be possible or wise with native data.
One important use of this DataBuffer class is in accessing the
data stored in an offscreen vram surface, such as that created
by the createVolatileImage() method.
Summary
[Expand]
Inherited Fields |
From class
java.awt.image.DataBuffer
protected
int |
banks |
The number of banks in this DataBuffer. |
protected
int |
dataType |
The data type of this DataBuffer. |
protected
int |
offset |
Offset into default (first) bank from which to get the first element. |
protected
int[] |
offsets |
Offsets into all banks. |
protected
int |
size |
Usable size of all banks. |
|
Public Methods |
int
|
getElem(int bank, int i)
getElem returns the pixel value for a given index into the
dataBuffer array.
|
void
|
setElem(int bank, int i, int val)
setElem sets the pixel value of a given index into the
dataBuffer array.
|
[Expand]
Inherited Methods |
From class
java.awt.image.DataBuffer
int
|
getDataType()
Returns the data type of this DataBuffer.
|
static
int
|
getDataTypeSize(int type)
Returns the size (in bits) of the data type, given a datatype tag.
|
abstract
int
|
getElem(int bank, int i)
Returns the requested data array element from the specified bank
as an integer.
|
int
|
getElem(int i)
Returns the requested data array element from the first (default) bank
as an integer.
|
double
|
getElemDouble(int bank, int i)
Returns the requested data array element from the specified bank as
a double.
|
double
|
getElemDouble(int i)
Returns the requested data array element from the first (default) bank
as a double.
|
float
|
getElemFloat(int i)
Returns the requested data array element from the first (default) bank
as a float.
|
float
|
getElemFloat(int bank, int i)
Returns the requested data array element from the specified bank
as a float.
|
int
|
getNumBanks()
Returns the number of banks in this DataBuffer.
|
int
|
getOffset()
Returns the offset of the default bank in array elements.
|
int[]
|
getOffsets()
Returns the offsets (in array elements) of all the banks.
|
int
|
getSize()
Returns the size (in array elements) of all banks.
|
void
|
setElem(int i, int val)
Sets the requested data array element in the first (default) bank
from the given integer.
|
abstract
void
|
setElem(int bank, int i, int val)
Sets the requested data array element in the specified bank
from the given integer.
|
void
|
setElemDouble(int i, double val)
Sets the requested data array element in the first (default) bank
from the given double.
|
void
|
setElemDouble(int bank, int i, double val)
Sets the requested data array element in the specified bank
from the given double.
|
void
|
setElemFloat(int i, float val)
Sets the requested data array element in the first (default) bank
from the given float.
|
void
|
setElemFloat(int bank, int i, float val)
Sets the requested data array element in the specified bank
from the given float.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Fields
Public Constructors
public
DataBufferNative
(SurfaceData sData, int type, int width, int height)
Constructor. The constructor of this object requires a
SurfaceData object; that surfaceData object will be used
to access the actual pixel data in native code.
Public Methods
public
int
getElem
(int bank, int i)
getElem returns the pixel value for a given index into the
dataBuffer array. The bank value is currently ignored (the
type of data accessed through this class is not stored in
separate banks). The x and y coordinates of a pixel are calculated
from the index value and the native getElem() method is
called with the internal surfaceData object.
Parameters
bank
| the specified bank |
i
| the index of the requested data array element |
Returns
- the data array element at the specified index from the
specified bank at the specified index.
public
void
setElem
(int bank, int i, int val)
setElem sets the pixel value of a given index into the
dataBuffer array. The bank value is currently ignored (the
type of data accessed through this class is not stored in
separate banks). The x and y coordinates of a pixel are calculated
from the index value and the native setElem() method is
called with the internal surfaceData object.
Parameters
bank
| the specified bank |
i
| the specified index into the data array |
val
| the data to set the element in the specified bank
at the specified index in the data array |
Protected Methods
protected
int
getElem
(int x, int y, SurfaceData sData)
protected
void
setElem
(int x, int y, int val, SurfaceData sData)