|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.image.Raster
![]()
![]()
![]()
java.awt.image.WritableRaster
public class WritableRaster

This class extends Raster to provide pixel writing capabilities. Refer to the class comment for Raster for descriptions of how a Raster stores pixels.
The constructors of this class are protected. To instantiate a WritableRaster, use one of the createWritableRaster factory methods in the Raster class.
| Field Summary |
|---|
Fields inherited from class java.awt.image.Raster ![]() |
|---|
dataBuffer |
| Constructor Summary | |
|---|---|
protected |
WritableRaster
Constructs a WritableRaster with the given SampleModel and DataBuffer. |
protected |
WritableRaster
Constructs a WritableRaster with the given SampleModel, DataBuffer, and parent. |
protected |
WritableRaster
Constructs a WritableRaster with the given SampleModel. |
| Method Summary | |
|---|---|
WritableRaster |
createWritableChild
Returns a new WritableRaster which shares all or part of this WritableRaster's DataBuffer. |
WritableRaster |
createWritableTranslatedChild
Create a WritableRaster with the same size, SampleModel and DataBuffer as this one, but with a different location. |
WritableRaster |
getWritableParent
Returns the parent WritableRaster (if any) of this WritableRaster, or else null. |
void |
setDataElements
Sets the data for a rectangle of pixels from a primitive array of type TransferType. |
void |
setDataElements
Sets the data for a single pixel from a primitive array of type TransferType. |
void |
setDataElements
Sets the data for a rectangle of pixels from an input Raster. |
void |
setPixel
Sets a pixel in the DataBuffer using a double array of samples for input. |
void |
setPixel
Sets a pixel in the DataBuffer using a float array of samples for input. |
void |
setPixel
Sets a pixel in the DataBuffer using an int array of samples for input. |
void |
setPixels
Sets all samples for a rectangle of pixels from a double array containing one sample per array element. |
void |
setPixels
Sets all samples for a rectangle of pixels from a float array containing one sample per array element. |
void |
setPixels
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. |
void |
setRect
Copies pixels from Raster srcRaster to this WritableRaster. |
void |
setRect
Copies pixels from Raster srcRaster to this WritableRaster. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. |
void |
setSamples
Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element. |
void |
setSamples
Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element. |
void |
setSamples
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Constructor Detail |
|---|

protected WritableRaster(SampleModel![]()
![]()
sampleModel, Point
![]()
![]()
origin)
sampleModel - The SampleModel that specifies the layout.origin - The Point that specifies the origin.
RasterFormatException

- if computing either
origin.x + sampleModel.getWidth() or
origin.y + sampleModel.getHeight() results
in integer overflow

protected WritableRaster(SampleModel![]()
![]()
sampleModel, DataBuffer
![]()
![]()
dataBuffer, Point
![]()
![]()
origin)
sampleModel - The SampleModel that specifies the layout.dataBuffer - The DataBuffer that contains the image data.origin - The Point that specifies the origin.
RasterFormatException

- if computing either
origin.x + sampleModel.getWidth() or
origin.y + sampleModel.getHeight() results
in integer overflow

protected WritableRaster(SampleModel![]()
![]()
sampleModel, DataBuffer
![]()
![]()
dataBuffer, Rectangle
![]()
![]()
aRegion, Point
![]()
![]()
sampleModelTranslate, WritableRaster
![]()
![]()
parent)
sampleModel - The SampleModel that specifies the layout.dataBuffer - The DataBuffer that contains the image data.aRegion - The Rectangle that specifies the image area.sampleModelTranslate - The Point that specifies the translation
from SampleModel to Raster coordinates.parent - The parent (if any) of this raster.
RasterFormatException

- if aRegion has width
or height less than or equal to zero, or computing either
aRegion.x + aRegion.width or
aRegion.y + aRegion.height results in integer
overflow| Method Detail |
|---|

public WritableRaster![]()
![]()
getWritableParent()
WritableRaster, or
null.

public WritableRaster![]()
![]()
createWritableTranslatedChild(int childMinX, int childMinY)
childMinX - X coord of the upper left corner of the new Raster.childMinY - Y coord of the upper left corner of the new Raster.
WritableRaster the same as this one except
for the specified location.
RasterFormatException

- if computing either
childMinX + this.getWidth() or
childMinY + this.getHeight() results in integer
overflow

public WritableRaster![]()
![]()
createWritableChild(int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[] bandList)
The parentX, parentY, width and height parameters form a Rectangle in this WritableRaster's coordinate space, indicating the area of pixels to be shared. An error will be thrown if this Rectangle is not contained with the bounds of the current WritableRaster.
The new WritableRaster may additionally be translated to a different coordinate system for the plane than that used by the current WritableRaster. The childMinX and childMinY parameters give the new (x, y) coordinate of the upper-left pixel of the returned WritableRaster; the coordinate (childMinX, childMinY) in the new WritableRaster will map to the same pixel as the coordinate (parentX, parentY) in the current WritableRaster.
The new WritableRaster may be defined to contain only a subset of the bands of the current WritableRaster, possibly reordered, by means of the bandList parameter. If bandList is null, it is taken to include all of the bands of the current WritableRaster in their current order.
To create a new WritableRaster that contains a subregion of the current WritableRaster, but shares its coordinate system and bands, this method should be called with childMinX equal to parentX, childMinY equal to parentY, and bandList equal to null.
parentX - X coordinate of the upper left corner in this
WritableRaster's coordinates.parentY - Y coordinate of the upper left corner in this
WritableRaster's coordinates.w - Width of the region starting at (parentX, parentY).h - Height of the region starting at (parentX, parentY).childMinX - X coordinate of the upper left corner of
the returned WritableRaster.childMinY - Y coordinate of the upper left corner of
the returned WritableRaster.bandList - Array of band indices, or null to use all bands.
WritableRaster sharing all or part of the
DataBuffer of this WritableRaster.
RasterFormatException

- if the subregion is outside of the
raster bounds.
RasterFormatException

- if w or
h
is less than or equal to zero, or computing any of
parentX + w, parentY + h,
childMinX + w, or
childMinY + h results in integer
overflow