APIdia Launch Partner
Top Description Fields Constructors Methods
sun.awt.image

public Class DataBufferNative

extends DataBuffer
Class Inheritance
Imports
java.awt.image.DataBuffer, sun.java2d.SurfaceData, java.awt.Rectangle

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.

Field Summary

Modifier and TypeField and Description
protected SurfaceData
protected int
Inherited from java.awt.image.DataBuffer:
banksdataTypeoffsetoffsetssizeTYPE_BYTETYPE_DOUBLETYPE_FLOATTYPE_INTTYPE_SHORTTYPE_UNDEFINEDTYPE_USHORT

Constructor Summary

AccessConstructor and Description
public
DataBufferNative(SurfaceData sData, int type, int width, int height)

Constructor.

Method Summary

Modifier and TypeMethod and Description
protected native int
getElem(int x, int y, SurfaceData sData)

public int
getElem(int bank, int i)

Implements abstract java.awt.image.DataBuffer.getElem.

getElem returns the pixel value for a given index into the dataBuffer array.

protected native void
setElem(int x, int y, int val, SurfaceData sData)

public void
setElem(int bank, int i, int val)

Implements abstract java.awt.image.DataBuffer.setElem.

setElem sets the pixel value of a given index into the dataBuffer array.

Inherited from java.awt.image.DataBuffer:
getDataTypegetDataTypeSizegetElemgetElemDoublegetElemDoublegetElemFloatgetElemFloatgetNumBanksgetOffsetgetOffsetsgetSizesetElemsetElemDoublesetElemDoublesetElemFloatsetElemFloat

Field Detail

surfaceDataback to summary
protected SurfaceData surfaceData
widthback to summary
protected int width

Constructor Detail

DataBufferNativeback to summary
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.

Method Detail

getElemback to summary
protected native int getElem(int x, int y, SurfaceData sData)
getElemback to summary
public int getElem(int bank, int i)

Implements abstract java.awt.image.DataBuffer.getElem.

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.

setElemback to summary
protected native void setElem(int x, int y, int val, SurfaceData sData)
setElemback to summary
public void setElem(int bank, int i, int val)

Implements abstract java.awt.image.DataBuffer.setElem.

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.