| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | bitMask
The bit mask for extracting the pixel. |
| pack-priv byte[] | data
The image data array. |
| pack-priv int | dataBitOffset
The data bit offset for each pixel. |
| private int | maxX
A cached copy of minX + width for use in bounds checks. |
| private int | maxY
A cached copy of minY + height for use in bounds checks. |
| pack-priv int | pixelBitStride
The bit stride of a pixel, equal to the total number of bits required to store a pixel. |
| pack-priv int | scanlineStride
Scanline stride of the image data contained in this Raster. |
| pack-priv int | shiftOffset
8 minus the pixel bit stride. |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| public | BytePackedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, Point The Point that specified the origin. origin)Constructs a BytePackedRaster with the given SampleModel. |
| public | BytePackedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, DataBufferByte The DataBufferByte that contains the image data. dataBuffer, Point The Point that specifies the origin. origin)Constructs a BytePackedRaster with the given SampleModel and DataBuffer. |
| public | BytePackedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, DataBufferByte The DataBufferByte that contains the image data. dataBuffer, Rectangle The Rectangle that specifies the image area. aRegion, Point The Point that specifies the origin. origin, BytePackedRaster The parent (if any) of this raster. parent)Constructs a BytePackedRaster with the given SampleModel, DataBuffer, and parent. |
| Modifier and Type | Method and Description |
|---|---|
| public Raster | createChild(int
X offset. x, int Y offset. y, int Width (in pixels) of the subraster. width, int Height (in pixels) of the subraster. height, int Translated X origin of the subraster. x0, int Translated Y origin of the subraster. y0, int[] Array of band indices. bandList)Overrides java. Creates a subraster given a region of the raster. |
| public WritableRaster | createCompatibleWritableRaster(int w, int h)
Overrides java. Creates a raster with the same layout but using a different width and height, and with new zeroed data arrays. |
| public WritableRaster | createCompatibleWritableRaster()
Overrides java. Creates a raster with the same layout and the same width and height, and with new zeroed data arrays. |
| public WritableRaster | createWritableChild(int
X offset. x, int Y offset. y, int Width (in pixels) of the subraster. width, int Height (in pixels) of the subraster. height, int Translated X origin of the subraster. x0, int Translated Y origin of the subraster. y0, int[] Array of band indices. bandList)Overrides java. Creates a Writable subRaster given a region of the Raster. |
| public byte[] | Returns: Byte array with data elements.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, int The band to return, is ignored. band, byte[] If non-null, data elements
at the specified locations are returned in this array. outData)Returns a byte array containing the specified data elements from the data array. |
| public byte[] | Returns: Byte array with data elements.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, byte[] If non-null, data elements
at the specified locations are returned in this array. outData)Returns a byte array containing the specified data elements from the data array. |
| public int | |
| public Object | Returns: An object reference to an array of type defined by getTransferType() with the request pixel data.The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Object An object reference to an array of type defined by
getTransferType() and length getNumDataElements().
If null an array of appropriate type and size will be
allocated. obj)Overrides java. Returns the data element at the specified location. |
| public Object | Returns: An object reference to an array of type defined by getTransferType() with the requested pixel data.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, Object An object reference to an array of type defined by
getTransferType() and length w*h*getNumDataElements().
If null, an array of appropriate type and size will be
allocated. outData)Overrides java. Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType. |
| public byte[] | |
| public int | getPixelBitStride()
Returns pixel bit stride -- the number of bits between two samples on the same scanline. |
| public Object | Returns: An object reference to an array of type defined by getTransferType() with the request pixel data.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, Object An object reference to an array of type defined by
getTransferType() and length w*h*getNumDataElements().
If null an array of appropriate type and size will be
allocated. obj)Returns an array of data elements from the specified rectangular region. |
| public int[] | Returns: the samples for the specified rectangle of pixels.Width of the pixel rectangle w, int Height of the pixel rectangle h, int[] An optionally pre-allocated int array iArray)Overrides java. Returns an int array containing all samples for a rectangle of pixels, one sample per array element. |
| public int | getScanlineStride()
Returns the scanline stride -- the number of data array elements between a given sample and the sample in the same column of the next row. |
| private static native void | |
| public void | putByteData(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, int The band to set, is ignored. band, byte[] The data elements to be stored. inData)Stores a byte array of data elements into the specified rectangular region. |
| public void | putByteData(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, byte[] The data elements to be stored. inData)Stores a byte array of data elements into the specified rectangular region. |
| public void | setDataElements(int
The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Object An object reference to an array of type defined by
getTransferType() and length getNumDataElements()
containing the pixel data to place at x,y. obj)Overrides java. Stores the data elements at the specified location. |
| public void | setDataElements(int
The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Raster Raster of data to place at x,y location. inRaster)Overrides java. Stores the Raster data at the specified location. |
| private void | setDataElements(int
The absolute X coordinate of the destination pixel
that will receive a copy of the upper-left pixel of the
inRaster dstX, int The absolute Y coordinate of the destination pixel
that will receive a copy of the upper-left pixel of the
inRaster dstY, int The absolute X coordinate of the upper-left source
pixel that will be copied into this Raster srcX, int The absolute Y coordinate of the upper-left source
pixel that will be copied into this Raster srcY, int The number of pixels to store horizontally width, int The number of pixels to store vertically height, BytePackedRaster BytePackedRaster of data to place at x,y location. inRaster)Stores the Raster data at the specified location. |
| public void | setDataElements(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, Object An object reference to an array of type defined by
getTransferType() and length w*h*getNumDataElements()
containing the pixel data to place between x,y and
x+h, y+h. obj)Overrides java. Stores an array of data elements into the specified rectangular region. |
| public void | setPixels(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, int[] The input int pixel array. iArray)Overrides java. Sets all samples for a rectangle of pixels from an int array containing one sample per array element. |
| public void | setRect(int
The X translation factor from src space to dst space
of the copy. dx, int The Y translation factor from src space to dst space
of the copy. dy, Raster The Raster from which to copy pixels. srcRaster)Overrides java. Copies pixels from Raster srcRaster to this WritableRaster. |
| public String | |
| private void | Returns: String Error string, if the layout is incompatible with the data. Otherwise returns null.Verify that the layout parameters are consistent with the data. |
| bitMask | back to summary |
|---|---|
| pack-priv int bitMask The bit mask for extracting the pixel. | |
| data | back to summary |
|---|---|
| pack-priv byte[] data The image data array. | |
| dataBitOffset | back to summary |
|---|---|
| pack-priv int dataBitOffset The data bit offset for each pixel. | |
| maxX | back to summary |
|---|---|
| private int maxX A cached copy of minX + width for use in bounds checks. | |
| maxY | back to summary |
|---|---|
| private int maxY A cached copy of minY + height for use in bounds checks. | |
| pixelBitStride | back to summary |
|---|---|
| pack-priv int pixelBitStride The bit stride of a pixel, equal to the total number of bits required to store a pixel. | |
| scanlineStride | back to summary |
|---|---|
| pack-priv int scanlineStride Scanline stride of the image data contained in this Raster. | |
| shiftOffset | back to summary |
|---|---|
| pack-priv int shiftOffset 8 minus the pixel bit stride. | |
| type | back to summary |
|---|---|
| pack-priv int type | |
| BytePackedRaster | back to summary |
|---|---|
| public BytePackedRaster(SampleModel sampleModel, Point origin) Constructs a BytePackedRaster with the given SampleModel. The Raster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the Raster is automatically created. SampleModel must be of type MultiPixelPackedSampleModel.
| |
| BytePackedRaster | back to summary |
|---|---|
| public BytePackedRaster(SampleModel sampleModel, DataBufferByte dataBuffer, Point origin) Constructs a BytePackedRaster with the given SampleModel and DataBuffer. The Raster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be a DataBufferByte compatible with SampleModel. SampleModel must be of type MultiPixelPackedSampleModel.
| |
| BytePackedRaster | back to summary |
|---|---|
| public BytePackedRaster(SampleModel sampleModel, DataBufferByte dataBuffer, Rectangle aRegion, Point origin, BytePackedRaster parent) Constructs a BytePackedRaster with the given SampleModel, DataBuffer, and parent. DataBuffer must be a DataBufferByte and SampleModel must be of type MultiPixelPackedSampleModel. When translated into the base Raster's coordinate system, aRegion must be contained by the base Raster. Origin is the coordinate in the new Raster's coordinate system of the origin of the base Raster. (The base Raster is the Raster's ancestor which has no parent.) Note that this constructor should generally be called by other constructors or create methods, it should not be used directly.
| |
| createChild | back to summary |
|---|---|
| public Raster createChild(int x, int y, int width, int height, int x0, int y0, int[] bandList) Overrides java. Creates a subraster given a region of the raster. The x and y coordinates specify the horizontal and vertical offsets from the upper-left corner of this raster to the upper-left corner of the subraster. Note that the subraster will reference the same DataBuffer as the parent raster, but using different offsets. The bandList is ignored.
| |
| createCompatibleWritableRaster | back to summary |
|---|---|
| public WritableRaster createCompatibleWritableRaster(int w, int h) Overrides java. Creates a raster with the same layout but using a different width and height, and with new zeroed data arrays. | |
| createCompatibleWritableRaster | back to summary |
|---|---|
| public WritableRaster createCompatibleWritableRaster() Overrides java. Creates a raster with the same layout and the same width and height, and with new zeroed data arrays. | |
| createWritableChild | back to summary |
|---|---|
| public WritableRaster createWritableChild(int x, int y, int width, int height, int x0, int y0, int[] bandList) Overrides java. Creates a Writable subRaster given a region of the Raster. The x and y coordinates specify the horizontal and vertical offsets from the upper-left corner of this Raster to the upper-left corner of the subRaster. The bandList is ignored. A translation to the subRaster may also be specified. Note that the subRaster will reference the same DataBuffer as the parent Raster, but using different offsets.
| |
| getByteData | back to summary |
|---|---|
| public byte[] getByteData(int x, int y, int w, int h, int band, byte[] outData) Returns a byte array containing the specified data elements from the data array. The band index will be ignored. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
byte[] byteData = getByteData(x, y, band, w, h, null);
// To find a data element at location (x2, y2)
byte element = byteData[(y2-y)*w + (x2-x)];
| |
| getByteData | back to summary |
|---|---|
| public byte[] getByteData(int x, int y, int w, int h, byte[] outData) Returns a byte array containing the specified data elements from the data array. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
byte[] byteData = raster.getByteData(x, y, w, h, null);
byte pixel;
// To find a data element at location (x2, y2)
pixel = byteData[((y2-y)*w + (x2-x))];
| |
| getDataBitOffset | back to summary |
|---|---|
| public int getDataBitOffset() Returns the data bit offset for the Raster. The data bit offset is the bit index into the data array element corresponding to the first sample of the first scanline. | |
| getDataElements | back to summary |
|---|---|
| public Object getDataElements(int x, int y, Object obj) Overrides java. Returns the data element at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinate is out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
| |
| getDataElements | back to summary |
|---|---|
| public Object getDataElements(int x, int y, int w, int h, Object outData) Overrides java. Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType. For image data supported by the Java 2D API, this will be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT. Data may be returned in a packed format, thus increasing efficiency for data transfers. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of TransferType.
| |
| getDataStorage | back to summary |
|---|---|
| public byte[] getDataStorage() Returns a reference to the entire data array. | |
| getPixelBitStride | back to summary |
|---|---|
| public int getPixelBitStride() Returns pixel bit stride -- the number of bits between two samples on the same scanline. | |
| getPixelData | back to summary |
|---|---|
| public Object getPixelData(int x, int y, int w, int h, Object obj) Returns an array of data elements from the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
byte[] bandData = (byte[])raster.getPixelData(x, y, w, h, null);
int pixel;
// To find a data element at location (x2, y2)
pixel = bandData[((y2-y)*w + (x2-x))];
| |
| getPixels | back to summary |
|---|---|
| public int[] getPixels(int x, int y, int w, int h, int[] iArray) Overrides java. Returns an int array containing all samples for a rectangle of pixels, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getScanlineStride | back to summary |
|---|---|
| public int getScanlineStride() Returns the scanline stride -- the number of data array elements between a given sample and the sample in the same column of the next row. | |
| initIDs | back to summary |
|---|---|
| private static native void initIDs() | |
| putByteData | back to summary |
|---|---|
| public void putByteData(int x, int y, int w, int h, int band, byte[] inData) Stores a byte array of data elements into the specified rectangular region. The band index will be ignored. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed. That is, a data element at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))]
| |
| putByteData | back to summary |
|---|---|
| public void putByteData(int x, int y, int w, int h, byte[] inData) Stores a byte array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed. That is, a data element at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))]
| |
| setDataElements | back to summary |
|---|---|
| public void setDataElements(int x, int y, Object obj) Overrides java. Stores the data elements at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinate is out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
| |
| setDataElements | back to summary |
|---|---|
| public void setDataElements(int x, int y, Raster inRaster) Overrides java. Stores the Raster data at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
| |
| setDataElements | back to summary |
|---|---|
| private void setDataElements(int dstX, int dstY, int srcX, int srcY, int width, int height, BytePackedRaster inRaster) Stores the Raster data at the specified location.
| |
| setDataElements | back to summary |
|---|---|
| public void setDataElements(int x, int y, int w, int h, Object obj) Overrides java. Stores an array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType. The data elements in the data array are assumed to be packed. That is, a data element at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))]
| |
| setPixels | back to summary |
|---|---|
| public void setPixels(int x, int y, int w, int h, int[] iArray) Overrides java. Sets all samples for a rectangle of pixels from an int array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| setRect | back to summary |
|---|---|
| public void setRect(int dx, int dy, Raster srcRaster) Overrides java. Copies pixels from Raster srcRaster to this WritableRaster.
For each (x, y) address in srcRaster, the corresponding pixel
is copied to address (x+dx, y+dy) in this WritableRaster,
unless (x+dx, y+dy) falls outside the bounds of this raster.
srcRaster must have the same number of bands as this WritableRaster.
The copy is a simple copy of source samples to the corresponding
destination samples. For details, see
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| verify | back to summary |
|---|---|
| private void verify(boolean strictCheck) Verify that the layout parameters are consistent with the data. If strictCheck is false, this method will check for ArrayIndexOutOfBounds conditions. If strictCheck is true, this method will check for additional error conditions such as line wraparound (width of a line greater than the scanline stride).
| |