Module java.desktop

Class SinglePixelPackedSampleModel

java.lang.Object
java.awt.image.SampleModel
java.awt.image.SinglePixelPackedSampleModel

public class SinglePixelPackedSampleModel extends SampleModel
This class represents pixel data packed such that the N samples which make up a single pixel are stored in a single data array element, and each data data array element holds samples for only one pixel. This class supports TYPE_BYTE, TYPE_USHORT, TYPE_INT data types. All data array elements reside in the first bank of a DataBuffer. Accessor methods are provided so that the image data can be manipulated directly. Scanline stride is the number of data array elements between a given sample and the corresponding sample in the same column of the next scanline. Bit masks are the masks required to extract the samples representing the bands of the pixel. Bit offsets are the offsets in bits into the data array element of the samples representing the bands of the pixel.

The following code illustrates extracting the bits of the sample representing band b for pixel x,y from DataBuffer data:


      int sample = data.getElem(y * scanlineStride + x);
      sample = (sample & bitMasks[b]) >>> bitOffsets[b];