public class

DataBufferNative

extends DataBuffer
java.lang.Object
   ↳ java.awt.image.DataBuffer
     ↳ sun.awt.image.DataBufferNative

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 Constants
From class java.awt.image.DataBuffer
Fields
protected SurfaceData surfaceData
protected int width
[Expand]
Inherited Fields
From class java.awt.image.DataBuffer
Public Constructors
DataBufferNative(SurfaceData sData, int type, int width, int height)
Constructor.
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.
Protected Methods
int getElem(int x, int y, SurfaceData sData)
void setElem(int x, int y, int val, SurfaceData sData)
[Expand]
Inherited Methods
From class java.awt.image.DataBuffer
From class java.lang.Object

Fields

protected SurfaceData surfaceData

protected int width

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)