de.intarsys.cwt.swt.image
public class SwtCompatibleRaster extends java.awt.image.WritableRaster
Modifier and Type | Field and Description |
---|---|
protected int |
bandOffset
private band offset for use by native code
|
protected byte[] |
data
The image data array.
|
protected int[] |
dataOffsets
Data offsets for each band of image data.
|
protected int |
pixelStride
Pixel stride of the image data contained in this Raster.
|
protected int |
scanlineStride
Scanline stride of the image data contained in this Raster.
|
Constructor and Description |
---|
SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel,
java.awt.image.DataBuffer paramDataBuffer,
java.awt.Point origin) |
SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel,
java.awt.image.DataBuffer paramDataBuffer,
java.awt.Rectangle aRegion,
java.awt.Point origin,
java.awt.image.WritableRaster paramParent) |
SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel,
java.awt.Point origin) |
Modifier and Type | Method and Description |
---|---|
java.awt.image.Raster |
createChild(int x,
int y,
int width,
int height,
int x0,
int y0,
int[] bandList)
Creates a subraster given a region of the raster.
|
java.awt.image.WritableRaster |
createCompatibleWritableRaster()
Creates a Raster with the same layout and the same width and height, and
with new zeroed data arrays.
|
java.awt.image.WritableRaster |
createCompatibleWritableRaster(int w,
int h)
Creates a Raster with the same layout but using a different width and
height, and with new zeroed data arrays.
|
java.awt.image.WritableRaster |
createWritableChild(int x,
int y,
int width,
int height,
int x0,
int y0,
int[] bandList)
Creates a Writable subRaster given a region of the Raster.
|
byte[] |
getByteData(int x,
int y,
int w,
int h,
byte[] outData)
Returns a byte array of data elements from the specified rectangular
region.
|
byte[] |
getByteData(int x,
int y,
int w,
int h,
int band,
byte[] outData)
Returns a byte array of data elements from the specified rectangular
region for the specified band.
|
java.lang.Object |
getDataElements(int x,
int y,
int w,
int h,
java.lang.Object obj)
Returns an array of data elements from the specified rectangular region.
|
java.lang.Object |
getDataElements(int actualX,
int actualY,
java.lang.Object obj)
Returns the data elements for all bands at the specified location.
|
int |
getDataOffset(int band)
Returns the data offset for the specified band.
|
int[] |
getDataOffsets()
Returns a copy of the data offsets array.
|
byte[] |
getDataStorage()
Returns a reference to the data array.
|
int[] |
getPixels(int x,
int y,
int w,
int h,
int[] iArray) |
int |
getPixelStride()
Returns pixel stride -- the number of data array elements between two
samples for the same band on the same scanline.
|
int |
getSample(int x,
int y,
int b) |
int[] |
getSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray) |
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 in the
same band.
|
void |
putByteData(int x,
int y,
int w,
int h,
byte[] inData)
Stores a byte array of data elements into the specified rectangular
region.
|
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 for the specified band.
|
void |
setDataElements(int x,
int y,
int w,
int h,
java.lang.Object obj)
Stores an array of data elements into the specified rectangular region.
|
void |
setDataElements(int x,
int y,
java.lang.Object obj)
Stores the data elements for all bands at the specified location.
|
void |
setDataElements(int x,
int y,
java.awt.image.Raster inRaster)
Stores the Raster data at the specified location.
|
void |
setPixels(int x,
int y,
int w,
int h,
int[] iArray) |
void |
setRect(int dx,
int dy,
java.awt.image.Raster srcRaster) |
void |
setSample(int x,
int y,
int b,
int s) |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray) |
java.lang.String |
toString() |
createWritableTranslatedChild, getWritableParent, setPixel, setPixel, setPixel, setPixels, setPixels, setRect, setSample, setSample, setSamples, setSamples
createBandedRaster, createBandedRaster, createBandedRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createInterleavedRaster, createInterleavedRaster, createInterleavedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createRaster, createTranslatedChild, createWritableRaster, createWritableRaster, getBounds, getDataBuffer, getHeight, getMinX, getMinY, getNumBands, getNumDataElements, getParent, getPixel, getPixel, getPixel, getPixels, getPixels, getSampleDouble, getSampleFloat, getSampleModel, getSampleModelTranslateX, getSampleModelTranslateY, getSamples, getSamples, getTransferType, getWidth
protected int bandOffset
protected byte[] data
protected int[] dataOffsets
protected int pixelStride
protected int scanlineStride
public SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel, java.awt.image.DataBuffer paramDataBuffer, java.awt.Point origin)
public SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel, java.awt.image.DataBuffer paramDataBuffer, java.awt.Rectangle aRegion, java.awt.Point origin, java.awt.image.WritableRaster paramParent)
public SwtCompatibleRaster(java.awt.image.SampleModel paramSampleModel, java.awt.Point origin)
public java.awt.image.Raster createChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)
createChild
in class java.awt.image.Raster
x
- X offset.y
- Y offset.width
- Width (in pixels) of the subraster.height
- Height (in pixels) of the subraster.x0
- Translated X origin of the subraster.y0
- Translated Y origin of the subraster.bandList
- Array of band indices.java.awt.image.RasterFormatException
- if the specified bounding box is outside of the parent
raster.public java.awt.image.WritableRaster createCompatibleWritableRaster()
createCompatibleWritableRaster
in class java.awt.image.Raster
public java.awt.image.WritableRaster createCompatibleWritableRaster(int w, int h)
createCompatibleWritableRaster
in class java.awt.image.Raster
public java.awt.image.WritableRaster createWritableChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)
createWritableChild
in class java.awt.image.WritableRaster
x
- X offset.y
- Y offset.width
- Width (in pixels) of the subraster.height
- Height (in pixels) of the subraster.x0
- Translated X origin of the subraster.y0
- Translated Y origin of the subraster.bandList
- Array of band indices.java.awt.image.RasterFormatException
- if the specified bounding box is outside of the parent
Raster.public byte[] getByteData(int x, int y, int w, int h, byte[] outData)
byte[] bandData = raster.getByteData(x, y, w, h, null); int numDataElements = raster.getnumDataElements(); byte[] pixel = new byte[numDataElements]; // To find a data element at location (x2, y2) System.arraycopy(bandData, ((y2 - y) * w + (x2 - x)) * numDataElements, pixel, 0, numDataElements);
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.width
- Width of the pixel rectangle.height
- Height of the pixel rectangle.outData
- If non-null, data elements for all bands at the specified
location are returned in this array.public byte[] getByteData(int x, int y, int w, int h, int band, byte[] outData)
byte[] bandData = raster.getByteData(x, y, w, h, null); // To find the data element at location (x2, y2) byte bandElement = bandData[((y2 - y) * w + (x2 - x))];
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.width
- Width of the pixel rectangle.height
- Height of the pixel rectangle.band
- The band to return.outData
- If non-null, data elements for all bands at the specified
location are returned in this array.public java.lang.Object getDataElements(int x, int y, int w, int h, java.lang.Object obj)
byte[] bandData = (byte[]) raster.getDataElements(x, y, w, h, null); int numDataElements = raster.getNumDataElements(); byte[] pixel = new byte[numDataElements]; // To find a data element at location (x2, y2) System.arraycopy(bandData, ((y2 - y) * w + (x2 - x)) * numDataElements, pixel, 0, numDataElements);
getDataElements
in class java.awt.image.Raster
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.width
- Width of the pixel rectangle.height
- Height of the pixel rectangle.outData
- 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.public java.lang.Object getDataElements(int actualX, int actualY, java.lang.Object obj)
getDataElements
in class java.awt.image.Raster
actualX
- The X coordinate of the pixel location.actualY
- The Y coordinate of the pixel location.outData
- 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.public int getDataOffset(int band)
band
- The band whose offset is returned.public int[] getDataOffsets()
public byte[] getDataStorage()
public int[] getPixels(int x, int y, int w, int h, int[] iArray)
getPixels
in class java.awt.image.Raster
public int getPixelStride()
public int getSample(int x, int y, int b)
getSample
in class java.awt.image.Raster
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray)
getSamples
in class java.awt.image.Raster
public int getScanlineStride()
public void putByteData(int x, int y, int w, int h, byte[] inData)
inData[((y2 - y) * w + (x2 - x)) * numDataElements + n]
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.w
- Width of the pixel rectangle.h
- Height of the pixel rectangle.inData
- The data elements to be stored.public void putByteData(int x, int y, int w, int h, int band, byte[] inData)
inData[((y2 - y) * w + (x2 - x)) + n]
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.w
- Width of the pixel rectangle.h
- Height of the pixel rectangle.band
- The band to set.inData
- The data elements to be stored.public void setDataElements(int x, int y, int w, int h, java.lang.Object obj)
inData[((y2 - y) * w + (x2 - x)) * numDataElements + n]
setDataElements
in class java.awt.image.WritableRaster
x
- The X coordinate of the upper left pixel location.y
- The Y coordinate of the upper left pixel location.w
- Width of the pixel rectangle.h
- Height of the pixel rectangle.inData
- 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.public void setDataElements(int x, int y, java.lang.Object obj)
setDataElements
in class java.awt.image.WritableRaster
x
- The X coordinate of the pixel location.y
- The Y coordinate of the pixel location.inData
- An object reference to an array of type defined by
getTransferType() and length getNumDataElements() containing
the pixel data to place at x,y.public void setDataElements(int x, int y, java.awt.image.Raster inRaster)
setDataElements
in class java.awt.image.WritableRaster
x
- The X coordinate of the pixel location.y
- The Y coordinate of the pixel location.inRaster
- Raster of data to place at x,y location.public void setPixels(int x, int y, int w, int h, int[] iArray)
setPixels
in class java.awt.image.WritableRaster
public void setRect(int dx, int dy, java.awt.image.Raster srcRaster)
setRect
in class java.awt.image.WritableRaster
public void setSample(int x, int y, int b, int s)
setSample
in class java.awt.image.WritableRaster
public void setSamples(int x, int y, int w, int h, int b, int[] iArray)
setSamples
in class java.awt.image.WritableRaster
public java.lang.String toString()
toString
in class java.lang.Object