|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejava.awt.image
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Constructs anClass AffineTransformOp, constructor AffineTransformOp(AffineTransform, int)AffineTransformOp
given an affine transform. The interpolation type is determined from theRenderingHints
object. If the interpolation hint is defined it will be used. Otherwise if the rendering quality hint is defined the interpolation type is determined from its value. If no hints are specified (hints
is null) the interpolation type is TYPE_NEAREST_NEIGHBOR @param xform TheAffineTransform
to use for the operation. @param hints TheRenderingHints
object used to specify the interpolation type for the operation. @throws ImagingOpException if the transform is non-invertible. @see java.awt.RenderingHints#KEY_INTERPOLATION @see java.awt.RenderingHints#KEY_RENDERING
Constructs anClass AffineTransformOp, int getInterpolationType()AffineTransformOp
given an affine transform and the interpolation type. @param xform TheAffineTransform
to use for the operation. @param interpolationType One of the integer interpolation type constants defined by this class: TYPE_NEAREST_NEIGHBOR TYPE_BILINEAR @throws ImagingOpException if the transform is non-invertible.
Returns the interpolation type used by this op. @return the interpolation type. @see #TYPE_NEAREST_NEIGHBOR @see #TYPE_BILINEARClass AffineTransformOp, Point2D getPoint2D(Point2D, Point2D)
Returns the location of the corresponding destination point given a point in the source. IfdstPt
is specified it is used to hold the return value. @param srcPt ThePoint2D
that represents the source point. @param dstPt ThePoint2D
in which to store the result. @return ThePoint2D
in the destination that corresponds to the specified point in the source.
An ImageFilter class for scaling images using a simple area averaging algorithm that produces smoother results than the nearest neighbor algorithm. This class extends the basic ImageFilter Class to scale an existing image and provide a source for a new image containing the resampled image. The pixels in the source image are blended to produce pixels for an image of the specified size. The blending process is analogous to scaling up the source image to a multiple of the destination size using pixel replication and then scaling it back down to the destination size by simply averaging all the pixels in the supersized image that fall within a given pixel of the destination image. If the data from the source is not delivered in TopDownLeftRight order then the filter will back off to a simple pixel replication behavior and utilize the requestTopDownLeftRightResend() method to refilter the pixels in a better way at the end. It is meant to be used in conjunction with a FilteredImageSource object to produce scaled versions of existing images. @see FilteredImageSource @see ReplicateScaleFilter @see ImageFilter @version 1.10 0211 12/0203/0001 @author Jim Graham
Transforms theClass BandCombineOp, Point2D getPoint2D(Point2D, Point2D)Raster
using the matrix specified in the constructor. AnIllegalArgumentException
may be thrown if the number of bands in the source or destination is incompatible with the matrix. See the class comments for more details.If the destination is null it will be created with a number of bands equalling the number of rows in the matrix. No exception is thrown if the operation causes a data overflow. @param src The
Raster
to be filtered. @paramdestdst TheRaster
in which to store the results of the filter operation. @return The filteredRaster
. @throws IllegalArgumentException If the number of bands in the source or destination is incompatible with the matrix.
Returns the location of the corresponding destination point given a point in the sourceRaster
. IfdstPt
is specified it is used to hold the return value. Since this is not a geometric operation the point returned is the same as the specifiedsrcPt
. @param srcPt ThePoint2D
that represents the point in the sourceRaster
@param dstPt ThePoint2D
in which to store the result. @return ThePoint2D
in the destination image that corresponds to the specified point in the source image.
This class represents image data which is stored in a band interleaved fashion and for which each sample of a pixel occupies one data element of the DataBuffer. It subclasses ComponentSampleModel but provides a more efficent implementation for accessing band interleaved image data than is provided by ComponentSampleModel. This class should typically be used when working with images which store sample data for each band in a different bank of the DataBuffer. Accessor methods are provided so that image data can be manipulated directly. Pixel stride is the number of data array elements between two samples for the same band on the same scanline. The pixel stride for a BandedSampleModel is one. 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. Band offsets denote the number of data array elements from the first data array element of the bank of the DataBuffer holding each band to the first sample of the band. The bands are numbered from 0 to N-1. Bank indices denote the correspondence between a bank of the data buffer and a band of image data. This class supports TYPE_BYTE TYPE_USHORT TYPE_SHORT TYPE_INT TYPE_FLOAT and TYPE_DOUBLE datatypesClass BandedSampleModel, constructor BandedSampleModel(int, int, int, int, int[], int[])
Constructs a BandedSampleModel with the specified parameters. The number of bands will be inferred from the lengths of the bandOffsets bankIndices arrays which must be equal. The pixel stride will be one data element. @param dataType The data type for storing samples. @param w The width (in pixels) of the region of image data described. @param h The height (in pixels) of the region of image data described. @paramClass BandedSampleModel, DataBuffer createDataBuffer()numBands The number of bands for the image data. @paramscanlineStride The line stride of the of the image data. @param bankIndices The bank index for each band. @param bandOffsets The band offset for each band. @throws IllegalArgumentException ifdataType
is not one of the supported data types
Creates a DataBuffer that corresponds to this BandedSampleModel The DataBuffer's data type number of banks and size will be consistent with this BandedSampleModel. @throws IllegalArgumentException ifClass BandedSampleModel, Object getDataElements(int, int, Object, DataBuffer)dataType
is noteitheroneDataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT orofDataBuffer.TYPE_SHORTtheorsupportedDataBuffertypes.TYPE_INT
Returns data for a single pixel in a primitive array of type TransferType. For a BandedSampleModel this will be the same as the data type and samples will be returned one per array element. Generally obj should be passed in as null so that the Object will be created automatically and will be of the right primitive data type.Class BandedSampleModel, int[] getPixel(int, int, int[], DataBuffer)The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by BandedSampleModelbsm1
to DataBufferdb2
whose storage layout is described by BandedSampleModelbsm2
. The transfer will generally be more efficient than using getPixel/setPixel.BandedSampleModel bsm1 bsm2; DataBufferInt db1 db2; bsm2.setDataElements(x y bsm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.If obj is non-null it should be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is non-null and is not large enough to hold the pixel data. @param x
The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param obj If non-null a primitive array in which to return the pixel data. @param data The DataBuffer containing the image data. @return the data for the specified pixel. @see #setDataElements(int int Object DataBuffer)
Returns all samples for the specified pixel in an int array. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, int[] getPixels(int, int, int, int, int[], DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples for the specified pixel. @see #setPixel(int int int[] DataBuffer)
Returns all samples for the specified rectangle of pixels in an int array one sample per data array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, int getSample(int, int, int, DataBuffer)The X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples for the pixels within the specified region. @see #setPixels(int int int int int[] DataBuffer)
Returns as int the sample in a specified band for the pixel located at (x y). ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, double getSampleDouble(int, int, int, DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to return.@param data The DataBuffer containing the image data @return the sample in the specified band for the specified pixel. @see #setSample(int int int int DataBuffer)
Returns the sample in a specified band for a pixel located at (x y) as a double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, float getSampleFloat(int, int, int, DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to return.@param data The DataBuffer containing the image data @return a double value that represents the sample in the specified band for the specified pixel.
Returns the sample in a specified band for the pixel located at (x y) as a float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, int[] getSamples(int, int, int, int, int, int[], DataBuffer)The X coordinate of the pixel location. @paramyThe Y coordinateThecoordinates of the pixel location.@param b The band to return.@param data The DataBuffer containing the image data @return a float value that represents the sample in the specified band for the specified pixel.
Returns the samples in a specified band for the specified rectangle of pixels in an int array one sample per data array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setDataElements(int, int, Object, DataBuffer)The X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param b The band to return.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples in the specified band for the pixels within the specified region. @see #setSamples(int int int int int int[] DataBuffer)
Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. For a BandedSampleModel this will be the same as the data type and samples are transferred one per array element.Class BandedSampleModel, void setPixel(int, int, int[], DataBuffer)The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by BandedSampleModelbsm1
to DataBufferdb2
whose storage layout is described by BandedSampleModelbsm2
. The transfer will generally be more efficient than using getPixel/setPixel.BandedSampleModel bsm1 bsm2; DataBufferInt db1 db2; bsm2.setDataElements(x y bsm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.obj must be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is not large enough to hold the pixel data. @param x
The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param obj If non-null returns the primitive array in this object.@param data The DataBuffer containing the image data.@see #getDataElements(int int Object DataBuffer)
Sets a pixel in the DataBuffer using an int array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setPixels(int, int, int, int, int[], DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param iArray The input samples in an int array.@param data The DataBuffer containing the image data.@see #getPixel(int int int[] DataBuffer)
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setSample(int, int, int, double, DataBuffer)The X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param iArray The input samples in an int array.@param data The DataBuffer containing the image data.@see #getPixels(int int int int int[] DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a double for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setSample(int, int, int, float, DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to set.@param s The input sample as a double.@param data The DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a float for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setSample(int, int, int, int, DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to set.@param s The input sample as a float.@param data The DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using an int for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass BandedSampleModel, void setSamples(int, int, int, int, int, int[], DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to set.@param s The input sample as an int.@param data The DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per data array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xThe X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param b The band to set.@param iArray The input sample array.@param data The DataBuffer containing the image data.@see #getSamples(int int int int int int[] DataBuffer)
Constructs a newClass BufferedImage, constructor BufferedImage(int, int, int, IndexColorModel)BufferedImage
with a specifiedColorModel
andRaster
. If the number and types of bands in theSampleModel
of theRaster
do not match the number and types required by theColorModel
to represent its color and alpha components a RasterFormatException is thrown. This method can multiply or divide the colorRaster
data by alpha to match thealphaPremultiplied
state in theColorModel
. Properties for thisBufferedImage
can be established by passing in a Hashtable ofString
/Object
pairs. @paramColorModelcmColorModel
for the new image @param rasterRaster
for the image data @param isRasterPremultiplied iftrue
the data in the raster has been premultiplied with alpha. @param propertiesHashtable
ofString
/Object
pairs. @exceptionRasterFormatException
if the number and types of bands in theSampleModel
of theRaster
do not match the number and types required by theColorModel
to represent its color and alpha components. @exceptionIllegalArgumentException
ifraster
is incompatible withcm
@see ColorModel @see Raster @see WritableRaster
Constructs aClass BufferedImage, Raster getData()BufferedImage
of one of the predefined image types: TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED.If the image type is TYPE_BYTE_BINARY the number of entries in the color model is used to determine whether the image should have 1 2 or 4 bits per pixel. If the color model has 1 or 2 entries the image will have 1 bit per pixel. If it has 3 or 4 entries the image with have 2 bits per pixel. If it has between 5 and 16 entries the image will have 4 bits per pixel. Otherwise an IllegalArgumentException will be thrown. @param width width of the created image @param height height of the created image @param imageType type of the created image @param cm
IndexColorModel
of the created image @throws IllegalArgumentException if the imageType is not TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED or if the imageType is TYPE_BYTE_BINARY and the color map has more than 16 entries. @see #TYPE_BYTE_BINARY @see #TYPE_BYTE_INDEXED
Returns the image as one large tile. TheClass BufferedImage, Raster getData(Rectangle)Raster
returned is a copy of the image data is not updated if the image is changed. @return aRaster
that is a copy of the image data. @see #setData(Raster)
Computes and returns an arbitrary region of theClass BufferedImage, int getRGB(int, int)BufferedImage
. TheRaster
returned is a copy of the image data and is not updated if the image is changed. @param rect the region of theBufferedImage
to be returned. @return aRaster
that is a copy of the image data of the specified region of theBufferedImage
@see #setData(Raster)
Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace. Color conversion takes place if this default model does not match the image ColorModel
. There are only 8-bits of precision for each color component in the returned data when using this method. @param x y the coordinates of the pixel from which to get the pixel in the default RGB color model and sRGB color space @return an integer pixel in the default RGB color model and default sRGB colorspace. @see #setRGB(int int int) @see #setRGB(int int int int int[] int int)
Class BufferedImage, int[] getRGB(int, int, int, int, int[], int, int)Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space from a portion of the image data. Color conversion takes place if the default model does not match the imageClass BufferedImage, void setData(Raster)ColorModel
. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x y) in the image the ARGB pixel can be accessed in this way:pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)];@param startXstartY the starting coordinates @param w width of region @param h height of region @param rgbArray if notnull
the rgb pixels are written here @param offset offset into thergbArray
@param scansize scanline stride for thergbArray
@return array of RGB pixels. @exceptionIllegalArgumentException
if an unknown datatype is specified @see #setRGB(int int int) @see #setRGB(int int int int int[] int int)
Sets a rectangular region of the image to the contents of the specifiedClass BufferedImage, void setRGB(int, int, int)Raster
r
which is assumed to be in the same coordinate space as theBufferedImage
. The operation is clipped to the bounds of theBufferedImage
. @param r the specifiedRaster
@see #getData @see #getData(Rectangle)
Sets a pixel in thisClass BufferedImage, void setRGB(int, int, int, int, int[], int, int)BufferedImage
to the specified RGB value. The pixel is assumed to be in the default RGB color model TYPE_INT_ARGB and default sRGB color space. For images with anIndexColorModel
the index with the nearest color is chosen. @param x y the coordinates of the pixel to set @param rgb the RGB value @see #getRGB(int int) @see #getRGB(int int int int int[] int int)
Sets an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space into a portion of the image data. Color conversion takes place if the default model does not match the imageClass BufferedImage, int TYPE_BYTE_BINARYColorModel
. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x y) in the this image the ARGB pixel can be accessed in this way:pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)];WARNING: No dithering takes place. @param startX startY the starting coordinates @param w width of the region @param h height of the region @param rgbArray the rgb pixels @param offset offset into thergbArray
@param scansize scanline stride for thergbArray
@see #getRGB(int int) @see #getRGB(int int int int int[] int int)
Represents an opaque byte-packedbinary1 2 or 4 bit image. The image has an IndexColorModel without alpha. When this type is used as theimageType
argument to theBufferedImage
constructor that takes animageType
argument but noColorModel
argumentanaIndexColorModel1-bit image is created with anIndexColorModel
with two colors in the default sRGBColorSpace
: {0 0 0} and {255 255 255}.Images with 2 or 4 bits per pixel may be constructed via the
BufferedImage
constructor that takes aColorModel
argument by supplying aColorModel
with an appropriate map size.Images with 8 bits per pixel should use the image types
TYPE_BYTE_INDEXED
orTYPE_BYTE_GRAY
depending on theirColorModel
.
Constructs aBufferedImageFilter
with the specified single-source/single-destination operator. @param op the specifiedBufferedImageOp
to use to filter aBufferedImage
@throws NullPointerException if op is null
This interface describes single-input/single-output operations performed onClass BufferedImageOp, BufferedImage createCompatibleDestImage(BufferedImage, ColorModel)BufferedImage
objects. It is implemented bysuch classes asAffineTransformOp
ConvolveOp
BandCombineOpColorConvertOp
RescaleOp
andLookupOp
. These objects can be passed into aBufferedImageFilter
to operate on aBufferedImage
in the ImageProducer-ImageFilter-ImageConsumer paradigm.This interface cannot be used to describe more sophisticated Ops such as
onesClasses thattake multiple sources. Each class implementingimplement this interfacewillmust specify whether or notittheywillallowanin-place filtering--operationfilter(i.e.operations where the source object is equal to the destination object).Note that theThis interface
restrictioncannot be used tosingle-inputdescribe more sophisticated operations such as those that take multiple sources. Note that this restriction also means that the values of the destination pixels prior to the operation are not used as input to the filter operation. @see BufferedImage @see BufferedImageFilter @see AffineTransformOp @see BandCombineOp @see ColorConvertOp @see ConvolveOp @see LookupOp @see RescaleOp @version 10 Feb 1997
Creates a zeroed destination image with the correct size and number of bands.Class BufferedImageOp, BufferedImage filter(BufferedImage, BufferedImage)TheAnIllegalArgumentException
may be thrown if the source image is incompatible with the types of images allowed by the class implementing this filter. @param srcSource imageTheforBufferedImage
the filterto beoperation.filtered @param destCMColorModel
of the destination. If null theColorModel
of the sourcewill beis used. @return The zeroed destination image.
Performs a single-input/single-output operation on aClass BufferedImageOp, Rectangle2D getBounds2D(BufferedImage)BufferedImage
. If the color models for the two images do not match a color conversion into the destination color modelwill beis performed. If the destination image is null aBufferedImage
with an appropriateColorModel
will beis created.TheAn
IllegalArgumentException
may be thrown if the source and/or destination image is incompatible with the types of images $ allowed by the class implementing this filter. @param src TheBufferedImage
to be filtered @param dest TheBufferedImage
in which to store the results$ @return The filteredBufferedImage
. @throws IllegalArgumentException If the source and/or destination image is not compatible with the types of images allowed by the class implementing this filter.
Returns the bounding box of the filtered destination image.Class BufferedImageOp, Point2D getPoint2D(Point2D, Point2D)TheAnIllegalArgumentException
may be thrown if the source image is incompatible with the types of images allowed by the class implementing this filter. @param src TheBufferedImage
to be filtered @return TheRectangle2D
representing the destination image's bounding box.
Returns the location of the corresponding destination point given a point in the source image. IfClass BufferedImageOp, RenderingHints getRenderingHints()dstPt
isnon-nullspecified itwill beis used to hold the return value. @param srcPt thePoint2D
that represents the point in the source image @param dstPt ThePoint2D
in which to store the result @return ThePoint2D
in the destination image that corresponds to the specified point in the source image.
Returns the rendering hints for thisBufferedImageOpoperation.Returns null@returnifThenoRenderingHints
hints have beenobject for thisset.BufferedImageOp
Constructs a new ColorConvertOp from two ColorSpace objects. The RenderingHints argument may be null. This Op is primarily useful for calling the filter method on Rasters in which case the two ColorSpaces define the operation to be performed on the Rasters. In that case the number of bands in the source Raster must match the number of components in srcCspace and the number of bands in the destination Raster must match the number of components in dstCspace. For BufferedImages the two ColorSpaces define intermediate spaces through which the source is converted before being converted to the destination space. @param srcCspace the sourceClass ColorConvertOp, constructor ColorConvertOp(ColorSpace, RenderingHints)ColorSpace
@param dstCspace the destinationColorSpace
@param hints theRenderingHints
object used to control the color conversion ornull
@throws NullPointerException if either srcCspace or dstCspace is null
Constructs a new ColorConvertOp from a ColorSpace object. The RenderingHints argument may be null. This Op can be used only with BufferedImages and is primarily useful when the BufferedImage filter} method is invoked with a destination argument of null. In that case the ColorSpace defines the destination color space for the destination created by the filter method. Otherwise the ColorSpace defines an intermediate space to which the source is converted before being converted to the destination space. @param cspace defines the destinationClass ColorConvertOp, constructor ColorConvertOp(ICC_Profile[], RenderingHints)ColorSpace
or an intermediateColorSpace
@param hints theRenderingHints
object used to control the color conversion ornull
@throws NullPointerException if cspace is null
Constructs a new ColorConvertOp from an array of ICC_Profiles. The RenderingHints argument may be null. The sequence of profiles may include profiles that represent color spaces profiles that represent effects etc. If the whole sequence does not represent a well-defined color conversion an exception is thrown.Class ColorConvertOp, BufferedImage createCompatibleDestImage(BufferedImage, ColorModel)For BufferedImages if the ColorSpace of the source BufferedImage does not match the requirements of the first profile in the array the first conversion is to an appropriate ColorSpace. If the requirements of the last profile in the array are not met by the ColorSpace of the destination BufferedImage the last conversion is to the destination's ColorSpace.
For Rasters the number of bands in the source Raster must match the requirements of the first profile in the array and the number of bands in the destination Raster must match the requirements of the last profile in the array. The array must have at least two elements or calling the filter method for Rasters will throw an IllegalArgumentException. @param profiles the array of
ICC_Profile
objects @param hints theRenderingHints
object used to control the color conversion ornull
@exception IllegalArgumentException when the profile sequence does not specify a well-defined color conversion @exception NullPointerException if profiles is null
Creates a zeroed destination image with the correct size and number of bands given this source. @param src Source image for the filter operation. @param destCM ColorModel of the destination. If null an appropriate ColorModel will be used. @return aBufferedImage
with the correct size and number of bands from the specifiedsrc
. @throws IllegalArgumentException ifdestCM
isnull
and thisColorConvertOp
was created without anyICC_Profile
orColorSpace
defined for the destination
TheClass ColorModel, constructor ColorModel(int, int[], ColorSpace, boolean, boolean, int, int)ColorModel
abstract class encapsulates the methods for translating a pixel value to color components (for example red green and blue) and an alpha component. In order to render an image to the screen a printer or another image pixel values must be converted to color and alpha components. As arguments to or return values from methods of this class pixels are represented as 32-bit ints or as arrays of primitive types. The number order and interpretation of color components for aColorModel
is specified by itsColorSpace
. AColorModel
used with pixel data that does not include alpha information treats all pixels as opaque which is an alpha value of 1.0.This
ColorModel
class supports two representations of pixel values. A pixel value can be a single 32-bit int or an array of primitive types. The Java(tm) Platform 1.0 and 1.1 APIs represented pixels as singlebyte
or singleint
values. For purposes of theColorModel
class pixel value arguments were passed as ints. The Java(tm) 2 Platform API introduced additional classes for representing images. With BufferedImage or RenderedImage objects based on Raster and SampleModel classes pixel values might not be conveniently representable as a single int. ConsequentlyColorModel
now has methods that accept pixel values represented as arrays of primitive types. The primitive type used by a particularColorModel
object is called its transfer type.
ColorModel
objects used with images for which pixel values are not conveniently representable as a single int throw an IllegalArgumentException when methods taking a single int pixel argument are called. Subclasses ofColorModel
must specify the conditions under which this occurs. This does not occur with DirectColorModel or IndexColorModel objects.Currently the transfer types supported by the Java 2D(tm) API are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT and DataBuffer.TYPE_
INTDOUBLE. Most rendering operations will perform much faster when using ColorModels and images based on the first three of these types. In addition some image filtering operations are not supported for ColorModels and images based on the latter three types. The transfer type for a particularColorModel
object is specified when the object is created either explicitly or by default. All subclasses ofColorModel
must specify what the possible transfer types are and how the number of elements in the primitive arrays representing pixels is determined.For
BufferedImages
the transfer type of itsRaster
and of theRaster
object'sSampleModel
(available from thegetTransferType
methods of these classes) must match that of theColorModel
. The number of elements in an array representing a pixel for theRaster
andSampleModel
(available from thegetNumDataElements
methods of these classes) must match that of theColorModel
.The algorithm used to convert from pixel values to color and alpha components varies by subclass. For example there is not necessarily a one-to-one correspondence between samples obtained from the
SampleModel
of aBufferedImage
object'sRaster
and color/alpha components. Even when there is such a correspondence the number of bits in a sample is not necessarily the same as the number of bits in the corresponding color/alpha component. Each subclass must specify how the translation from pixel values to color/alpha components is done.Methods in the
ColorModel
class use two different representations of color and alpha components - a normalized form and an unnormalized form. In the normalized form each component is afloat
value between some minimum and maximum values. For the alpha component the minimum is 0.0 and the maximum is 1.0. For color components the minimum and maximum values for each component can be obtained from theColorSpace
object. These values will often be 0.0 and 1.0 (e.g. normalized component values for the default sRGB color space range from 0.0 to 1.0) but some color spaces have component values with different upper and lower limits. These limits can be obtained using thegetMinValue
andgetMaxValue
methods of theColorSpace
class. Normalized color component values are not premultiplied. AllColorModels
must support the normalized form.In the unnormalized form each component is an unsigned integral value between 0 and 2n - 1 where n is the number of significant bits for a particular component. If pixel values for a particular
ColorModel
represent color samples premultiplied by the alpha sample unnormalized color component values are also premultiplied.In theThenormalizedunnormalized formeachis used only with instances ofColorModel
whoseColorSpace
has minimum componentisvalues of 0.0 for all components and maximum values of 1.0 for all components. The unnormalized form for color and alpha components can be a convenient representation for
floatColorModelsvaluewhose normalized component values all lie between 0.0 and 1.0.NormalizedIncolorsuch cases the integral value 0 maps to 0.0 and the value 2n - 1 maps to 1.0. In other cases such as when the normalized component valuesarecan be either negative or positive the unnormalized form is notpremultipliedconvenient. SuchColorModel
objects throw an IllegalArgumentException when methods involving an unnormalized argument are called. Subclasses ofColorModel
must specify the conditions under which this occurs. @see IndexColorModel @see ComponentColorModel @see PackedColorModel @see DirectColorModel @see java.awt.Image @see BufferedImage @see RenderedImage @see java.awt.color.ColorSpace @see SampleModel @see Raster @see DataBuffer @version 10 Feb 1997
Constructs aClass ColorModel, int[] getComponents(Object, int[], int)ColorModel
that translates pixel values to color/alpha components. Color components will be in the specifiedColorSpace
.pixel_bits
is the number of bits in the pixel values. The bits array specifies the number of significant bits per color and alpha component. Its length should be the number of components in theColorSpace
if there is no alpha information in the pixel values or one more than this number if there is alpha information.hasAlpha
indicates whether or not alpha information is present. Theboolean
isAlphaPremultiplied
specifies how to interpret pixel values in which color and alpha information are represented as separate spatial bands. If theboolean
istrue
color samples are assumed to have been multiplied by the alpha sample. Thetransparency
specifies what alpha values can be represented by this color model. The transfer type is the type of primitive array used to represent pixel values. Note that the bits array contains the number of significant bits per color/alpha component after the translation from pixel values. For example for anIndexColorModel
withpixel_bits
equal to 16 the bits array might have four elements with each element set to 8. @param pixel_bits the number of bits in the pixel values @param bits array that specifies the number of significant bits per color and alpha component @param cspace the specifiedColorSpace
@param hasAlphatrue
if alpha information is present;false
otherwise @param isAlphaPremultipliedtrue
if color samples are assumed to be premultiplied by the alpha samples;false
otherwise @param transparency what alpha values can be represented by this color model @param transferType the type of the array used to represent pixel values @throws IllegalArgumentException if the length of the bit array is less than the number of color or alpha components in thisColorModel
or if the transparency is not a valid value. @throws IllegalArgumentException if the sum of the number of bits inbits
is less than 1 or if any of the elements inbits
is less than 0. @see java.awt.Transparency
Returns an array of unnormalized color/alpha components given a pixel in thisClass ColorModel, int[] getComponents(int, int[], int)ColorModel
. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. Ifpixel
is not a primitive array of type transferType aClassCastException
is thrown. AnIllegalArgumentException
will be thrown if color component values for thisColorModel
are not conveniently representable in the unnormalized form. AnArrayIndexOutOfBoundsException
is thrown ifpixel
is not large enough to hold a pixel value for thisColorModel
. This method can be used to retrieve the components for a specific pixel value in anyColorModel
. If the components array isnull
a new array will be allocated. The components array will be returned. Color/alpha components are stored in thecomponents
array starting atoffset
(even if the array is allocated by this method). AnArrayIndexOutOfBoundsException
is thrown if the components array is notnull
and is not large enough to hold all the color and alpha components (starting atoffset
). SinceColorModel
is an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException
. @param pixel the specified pixel @param components an array that receives the color and alpha components of the specified pixel @param offset the index into thecomponents
array at which to begin storing the color and alpha components of the specified pixel @return an array containing the color and alpha components of the specified pixel starting at the specified offset. @throws UnsupportedOperationException if this method is not supported by thisColorModel
Returns an array of unnormalized color/alpha components given a pixel in thisClass ColorModel, float[] getNormalizedComponents(int[], int, float[], int)ColorModel
. The pixel value is specified as anint
. AnIllegalArgumentException
will be thrown if pixel values for thisColorModel
are not conveniently representable as a singleint
or if color component values for thisColorModel
are not conveniently representable in the unnormalized form. For example this method can be used to retrieve the components for a specific pixel value in aDirectColorModel
. If the components array isnull
a new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting atoffset
(even if the array is allocated by this method). AnArrayIndexOutOfBoundsException
is thrown if the components array is notnull
and is not large enough to hold all the color and alpha components (starting at offset). SinceColorModel
is an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException
. @param pixel the specified pixel @param components the array to receive the color and alpha components of the specified pixel @param offset the offset into thecomponents
array at which to start storing the color and alpha components @return an array containing the color and alpha components of the specified pixel starting at the specified offset. @throws UnsupportedOperationException if this method is not supported by thisColorModel
Returns an array of all of the color/alpha components in normalized form given an unnormalized component array. Unnormalized components are unsigned integral values between 0 and 2n - 1 where n is the number of bits for a particular component. Normalized components are float values betweenClass ColorModel, int[] getUnnormalizedComponents(float[], int, int[], int)0.0a per component minimum and1maximum specified by theColorSpace
object for thisColorModel
.0AnIllegalArgumentException
will be thrown if color component values for thisColorModel
are not conveniently representable in the unnormalized form. If thenormComponents
array isnull
a new array will be allocated. ThenormComponents
array will be returned. Color/alpha components are stored in thenormComponents
array starting atnormOffset
(even if the array is allocated by this method). AnArrayIndexOutOfBoundsException
is thrown if thenormComponents
array is notnull
and is not large enough to hold all the color and alpha components (starting atnormOffset
). AnIllegalArgumentException
is thrown if thecomponents
array is not large enough to hold all the color and alpha components starting atoffset
.Since
ColorModel
is an abstract class any instance is an instance of a subclass. The default implementation of this method in this abstract class assumes that component values for this class are conveniently representable in the unnormalized form. Therefore subclasses which may have instances which do not support the unnormalized form must override this method. @param components an array containing unnormalized components @param offset the offset into thecomponents
array at which to start retrieving unnormalized components @param normComponents an array that receives thecomponents fromnormalized components @param normOffset the index intonormComponents
at which to begin storingunnormalized components fromnormalized components @return an array containing normalized color and alpha components. @throws IllegalArgumentException If the component values for thisColorModel
are not conveniently representable in the unnormalized form. @throws UnsupportedOperationException if the constructor of thisColorModel
called thesuper(bits)
constructor but did not override this method. See the constructor #ColorModel(int) @throws UnsupportedOperationException if this method is unable to determine the number of bits per component
Returns an array of all of the color/alpha components in unnormalized form given a normalized component array. Unnormalized components are unsigned integral values between 0 and 2n - 1 where n is the number of bits for a particular component. Normalized components are float values between0.0a per component minimum and1maximum specified by theColorSpace
object for thisColorModel
.0AnIllegalArgumentException
will be thrown if color component values for thisColorModel
are not conveniently representable in the unnormalized form. If thecomponents
array isnull
a new array will be allocated. Thecomponents
array will be returned. Color/alpha components are stored in thecomponents
array starting atoffset
(even if the array is allocated by this method). AnArrayIndexOutOfBoundsException
is thrown if thecomponents
array is notnull
and is not large enough to hold all the color and alpha components (starting atoffset
). AnIllegalArgumentException
is thrown if thenormComponents
array is not large enough to hold all the color and alpha components starting atnormOffset
. @param normComponents an array containing normalized components @param normOffset the offset into thenormComponents
array at which to start retrieving normalized components @param components an array that receives the components fromnormComponents
@param offset the index intocomponents
at which to begin storing normalized components fromnormComponents
@return an array containing unnormalized color and alpha components. @throws IllegalArgumentException If the component values for thisColorModel
are not conveniently representable in the unnormalized form. @throws IllegalArgumentException if the length ofnormComponents
minusnormOffset
is less thannumComponents
@throws UnsupportedOperationException if the constructor of thisColorModel
called thesuper(bits)
constructor but did not override this method. See the constructor #ColorModel(int)
AClass ComponentColorModel, constructor ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)ColorModel
class that works with pixel values that represent color and alpha information as separate samples and that store each sample in a separate data element. This class can be used with an arbitraryColorSpace
. The number of color samples in the pixel values must be same as the number of color components in theColorSpace
. There may be a single alpha sample.For those methods that use a primitive array pixel representation of type
transferType
the array length is the same as the number of color and alpha samples. Color samples are stored first in the array followed by the alpha sample if present. The order of the color samples is specified by theColorSpace
. Typically this order reflects the name of the color space type. For example forTYPE_RGB
index 0 corresponds to red index 1 to green and index 2 to blue.The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT.The translation from pixel sample values to color/alpha components for display or processing purposes is based on a one-to-one correspondence of samples to components. Depending on the transfer type used to create an instance of
ComponentColorModel
the pixel sample values represented by that instance may be signed or unsigned and may be of integral type or float or double (see below for details). The translation from sample values to normalized color/alpha components must follow certain rules. For float and double samples the translation is an identity i.e. normalized component values are equal to the corresponding sample values. For integral samples the translation should be only a simple scale and offset where the scale and offset constants may be different for each component. The result of applying the scale and offset constants is a set of color/alpha component values which are guaranteed to fall within a certain range. Typically the range for a color component will be the range defined by thegetMinValue
andgetMaxValue
methods of theColorSpace
class. The range for an alpha component should be 0.0 to 1.0.Instances of
The number of bits in a color or alpha sample of a pixel value might not be the same as the number of bits for the corresponding color or alphaComponentColorModel
created with transfer typesDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
andDataBuffer.TYPE_INT
have pixel sample values which are treated as unsigned integral values.componentsample passed to theComponentColorModel(ColorSpace int[] boolean boolean int int)
constructor.ThisIn that case this class assumes that the least significant n bits of a sample value hold the component value where n is the number of significant bits for the component passed to the constructor. It also assumes that any higher-order bits in a sample value are zero. Thus sample values range from 0 to 2n - 1. This class maps these sample values to normalized color component values such that 0 maps to the value obtained from theColorSpace's
getMinValue
method for each component and 2n - 1 maps to the value obtained fromgetMaxValue
. To create aComponentColorModel
with a different color sample mapping requires subclassing this class and overriding thegetNormalizedComponents(Object float[] int)
method. The mapping for an alpha sample always maps 0 to 0.0 and 2n - 1 to 1.0.For instances with unsigned sample values the unnormalized color/alpha component representation is only supported if two conditions hold. First sample value value 0 must map to normalized component value 0.0 and sample value 2n - 1 to 1.0. Second the min/max range of all color components of the
ColorSpace
must be 0.0 to 1.0. In this case the component representation is the n least significant bits of the corresponding sample. Thus each component is an unsigned integral value between 0 and 2n - 1 where n is the number of significant bits for a particular component. If these conditions are not met any method taking an unnormalized component argument will throw anIllegalArgumentException
.Instances of
ComponentColorModel
created with transfer typesDataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
andDataBuffer.TYPE_DOUBLE
have pixel sample values which are treated as signed short float or double values. Such instances do not support the unnormalized color/alpha component representation so any methods taking such a representation as an argument will throw anIllegalArgumentException
when called on one of these instances. The normalized component values of instances of this class have a range which depends on the transfer type as follows: for float samples the full range of the float data type; for double samples the full range of the float data type (resulting from casting double to float); for short samples from approximately -maxVal to +maxVal where maxVal is the per component maximum value for theColorSpace
(-32767 maps to -maxVal 0 maps to 0.0 and 32767 maps to +maxVal). A subclass may override the scaling for short sample values to normalized component values by overriding thegetNormalizedComponents(Object float[] int)
method. For float and double samples the normalized component values are taken to be equal to the corresponding sample values and subclasses should not attempt to add any non-identity scaling for these transfer types.Instances of
ComponentColorModel
created with transfer typesDataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
andDataBuffer.TYPE_DOUBLE
use all the bits of all sample values. Thus all color/alpha components have 16 bits when usingDataBuffer.TYPE_SHORT
32 bits when usingDataBuffer.TYPE_FLOAT
and 64 bits when usingDataBuffer.TYPE_DOUBLE
. When theComponentColorModel(ColorSpace int[] boolean boolean int int)
form of constructor is used with one of these transfer types the bits array argument is ignored.It is possible to have color/alpha sample values which cannot be reasonably interpreted as component values for rendering. This can happen when
ComponentColorModel
is subclassed to override the mapping of unsigned sample values to normalized color component values or when signed sample values outside a certain range are used. (As an example specifying an alpha component as a signed short value outside the range 0 to 32767 normalized range 0.0 to 1.0 can lead to unexpected results.) It is the responsibility of applications to appropriately scale pixel data before rendering such that color components fall within the normalized range of theColorSpace
(obtained using thegetMinValue
andgetMaxValue
methods of theColorSpace
class) and the alpha component is between 0.0 and 1.0. If color or alpha component values fall outside these ranges rendering results are indeterminate.Methods that use a single int pixel representation throw an
IllegalArgumentException
unless the number of components for theComponentColorModel
is one and the component value is unsigned -- in other words a single color component using a transfer type ofDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
and no alpha.A
ComponentColorModel
can be used in conjunction with aComponentSampleModel
aBandedSampleModel
or aPixelInterleavedSampleModel
to construct aBufferedImage
. @see ColorModel @see ColorSpace @see ComponentSampleModel @see BandedSampleModel @see PixelInterleavedSampleModel @see BufferedImage @version 10 Feb 1997
Constructs aClass ComponentColorModel, ColorModel coerceData(WritableRaster, boolean)ComponentColorModel
from the specified parameters. Color components will be in the specifiedColorSpace
. The supported transfer types areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
andDataBuffer.TYPE_DOUBLE
. If not null thebits
array specifies the number of significant bits per color and alpha component.andItsits length should be at least the number of components in theColorSpace
if there is no alpha information in the pixel values or one more than this number if there is alpha information.AnWhen theis
IllegalArgumentExceptiontransferTypethrown ifDataBuffer.TYPE_SHORT
theDataBuffer.TYPE_FLOAT
lengthorofDataBuffer.TYPE_DOUBLE
thearray does not matchbits
the number of componentsarray argument is ignored.hasAlpha
indicates whether alpha information is present. IfhasAlpha
is true then the booleanisAlphaPremultiplied
specifies how to interpret color and alpha samples in pixel values. If the boolean is true color samples are assumed to have been multiplied by the alpha sample. Thetransparency
specifies what alpha values can be represented by this color model. The acceptabletransparency
values areOPAQUE
BITMASK
orTRANSLUCENT
. ThetransferType
is the type of primitive array used to represent pixel values.Note@paramthat thecolorSpace The
bitsColorSpacearrayassociated withcontainsthisthecolor model. @param bits The number of significant bits percolor/alphacomponent.after the translation from pixelMay be null in whichvalues.case@paramallcolorSpace Thebits ofColorSpaceallassociated with this color modelcomponent samples will be significant.@paramIgnoredbits Theif transferTypenumberis one ofsignificantDataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_DOUBLE
in which case all bitsperof all component samples will be significant. @param hasAlpha If true this color model supports alpha. @param isAlphaPremultiplied If true alpha is premultiplied. @param transparency Specifies what alpha values can be represented by this color model. @param transferType Specifies the type of primitive array used to represent pixel values. @throws IllegalArgumentException If thelength of thebits
arraydoesargument is notmatchnull its length is less than the number of color and alpha components and transferType is one ofDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
. @throws IllegalArgumentException If transferType is not one ofDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_DOUBLE
. @see ColorSpace @see java.awt.Transparency
Forces the raster data to match the state specified in theClass ComponentColorModel, int getAlpha(Object)isAlphaPremultiplied
variable assuming the data is currently correctly described by thisColorModel
. It may multiply or divide the color raster data by alpha or do nothing if the data is in the correct state. If the data needs to be coerced this method also returns an instance of thisColorModel
with theisAlphaPremultiplied
flag set appropriately. SinceColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @throws NullPointerException ifraster
isnull
and data coercion is required. @throws UnsupportedOperationException if the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
.INTDOUBLE
Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified by an array of data elements of typeClass ComponentColorModel, int getAlpha(int)transferType
passed in as an object reference. SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param inData The pixel from which you want to get the alpha component specified by an array of data elements of typetransferType
. @return The alpha component for the specified pixel as an int. @throws ClassCastException IfinData
is not a primitive array of typetransferType
. @throws ArrayIndexOutOfBoundsException ifinData
is not large enough to hold a pixel value for thisColorModel
. @throws UnsupportedOperationException If the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
.INTDOUBLE
Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified as an int. @param pixel The pixel from which you want to get the alpha component. @return The alpha component for the specified pixel as an int. @throws IllegalArgumentException If there is more than one component in thisClass ComponentColorModel, int getBlue(Object)ColorModel
. @throws IllegalArgumentException If the component value for thisColorModel
is signed
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGBClass ComponentColorModel, int getBlue(int)ColorSpace
sRGB. A color conversion is done if necessary. Thepixel
value is specified by an array of data elements of typetransferType
passed in as an object reference. The returned value is a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the blue value will be 0). SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param inData The pixel from which you want to get the blue color component specified by an array of data elements of typetransferType
. @return The blue color component for the specified pixel as an int. @throws ClassCastException IfinData
is not a primitive array of typetransferType
. @throws ArrayIndexOutOfBoundsException ifinData
is not large enough to hold a pixel value for thisColorModel
. @throws UnsupportedOperationException If the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
.INTDOUBLE
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value will be a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the blue value will be 0). @param pixel The pixel from which you want to get the blue color component. @return The blue color component for the specified pixel as an int. @throws IllegalArgumentException If there is more than one component in thisClass ComponentColorModel, int[] getComponents(Object, int[], int)ColorModel
. @throws IllegalArgumentException If the component value for thisColorModel
is signed
Returns an array of unnormalized color/alpha components given a pixel in thisClass ComponentColorModel, int[] getComponents(int, int[], int)ColorModel
. The pixel value is specified by an array of data elements of typetransferType
passed in as an object reference. An IllegalArgumentException is thrown if the component values for thisColorModel
are not conveniently representable in the unnormalized form. Color/alpha components are stored in thecomponents
array starting atoffset
(even if the array is allocated by this method). SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then this method might throw an exception if they use an unsupportedtransferType
. @param pixel A pixel value specified by an array of data elements of typetransferType
. @param components An integer array in which to store the unnormalized color/alpha components. If thecomponents
array is null a new array is allocated. @param offset An offset into thecomponents
array. @return Thecomponents
array. @throws IllegalArgumentException If thisComponentColorModel
does not support the unnormalized form @throws UnsupportedOperationException in some cases iff the transfer type of thisComponentColorModel
is not one of thesupportedfollowing transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
. @throws ClassCastException Ifpixel
is not a primitive array of typetransferType
. @throws IllegalArgumentException If thecomponents
array is not null and is not large enough to hold all the color and alpha components (starting at offset) or ifpixel
is not large enough to hold a pixel value for this ColorModel.
Returns an array of unnormalized color/alpha components given a pixel in thisClass ComponentColorModel, int getGreen(Object)ColorModel
. An IllegalArgumentException is thrown if the component value for thisColorModel
is not conveniently representable in the unnormalized form. Color/alpha components are stored in thecomponents
array starting atoffset
(even if the array is allocated by this method). @param pixel The pixel value specified as an integer. @param components An integer array in which to store the unnormalized color/alpha components. If thecomponents
array is null a new array is allocated. @param offset An offset into thecomponents
array. @return The components array. @throws IllegalArgumentException If there is more than one component in thisColorModel
. @throws IllegalArgumentException If thisColorModel
does not support the unnormalized form @throws ArrayIndexOutOfBoundsException If thecomponents
array is not null and is not large enough to hold all the color and alpha components (starting at offset).
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGBClass ComponentColorModel, int getGreen(int)ColorSpace
sRGB. A color conversion is done if necessary. Thepixel
value is specified by an array of data elements of typetransferType
passed in as an object reference. The returned value is a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the green value will be 0). SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param inData The pixel from which you want to get the green color component specified by an array of data elements of typetransferType
. @return The green color component for the specified pixel as an int. @throws ClassCastException IfinData
is not a primitive array of typetransferType
. @throws ArrayIndexOutOfBoundsException ifinData
is not large enough to hold a pixel value for thisColorModel
. @throws UnsupportedOperationException If the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
.INTDOUBLE
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value will be a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the green value will be 0). @param pixel The pixel from which you want to get the green color component. @return The green color component for the specified pixel as an int. @throws IllegalArgumentException If there is more than one component in thisClass ComponentColorModel, int getRGB(Object)ColorModel
. @throws IllegalArgumentException If the component value for thisColorModel
is signed
Returns the color/alpha components for the specified pixel in the default RGB color model format. A color conversion is done if necessary. The pixel value is specified by an array of data elements of typeClass ComponentColorModel, int getRGB(int)transferType
passed in as an object reference. The returned value is in a non pre-multiplied format. If the alpha is premultiplied this method divides it out of the color components (if the alpha value is 0 the color values will be 0). SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param inData The pixel from which you want to get the color/alpha components specified by an array of data elements of typetransferType
. @return The color/alpha components for the specified pixel as an int. @throws ClassCastException IfinData
is not a primitive array of typetransferType
. @throws ArrayIndexOutOfBoundsException ifinData
is not large enough to hold a pixel value for thisColorModel
. @throws UnsupportedOperationException If the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
. @see ColorModel#getRGBdefaultINTDOUBLE
Returns the color/alpha components of the pixel in the default RGB color model format. A color conversion is done if necessary. The returned value will be in a non pre-multiplied format. If the alpha is premultiplied this method divides it out of the color components (if the alpha value is 0 the color values will be 0). @param pixel The pixel from which you want to get the color/alpha components. @return The color/alpha components for the specified pixel as an int. @throws IllegalArgumentException If there is more than one component in thisClass ComponentColorModel, int getRed(Object)ColorModel
. @throws IllegalArgumentException If the component value for thisColorModel
is signed
Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. A color conversion is done if necessary. TheClass ComponentColorModel, int getRed(int)pixel
value is specified by an array of data elements of typetransferType
passed in as an object reference. The returned value will be a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the red value will be 0). SinceComponentColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param inData The pixel from which you want to get the red color component specified by an array of data elements of typetransferType
. @return The red color component for the specified pixel as an int. @throws ClassCastException IfinData
is not a primitive array of typetransferType
. @throws ArrayIndexOutOfBoundsException ifinData
is not large enough to hold a pixel value for thisColorModel
. @throws UnsupportedOperationException If the transfer type of thisComponentColorModel
is not one of the supported transfer types:DataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
DataBuffer.TYPE_INT
DataBuffer.TYPE_SHORT
DataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_
.INTDOUBLE
Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value will be a non pre-multiplied value. If the alpha is premultiplied this method divides it out before returning the value (if the alpha value is 0 the red value will be 0). @param pixel The pixel from which you want to get the red color component. @return The red color component for the specified pixel as an int. @throws IllegalArgumentException If there is more than one component in thisClass ComponentColorModel, int[] getUnnormalizedComponents(float[], int, int[], int)ColorModel
. @throws IllegalArgumentException If the component value for thisColorModel
is signed
Returns an array of all of the color/alpha components in unnormalized form given a normalized component array. Unnormalized components are unsigned integral values between 0 and 2n - 1 where n is the number of bits for a particular component. Normalized components are float values between0.0a per component minimum and1maximum specified by theColorSpace
object for thisColorModel
.0AnIllegalArgumentException
will be thrown if color component values for thisColorModel
are not conveniently representable in the unnormalized form. If thecomponents
array isnull
a new array will be allocated. Thecomponents
array will be returned. Color/alpha components are stored in thecomponents
array starting atoffset
(even if the array is allocated by this method). AnArrayIndexOutOfBoundsException
is thrown if thecomponents
array is notnull
and is not large enough to hold all the color and alpha components (starting atoffset
). AnIllegalArgumentException
is thrown if thenormComponents
array is not large enough to hold all the color and alpha components starting atnormOffset
. @param normComponents an array containing normalized components @param normOffset the offset into thenormComponents
array at which to start retrieving normalized components @param components an array that receives the components fromnormComponents
@param offset the index intocomponents
at which to begin storing normalized components fromnormComponents
@return an array containing unnormalized color and alpha components. @throws IllegalArgumentExceptionif the lengthIfofthisnormComponentsComponentColorModel
minusdoesnormOffsetnotis less thansupport the unnormalizednumComponentsform @throwsUnsupportedOperationExceptionIllegalArgumentException if theconstructorlength ofthis
ColorModelnormComponentscalled theminus
super(bits)normOffsetconstructor but did not override this method. Seeisthe constructorless than#ColorModel(int)numComponents
This class represents image data which is stored such that each sample of a pixel occupies one data element of the DataBuffer. It stores the N samples which make up a pixel in N separate data array elements. Different bands may be in different banks of the DataBuffer. Accessor methods are provided so that image data can be manipulated directly. This class can support different kinds of interleaving e.g. band interleaving scanline interleaving and pixel interleaving. Pixel stride is the number of data array elements between two samples for the same band on the same scanline. 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. Band offsets denote the number of data array elements from the first data array element of the bank of the DataBuffer holding each band to the first sample of the band. The bands are numbered from 0 to N-1. This class can represent image data for which each sample is an unsigned integral number which can be stored in 8 16 or 32 bits (Class ComponentSampleModel, constructor ComponentSampleModel(int, int, int, int, int, int[])allusingDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
respectively) data for which each sample is a signed integral number which can be stored in 16 bits (usingDataBuffer.TYPE_SHORT
) or data for which each sample is a signed float or double quantity (usingDataBuffer.TYPE_FLOAT
orDataBuffer.TYPE_DOUBLE
respectively). All samples of a given ComponentSampleModel are stored with the same precision). All strides and offsets must be non-negative. This class supports TYPE_BYTE TYPE_USHORT TYPE_SHORT TYPE_INT TYPE_FLOAT TYPE_DOUBLE @see java.awt.image.PixelInterleavedSampleModel @see java.awt.image.BandedSampleModel
Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. All bands will be stored in the first bank of the DataBuffer. @param dataTypeClass ComponentSampleModel, constructor ComponentSampleModel(int, int, int, int, int, int[], int[])Thethe data type for storing samples.@param wThethe width (in pixels) of the region of image data described.@param hThethe height (in pixels) of the region of image data described.@param pixelStrideThethe pixel stride of the region of image data described.@param scanlineStrideThethe line stride of the region of image data described.@param bandOffsetsThethe offsets of all bands.@throws IllegalArgumentException ifw
orh
is not greater than 0 @throws IllegalArgumentException ifpixelStride
is less than 0 @throws IllegalArgumentException ifscanlineStride
is less than 0 @throws IllegalArgumentException ifnumBands
is less than 1 @throws IllegalArgumentException if the product ofw
andh
is greater thanInteger.MAX_VALUE
@throws IllegalArgumentException ifdataType
is not one of the supported data types
Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. Different bands may be stored in different banks of the DataBuffer. @param dataTypeClass ComponentSampleModel, SampleModel createCompatibleSampleModel(int, int)Thethe data type for storing samples.@param wThethe width (in pixels) of the region of image data described.@param hThethe height (in pixels) of the region of image data described.@param pixelStrideThethe pixel stride of the region of image data described.@param scanlineStride The line stride of the region of image data described.@parambandIndices ThebankIndices the bank indices of all bands.@param bandOffsetsThethe band offsets of all bands.@throws IllegalArgumentException ifw
orh
is not greater than 0 @throws IllegalArgumentException ifpixelStride
is less than 0 @throws IllegalArgumentException ifscanlineStride
is less than 0 @throws IllegalArgumentException if the length ofbankIndices
does not equal the length ofbankOffsets
@throws IllegalArgumentException if any of the bank indices ofbandIndices
is less than 0 @throws IllegalArgumentException ifdataType
is not one of the supported data types
Creates a newClass ComponentSampleModel, DataBuffer createDataBuffer()ComponentSampleModel
with the specified width and height. The newSampleModel
will have the same number of bands storage data type interleaving scheme and pixel stride as thisSampleModel
. @param w the width of the resultingSampleModel
@param h the height of the resultingSampleModel
@return a newComponentSampleModel
with the specified size @throws IllegalArgumentException ifw
orh
is not greater than 0
Creates aClass ComponentSampleModel, SampleModel createSubsetSampleModel(int[])DataBuffer
that corresponds to thisComponentSampleModel
. TheDataBuffer
object's data type number of banks and sizewillare be consistent with thisComponentSampleModel
. @return aDataBuffer
whose data type number of banks and size are consistent with thisComponentSampleModel
.
Class ComponentSampleModel, int[] getBandOffsets()ThisCreatescreatesa new ComponentSampleModel with a subset of the bands of this ComponentSampleModel. The new ComponentSampleModel can be used with any DataBuffer that the existing ComponentSampleModel can be used with. The new ComponentSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original ComponentSampleModel/DataBuffer combination. @param bands a subset of bands from thisComponentSampleModel
@return aComponentSampleModel
created with a subset of bands from thisComponentSampleModel
.
Returns the band offset for all bands. @return the band offsets for all bands.Class ComponentSampleModel, int[] getBankIndices()
Returns the bank indices for all bands. @return the bank indices for all bands.Class ComponentSampleModel, Object getDataElements(int, int, Object, DataBuffer)
Returns data for a single pixel in a primitive array of typeClass ComponentSampleModel, int getNumDataElements()TransferType
. For aComponentSampleModel
thiswill beis the same as the data type and sampleswill beare returned one per array element. Generallyobj
should be passed in asnull
so that theObject
willbeis created automatically andwill be ofis the right primitive data type.The following code illustrates transferring data for one pixel from
DataBuffer
db1
whose storage layout is described byComponentSampleModel
csm1
toDataBuffer
db2
whose storage layout is described byComponentSampleModel
csm2
. The transferwill generallyisbeusually more efficient than usinggetPixel
and/setPixel.
ComponentSampleModel csm1 csm2; DataBufferInt db1 db2; csm2.setDataElements(x y csm1.getDataElements(x y null db1) db2);UsinggetDataElements
and/setDataElements to transfer between two
DataBuffer/SampleModel
pairs is legitimate if theSampleModelsSampleModel
objects have the same number of bands corresponding bands have the same number of bits per sample and theTransferTypesTransferType
s are the same.If
obj
isnon-notnull it should be a primitive array of type
TransferType
. Otherwise aClassCastException
is thrown. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds or ifobj
isnon-notnull and is not large enough to hold the pixel data. @param x
The X coordinate of the pixel location. @paramyThe Ythecoordinatecoordinates of the pixel location.@param objIfif non-null
a primitive array in which to return the pixel data.@param dataThetheDataBuffer
containing the image data @return the data of the specified pixel @see #setDataElements(int int Object DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if obj is too small to hold the ouput.
Returns the number of data elements needed to transfer a pixelClass ComponentSampleModel, int getOffset(int, int)viawith thegetDataElementsin Object DataBuffer) } andsetDataElementsin Object DataBuffer) } methods. For aComponentSampleModel
this is identical to the number of bands. @return the number of data elements needed to transfer a pixel with thegetDataElements
andsetDataElements
methods. @see java.awt.image.SampleModel#getNumDataElements @see #getNumBands
Gets the offset for the first band of pixel (x y). A sample of the first band can be retrieved from aClass ComponentSampleModel, int getOffset(int, int, int)DataBuffer
data
with aComponentSampleModel
csm
asdata.getElem(csm.getOffset(x y));@param x y the location of the pixel @return the offset for the first band of the specified pixel.
Gets the offset for band b of pixel (x y). A sample of bandClass ComponentSampleModel, int[] getPixel(int, int, int[], DataBuffer)b
can be retrieved from aDataBuffer
data
with aComponentSampleModel
csm
asdata.getElem(csm.getOffset(x y b));@param x y the location of the specified pixel @param b the specified band @return the offset for the specified band of the specified pixel.
Returns all samples for the specified pixel in an int array one sample per array element. AnClass ComponentSampleModel, int getPixelStride()ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples of the specified pixel. @see #setPixel(int int int[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the output.
Returns the pixel stride of this ComponentSampleModel. @return the pixel stride of this ComponentSampleModel
.
Class ComponentSampleModel, int[] getPixels(int, int, int, int, int[], DataBuffer)Returns all samples for the specified rectangle of pixels in an int array one sample per array element. AnClass ComponentSampleModel, int getSample(int, int, int, DataBuffer)ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the upper left pixel location. @paramyThe Ythecoordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples of the pixels within the specified region. @see #setPixels(int int int int int[] DataBuffer)
Returns as int the sample in a specified band for the pixel located at (x y). AnClass ComponentSampleModel, double getSampleDouble(int, int, int, DataBuffer)ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramyThe Ythecoordinatecoordinates of the pixel location.@param bThethe band to return.@param dataThetheDataBuffer
containing the image data.@return the sample in a specified band for the specified pixel @see #setSample(int int int int DataBuffer)
Returns the sample in a specified band for a pixel located at (x y) as a double. AnClass ComponentSampleModel, float getSampleFloat(int, int, int, DataBuffer)ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to return.@param data The DataBuffer containing the image data @return a double value representing the sample in the specified band for the specified pixel.
Returns the sample in a specified band for the pixel located at (x y) as a float. AnClass ComponentSampleModel, int[] getSampleSize()ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to return.@param data The DataBuffer containing the image data @return a float value representing the sample in the specified band for the specified pixel.
Returns the number of bits per sample for all bands. @return an array containing the number of bits per sample for all bands where each element in the array represents a band.Class ComponentSampleModel, int getSampleSize(int)
Returns the number of bits per sample for the specified band. @param band the specified band @return the number of bits per sample for the specified band.Class ComponentSampleModel, int[] getSamples(int, int, int, int, int, int[], DataBuffer)
Returns the samples in a specified band for the specified rectangle of pixels in an int array one sample per data array element. AnClass ComponentSampleModel, int getScanlineStride()ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the upper left pixel location. @paramyThe Ythecoordinatecoordinates of the upper left pixel location.@param wThethe width of the pixel rectangle.@param hThethe height of the pixel rectangle.@param bThethe band to return.@param iArrayIfif non-null
returns the samples in this array.@param dataThetheDataBuffer
containing the image data.@return the samples in the specified band of the specified pixel @see #setSamples(int int int int int int[] DataBuffer)
Returns the scanline stride of this ComponentSampleModel. @return the scanline stride of this ComponentSampleModel
.
Class ComponentSampleModel, void setDataElements(int, int, Object, DataBuffer)Sets the data for a single pixel in the specifiedClass ComponentSampleModel, void setPixel(int, int, int[], DataBuffer)DataBuffer
from a primitive array of typeTransferType
. For aComponentSampleModel
thiswill beis the same as the data type and samples are transferred one per array element.The following code illustrates transferring data for one pixel from
DataBuffer
db1
whose storage layout is described byComponentSampleModel
csm1
toDataBuffer
db2
whose storage layout is described byComponentSampleModel
csm2
. The transferwill generallyisbeusually more efficient than usinggetPixel
and/setPixel.
ComponentSampleModel csm1 csm2; DataBufferInt db1 db2; csm2.setDataElements(x y csm1.getDataElements(x y null db1) db2);UsinggetDataElements
and/setDataElements to transfer between two
DataBuffer/SampleModel
pairs is legitimate if theSampleModelsSampleModel
objects have the same number of bands corresponding bands have the same number of bits per sample and theTransferTypesTransferType
s are the same.A
ClassCastException
is thrown ifobj
must beis not a primitive array of typeTransferType
. An. Otherwise a ClassCastException is thrownArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds or ifobj
is not large enough to hold the pixel data. @param xThe X coordinate of the pixel location. @paramyThe Ythecoordinatecoordinates of the pixel location.@param objAa primitive array containing pixel data.@param dataThethe DataBuffer containing the image data.@see #getDataElements(int int Object DataBuffer)
Sets a pixel in theClass ComponentSampleModel, void setPixels(int, int, int, int, int[], DataBuffer)DataBuffer
using an int array of samples for input. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param iArray The input samples in an int array.@param data The DataBuffer containing the image data.@see #getPixel(int int int[] DataBuffer)
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. AnClass ComponentSampleModel, void setSample(int, int, int, double, DataBuffer)ArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param iArray The input samples in an int array.@param data The DataBuffer containing the image data.@see #getPixels(int int int int int[] DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in theClass ComponentSampleModel, void setSample(int, int, int, float, DataBuffer)DataBuffer
using a double for input. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to set.@param s The input sample as a double.@param data The DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in theClass ComponentSampleModel, void setSample(int, int, int, int, DataBuffer)DataBuffer
using a float for input. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param b The band to set.@param s The input sample as a float.@param data The DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in theClass ComponentSampleModel, void setSamples(int, int, int, int, int, int[], DataBuffer)DataBuffer
using an int for input. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the pixel location. @paramyThe Ythecoordinatecoordinates of the pixel location.@param bThethe band to set.@param sThethe input sample as an int.@param dataThethe DataBuffer containing the image data.@see #getSample(int int int DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per data array element. AnArrayIndexOutOfBoundsException
maymight be thrown if the coordinates are not in bounds. @param xThe X coordinate of the upper left pixel location. @paramy TheY coordinatecoordinates of the upper left pixel location.@param w The width of the pixel rectangle.@param h The height of the pixel rectangle.@param b The band to set.@param iArray The input samples in an int array.@param data The DataBuffer containing the image data.@see #getSamples(int int int int int int[] DataBuffer)
Constructs a ConvolveOp given a Kernel. The edge condition will be EDGE_ZERO_FILL. @param kernel the specified Kernel
@see Kernel @see #EDGE_ZERO_FILL
Class ConvolveOp, constructor ConvolveOp(Kernel, int, RenderingHints)Constructs a ConvolveOp given a Kernel an edge condition and a RenderingHints object (which may be null). @param kernel the specifiedClass ConvolveOp, BufferedImage createCompatibleDestImage(BufferedImage, ColorModel)Kernel
@param edgeCondition the specified edge condition @param hints the specifiedRenderingHints
object @see Kernel @see #EDGE_NO_OP @see #EDGE_ZERO_FILL @see java.awt.RenderingHints
Creates a zeroed destination image with the correct size and number of bands. If destCM is null an appropriate ColorModel will be used. @param src Source image for the filter operation. @param destCM ColorModel of the destination. Can be null. @return a destination BufferedImage
with the correct size and number of bands.
Class ConvolveOp, int getEdgeCondition()Returns the edge condition. @return the edge condition of this ConvolveOp
. @see #EDGE_NO_OP @see #EDGE_ZERO_FILL
Class ConvolveOp, Kernel getKernel()Returns the Kernel. @return theKernel
of thisConvolveOp
.
An ImageFilter class for cropping images. This class extends the basic ImageFilter Class to extract a given rectangular region of an existing Image and provide a source for a new image containing just the extracted region. It is meant to be used in conjunction with a FilteredImageSource object to produce cropped versions of existing images. @see FilteredImageSource @see ImageFilter @version 1.11 0212 12/0203/0001 @author Jim Graham
This class exists to wrap one or more data arrays. Each data array in the DataBuffer is referred to as a bank. Accessor methods for getting and setting elements of the DataBuffer's banks exist with and without a bank specifier. The methods without a bank specifier use the default 0th bank. The DataBuffer can optionally take an offset per bank so that data in an existing array can be used even if the interesting data doesn't start at array location zero. Getting or setting the 0th element of a bank uses the (0+offset)th element of the array. The size field specifies how much of the data array is available for use. Size + offset for a given bank should never be greater than the length of the associated data array. The data type of a data buffer indicates the type of the data array(s) and may also indicate additional semantics e.g. storing unsigned 8-bit data in elements of a byte array. The data type may be TYPE_UNDEFINED or one of the types defined below. Other types may be added in the future. Generally an object of class DataBuffer will be cast down to one of its data type specific subclasses to access data type specific methods for improved performance. Currently the Java 2D(tm) API image classes useClass DataBuffer, int getDataType()onlyTYPE_BYTE TYPE_USHORT TYPE_INT TYPE_SHORT TYPE_FLOAT and TYPE_INTDOUBLE DataBuffers to store image data. @see java.awt.image.Raster @see java.awt.image.SampleModel
Returns the data type of this DataBuffer. @return the data type of this DataBuffer
.
Class DataBuffer, int getElem(int)Returns the requested data array element from the first (default) bank as an integer. @param i the index of the requested data array element @return the data array element at the specified index. @see #setElem(int int) @see #setElem(int int int)Class DataBuffer, int getElem(int, int)
Returns the requested data array element from the specified bank as an integer. @param bank the specified bank @param i the index of the requested data array element @return the data array element at the specified index from the specified bank at the specified index. @see #setElem(int int) @see #setElem(int int int)Class DataBuffer, double getElemDouble(int)
Returns the requested data array element from the first (default) bank as a double. The implementation in this class is to cast #getElem(Class DataBuffer, double getElemDouble(int, int)iint) to a double. Subclassesmaycan override this method if another implementation is needed. @param i the specified index @return a double value representing the element at the specified index in the data array. @see #setElemDouble(int double) @see #setElemDouble(int int double)
Returns the requested data array element from the specified bank as a double. The implementation in this class is to cast getElem(bank i) to a double. Subclasses may override this method if another implementation is needed. @param bank the specified bank @param i the specified index @return a double value representing the element from the specified bank at the specified index in the data array. @see #setElemDouble(int double) @see #setElemDouble(int int double)Class DataBuffer, float getElemFloat(int)
Returns the requested data array element from the first (default) bank as a float. The implementation in this class is to cast getElem(i) to a float. Subclasses may override this method if another implementation is needed. @param i the index of the requested data array element @return a float value representing the data array element at the specified index. @see #setElemFloat(int float) @see #setElemFloat(int int float)Class DataBuffer, float getElemFloat(int, int)
Returns the requested data array element from the specified bank as a float. The implementation in this class is to castClass DataBuffer, int getNumBanks()getElem(bank iint) to a float. Subclassesmaycan override this method if another implementation is needed. @param bank the specified bank @param i the index of the requested data array element @return a float value representing the data array element from the specified bank at the specified index. @see #setElemFloat(int float) @see #setElemFloat(int int float)
Returns the number of banks in this DataBuffer. @return the number of banks.Class DataBuffer, int getOffset()
Returns the offset of the default bank in array elements. @return the offset of the default bank.Class DataBuffer, int[] getOffsets()
Returns the offsets (in array elements) of all the banks. @return the offsets of all banks.Class DataBuffer, int getSize()
Returns the size (in array elements) of all banks. @return the size of all banks.Class DataBuffer, void setElem(int, int)
Sets the requested data array element in the first (default) bank from the given integer. @param i the specified index into the data array @param val the data to set the element at the specified index in the data array @see #getElem(int) @see #getElem(int int)Class DataBuffer, void setElem(int, int, int)
Sets the requested data array element in the specified bank from the given integer. @param bank the specified bank @param i the specified index into the data array @param val the data to set the element in the specified bank at the specified index in the data array @see #getElem(int) @see #getElem(int int)Class DataBuffer, void setElemDouble(int, double)
Sets the requested data array element in the first (default) bank from the given double. The implementation in this class is to cast val to an int and callClass DataBuffer, void setElemDouble(int, int, double)setElem.int) Subclassesmaycan override this method if another implementation is needed. @param i the specified index @param val the value to set the element at the specified index in the data array @see #getElemDouble(int) @see #getElemDouble(int int)
Sets the requested data array element in the specified bank from the given double. The implementation in this class is to cast val to an int and callClass DataBuffer, void setElemFloat(int, float)setElem.int) Subclassesmaycan override this method if another implementation is needed. @param bank the specified bank @param i the specified index @param val the value to set the element in the specified bank at the specified index of the data array @see #getElemDouble(int) @see #getElemDouble(int int)
Sets the requested data array element in the first (default) bank from the given float. The implementation in this class is to cast val to an int and callClass DataBuffer, void setElemFloat(int, int, float)setElem.int) Subclassesmaycan override this method if another implementation is needed. @param i the specified index @param val the value to set the element at the specified index in the data array @see #getElemFloat(int) @see #getElemFloat(int int)
Sets the requested data array element in the specified bank from the given float. The implementation in this class is to castClass DataBuffer, int TYPE_UNDEFINED*val to an int and callsetElem.int) Subclassesmaycan override this method if another implementation is needed. @param bank the specified bank @param i the specified index @param val the value to set the element in the specified bank at the specified index in the data array @see #getElemFloat(int) @see #getElemFloat(int int)
Tag for undefined data.
Returns the requested data array element from the first (default) bank. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferByte, int getElem(int, int)
Returns the requested data array element from the specified bank. @param bank The bank from which you want to get a data array element. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferByte, void setElem(int, int)
Sets the requested data array element in the first (default) bank to the specified value. @param i The data array element you want to set. @param val The integer value to which you want to set the data array element. @see #getElem(int) @see #getElem(int int)Class DataBufferByte, void setElem(int, int, int)
Sets the requested data array element in the specified bank from the given integer. @param bank The bank in which you want to set the data array element. @param i The data array element you want to set. @param val The integer value to which you want to set the specified data array element. @see #getElem(int) @see #getElem(int int)
Returns the requested data array element from the first (default) bank. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferInt, int getElem(int, int)
Returns the requested data array element from the specified bank. @param bank The bank from which you want to get a data array element. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferInt, void setElem(int, int)
Sets the requested data array element in the first (default) bank to the specified value. @param i The data array element you want to set. @param val The integer value to which you want to set the data array element. @see #getElem(int) @see #getElem(int int)Class DataBufferInt, void setElem(int, int, int)
Sets the requested data array element in the specified bank to the integer value i
. @param bank The bank in which you want to set the data array element. @param i The data array element you want to set. @param val The integer value to which you want to set the specified data array element. @see #getElem(int) @see #getElem(int int)
Returns the requested data array element from the first (default) bank. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferShort, int getElem(int, int)
Returns the requested data array element from the specified bank. @param bank The bank from which you want to get a data array element. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferShort, void setElem(int, int)
Sets the requested data array element in the first (default) bank to the specified value. @param i The data array element you want to set. @param val The integer value to which you want to set the data array element. @see #getElem(int) @see #getElem(int int)Class DataBufferShort, void setElem(int, int, int)
Sets the requested data array element in the specified bank from the given integer. @param bank The bank in which you want to set the data array element. @param i The data array element you want to set. @param val The integer value to which you want to set the specified data array element. @see #getElem(int) @see #getElem(int int)
Returns the requested data array element from the first (default) bank. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferUShort, int getElem(int, int)
Returns the requested data array element from the specified bank. @param bank The bank from which you want to get a data array element. @param i The data array element you want to get. @return The requested data array element as an integer. @see #setElem(int int) @see #setElem(int int int)Class DataBufferUShort, void setElem(int, int)
Sets the requested data array element in the first (default) bank to the specified value. @param i The data array element you want to set. @param val The integer value to which you want to set the data array element. @see #getElem(int) @see #getElem(int int)Class DataBufferUShort, void setElem(int, int, int)
Sets the requested data array element in the specified bank from the given integer. @param bank The bank in which you want to set the data array element. @param i The data array element you want to set. @param val The integer value to which you want to set the specified data array element. @see #getElem(int) @see #getElem(int int)
TheClass DirectColorModel, constructor DirectColorModel(ColorSpace, int, int, int, int, int, boolean, int)DirectColorModel
class is aColorModel
class that works with pixel values that represent RGB color and alpha information as separate samples and that pack all samples for a single pixel into a single int short or byte quantity. This class can be used only with ColorSpaces of type ColorSpace.TYPE_RGB. In addition for each component of the ColorSpace the minimum normalized component value obtained via thegetMinValue()
method of ColorSpace must be 0.0 and the maximum value obtained via thegetMaxValue()
method must be 1.0 (these min/max values are typical for RGB spaces). There must be three color samples in the pixel values and there can be a single alpha sample. For those methods that use a primitive array pixel representation of typetransferType
the array length is always one. The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT. Color and alpha samples are stored in the single element of the array in bits indicated by bit masks. Each bit mask must be contiguous and masks must not overlap. The same masks apply to the single int pixel representation used by other methods. The correspondence of masks and color/alpha samples is as follows:
- Masks are identified by indices running from 0 through 2 if no alpha is present or 3 if an alpha is present.
- The first three indices refer to color samples; index 0 corresponds to red index 1 to green and index 2 to blue.
- Index 3 corresponds to the alpha sample if present.
The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. A
DirectColorModel
is typically used with image data which uses masks to define packed samples. For example aDirectColorModel
can be used in conjunction with aSinglePixelPackedSampleModel
to construct a BufferedImage Normally the masks used by the SampleModel and theColorModel
would be the same. However if they are different the color interpretation of pixel data will be done according to the masks of theColorModel
.A single int pixel representation is valid for all objects of this class since it is always possible to represent pixel values used with this class in a single int. Therefore methods which use this representation will not throw an
IllegalArgumentException
due to an invalid pixel value.This color model is similar to an X11 TrueColor visual. The default RGB ColorModel specified by the getRGBdefault method is a
DirectColorModel
with the following parameters:Number of bits: 32 Red mask: 0x00ff0000 Green mask: 0x0000ff00 Blue mask: 0x000000ff Alpha mask: 0xff000000 Color space: sRGB isAlphaPremultiplied: False Transparency: Transparency.TRANSLUCENT transferType: DataBuffer.TYPE_INTMany of the methods in this class are final. This is because the underlying native graphics code makes assumptions about the layout and operation of this class and those assumptions are reflected in the implementations of the methods here that are marked final. You can subclass this class for other reasons but you cannot override or modify the behavior of those methods. @see ColorModel @see ColorSpace @see SinglePixelPackedSampleModel @see BufferedImage @see ColorModel#getRGBdefault @version 10 Feb 1997
Constructs aClass DirectColorModel, int[] getComponents(Object, int[], int)DirectColorModel
from the specified parameters. Color components are in the specifiedColorSpace
which must be of type ColorSpace.TYPE_RGB and have minimum normalized component values which are all 0.0 and maximum values which are all 1.0. The masks specify which bits in anint
pixel representation contain the red green and blue color samples and the alpha sample if present. Ifamask
is 0 pixel values do not contain alpha information and all pixels are treated as opaque which means that alpha = 1.0. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of anint
pixel representation. If there is alpha theboolean
isAlphaPremultiplied
specifies how to interpret color and alpha samples in pixel values. If theboolean
istrue
color samples are assumed to have been multiplied by the alpha sample. The transparency value is Transparency.OPAQUE if no alpha is present or Transparency.TRANSLUCENT otherwise. The transfer type is the type of primitive array used to represent pixel values and must be one of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @param space the specifiedColorSpace
@param bits the number of bits in the pixel values; for example the sum of the number of bits in the masks. @param rmask specifies a mask indicating which bits in an integer pixel contain the red component @param gmask specifies a mask indicating which bits in an integer pixel contain the green component @param bmask specifies a mask indicating which bits in an integer pixel contain the blue component @param amask specifies a mask indicating which bits in an integer pixel contain the alpha component @param isAlphaPremultipliedtrue
if color samples are premultiplied by the alpha sample;false
otherwise @param transferType the type of array used to represent pixel values @throws IllegalArgumentException ifspace
is not a TYPE_RGB space or if the min/max normalized component values are not 0.0/1.0.
Returns an array of unnormalized color/alpha components given a pixel in thisColorModel
. The pixel value is specified by an array of data elements of typetransferType
passed in as an object reference. Ifpixel
is not a primitive array of typetransferType
aClassCastException
is thrown. AnArrayIndexOutOfBoundsException
is thrown ifpixel
is not large enough to hold a pixel value for thisColorModel
. If thecomponents
array isnull
a new array is allocated. Thecomponents
array is returned. Color/alpha components are stored in thecomponents
array starting atoffset
even if the array is allocated by this method. AnArrayIndexOutOfBoundsException
is thrown if thecomponents
array is notnull
and is not large enough to hold all the color and alpha components starting atoffset
. SinceDirectColorModel
can be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType
. @param pixel the specified pixel @param components the array to receive the color and alpha components of the specified pixel @param offset the offset into thecomponents
array at which to start storing the color and alpha components @return an array containing the color and alpha components of the specified pixel starting at the specified offset. @exception ClassCastException ifpixel
is not a primitive array of typetransferType
@exception ArrayIndexOutOfBoundsException ifpixel
is not large enough to hold a pixel value for thisColorModel
or ifcomponents
is notnull
and is not large enough to hold all the color and alpha components starting atoffset
@exception UnsupportedOperationException if thistransferType
is not supported by this color model
This class is an implementation of the ImageProducer interface which takes an existing image and a filter object and uses them to produce image data for a new filtered version of the original image. Here is an example which filters an image by swapping the red and blue compents:Class FilteredImageSource, constructor FilteredImageSource(ImageProducer, ImageFilter)Image src = getImage("doc:///demo/images/duke/T1.gif"); ImageFilter colorfilter = new RedBlueSwapFilter(); Image img = createImage(new FilteredImageSource(src.getSource() colorfilter));@see ImageProducer @version 1.22 0224 12/0203/0001 @author Jim Graham
Constructs an ImageProducer object from an existing ImageProducer and a filter object. @param orig the specifiedClass FilteredImageSource, boolean isConsumer(ImageConsumer)ImageProducer
@param imgf the specifiedImageFilter
@see ImageFilter @see java.awt.Component#createImage
Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image. @param ic the specified ImageConsumer
@return true if the ImageConsumer is on the list; false otherwise @see ImageConsumer
The interface for objects expressing interest in image data through the ImageProducer interfaces. When a consumer is added to an image producer the producer delivers all of the data about the image using the method calls defined in this interface. @see ImageProducer @version 1.Class ImageConsumer, void imageComplete(int)17 0219 12/0203/0001 @author Jim Graham
The imageComplete method is called when the ImageProducer is finished delivering all of the pixels that the source image contains or when a single frame of a multi-frame animation has been completed or when an error in loading or producing the image has occured. The ImageConsumer should remove itself from the list of consumers registered with the ImageProducer at this time unless it is interested in successive frames. @param status the status of image loading @see ImageProducer#removeConsumerClass ImageConsumer, void setColorModel(ColorModel)
Class ImageConsumer, void setDimensions(int, int)TheSets the ColorModel object used for the majority of the pixels reported using the setPixels method calls. Note that each set of pixels delivered using setPixels contains its own ColorModel object so no assumption should be made that this model will be the only one used in delivering pixel values. A notable case where multiple ColorModel objects may be seen is a filtered image when for each set of pixels that it filters the filter determines whether the pixels can be sent on untouched using the original ColorModel or whether the pixels should be modified (filtered) and passed on using a ColorModel more convenient for the filtering process. @param model the specifiedColorModel
@see ColorModel
The dimensions of the source image are reported using the setDimensions method call. @param width the width of the source image @param height the height of the source imageClass ImageConsumer, void setHints(int)
Sets the hints that the ImageConsumer uses to process the pixels delivered by the ImageProducer. The ImageProducer can deliver the pixels in any order but the ImageConsumer may be able to scale or convert the pixels to the destination ColorModel more efficiently or with higher quality if it knows some information about how the pixels will be delivered up front. The setHints method should be called before any calls to any of the setPixels methods with a bit mask of hints about the manner in which the pixels will be delivered. If the ImageProducer does not follow the guidelines for the indicated hint the results are undefined. @param hintflags a set of hints that the ImageConsumer uses to process the pixelsClass ImageConsumer, void setPixels(int, int, int, int, ColorModel, byte[], int, int)
Class ImageConsumer, void setPixels(int, int, int, int, ColorModel, int[], int, int)TheDelivers the pixels of the imageare delivered usingwith one or more calls tothe setPixelsthis method. Each call specifies the location and size of the rectangle of source pixels that are contained in the array of pixels. The specified ColorModel object should be used to convert the pixels into their corresponding color and alpha components. Pixel (m n) is stored in the pixels array at index (n * scansize + m + off). The pixels delivered using this method are all stored as bytes. @param x y the coordinates of the upper-left corner of the area of pixels to be set @param w the width of the area of pixels @param h the height of the area of pixels @param model the specifiedColorModel
@param pixels the array of pixels @param off the offset into thepixels
array @param scansize the distance from one row of pixels to the next in thepixels
array @see ColorModel
The pixels of the image are delivered using one or more calls to the setPixels method. Each call specifies the location and size of the rectangle of source pixels that are contained in the array of pixels. The specified ColorModel object should be used to convert the pixels into their corresponding color and alpha components. Pixel (m n) is stored in the pixels array at index (n * scansize + m + off). The pixels delivered using this method are all stored as ints. this method are all stored as ints. @param x y the coordinates of the upper-left corner of the area of pixels to be set @param w the width of the area of pixels @param h the height of the area of pixels @param model the specifiedClass ImageConsumer, void setProperties(Hashtable)ColorModel
@param pixels the array of pixels @param off the offset into thepixels
array @param scansize the distance from one row of pixels to the next in thepixels
array @see ColorModel
Sets the extensible list of properties associated with this image. @param props the list of properties to be associated with this image
This class implements a filter for the set of interface methods that are used to deliver data from an ImageProducer to an ImageConsumer. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is a base class that provides the calls needed to implement a "Null filter" which has no effect on the data being passed through. Filters should subclass this class and override the methods which deal with the data that needs to be filtered and modify it as necessary. @see FilteredImageSource @see ImageConsumer @version 1.Class ImageFilter, ImageFilter getFilterInstance(ImageConsumer)23 0225 12/0203/0001 @author Jim Graham
Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer. The default implementation just clones this object.Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to filter pixels from an image should avoid calling this method directly since that operation could interfere with the filtering operation. @param ic the specified
ImageConsumer
@return anImageFilter
used to perform the filtering for the specifiedImageConsumer
.
An asynchronous update interface for receiving notifications about Image information as the Image is constructed. @version 1.24 0225 12/0203/0001 @author Jim Graham
The interface for objects which can produce the image data for Images. Each image contains an ImageProducer which is used to reconstruct the image whenever it is needed for example when a new size of the Image is scaled or when the width or height of the Image is being requested. @see ImageConsumer @version 1.Class ImageProducer, void addConsumer(ImageConsumer)16 0218 12/0203/0001 @author Jim Graham
Class ImageProducer, boolean isConsumer(ImageConsumer)ThisRegistersmethod is used to registeranImageConsumer
with theImageProducer
for access to the image data during a later reconstruction of theImage
. TheImageProducer
may at its discretion start delivering the image data to the consumer using theImageConsumer
interface immediately or when the next available image reconstruction is triggered by a call to thestartProduction
method. @param ic the specifiedImageConsumer
@see #startProduction
Class ImageProducer, void removeConsumer(ImageConsumer)ThisDeterminesmethod determinesif agivenspecifiedImageConsumer
object is currently registered with thisImageProducer
as one of its consumers. @param ic the specifiedImageConsumer
@returntrue
if the specifiedImageConsumer
is registered with thisImageProducer
;false
otherwise.
Class ImageProducer, void requestTopDownLeftRightResend(ImageConsumer)ThisRemovesmethod removesthegivenspecifiedImageConsumer
object from the list of consumers currently registered to receive image data. It is not considered an error to remove a consumer that is not currently registered. TheImageProducer
should stop sending data to this consumer as soon as is feasible. @param ic the specifiedImageConsumer
Class ImageProducer, void startProduction(ImageConsumer)ThisRequestsmethod isonused by anbehalf of theImageConsumer
that theto requestImageProducer
attempt to resend the image data one more time in TOPDOWNLEFTRIGHT order so that higher quality conversion algorithms which depend on receiving pixels in order can be used to produce a better output version of the image. TheImageProducer
is free to ignore this call if it cannot resend the data in that order. If the data can be resentthentheImageProducer
should respond by executing the following minimum set ofImageConsumer
method calls:ic.setHints(TOPDOWNLEFTRIGHT |@param ic the specified); ic.setPixels(...); // As many times as needed ic.imageComplete(); ImageConsumer
@see ImageConsumer#setHints
This method bothRegistersregistersthegivenspecifiedImageConsumer
object as a consumer and starts an immediate reconstruction of the image data which will then be delivered to this consumer and any other consumer whichmaymight have already been registered with the producer. This method differs from the addConsumer method in that a reproduction of the image data should be triggered as soon as possible. @param ic the specifiedImageConsumer
@see #addConsumer
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, int[], int, int, BigInteger)IndexColorModel
from an array of ints where each int is comprised of red green blue and optional alpha components in the default RGB color model format. The specified transparent index represents a pixel that is considered entirely transparent regardless of any alpha value specified for it. The array must have enough values in it to fill all of the needed component arrays of the specified size. The ColorSpace is the default sRGB space. The transparency value is Transparency.TRANSLUCENT ifhasAlpha
istrue
; otherwise it is Transparency.BITMASK iftrans
is a valid index into the colormap (between 0 and size - 1) or Transparency.OPAQUE iftrans
is not a valid index. @param bits the number of bits each pixel occupies @param size the size of the color component arrays @param cmap the array of color components @param start the starting offset of the first color component @param hasalpha indicates whether alpha values are contained in thecmap
array @param trans the index of the fully transparent pixel @param transferType the data type of the array used to represent pixel values. The data type must be eitherDataBuffer.TYPE_BYTE
orDataBuffer.TYPE_USHORT
. @throws IllegalArgumentException ifbits
is less than 1 or greater than 16 @throws IllegalArgumentException ifsize
is less than 1 @throws IllegalArgumentException iftransferType
is not one ofDataBuffer.TYPE_BYTE
orDataBuffer.TYPE_USHORT
Constructs anClass IndexColorModel, BufferedImage convertToIntDiscrete(Raster, boolean)IndexColorModel
from anint
array where eachint
is comprised of red green blue and alpha components in the default RGB color model format. The array must have enough values in it to fill all of the needed component arrays of the specified size. TheColorSpace
is the default sRGB space. The transfer typeis the smallestmust be one ofDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
. Theor DataBuffer.TYPE_INT that can hold a single pixelBigInteger
object specifies the valid/invalid pixels in thecmap
array. A pixel is valid if theBigInteger
value at that index is set and is invalid if theBigInteger
bit at that index is not set. @param bits the number of bits each pixel occupies @param size the size of the color component array @param cmap the array of color components @param start the starting offset of the first color component @param transferType the specified data type @param validBits aBigInteger
object. If a bit is set in the BigInteger the pixel at that index is valid. If a bit is not set the pixel at that index is considered invalid. If null all pixels are valid. Only bits from 0 to map_size will be considered. @throws IllegalArgumentException ifbits
is less than 1 or greater than 16 @throws IllegalArgumentException ifsize
is less than 1 @throws IllegalArgumentException iftransferType
is not one ofDataBuffer.TYPE_BYTE
orDataBuffer.TYPE_USHORT
Returns a newBufferedImage
of TYPE_INT_ARGB or TYPE_INT_RGB that has aRaster
with pixel data computed by expanding the indices in the sourceRaster
using the color/alpha component arrays of thisColorModel
. IfforceARGB
istrue
a TYPE_INT_ARGB image is returned regardless of whether or not thisColorModel
has an alpha component array or a transparent pixel. @param raster the specifiedRaster
@param forceARGB iftrue
the returnedBufferedImage
is TYPE_INT_ARGB; otherwise it is TYPE_INT_RGB @return aBufferedImage
created with the specifiedRaster
@throws IllegalArgumentException if the raster argument is not compatible with this IndexColorModel
Constructs aClass LookupOp, BufferedImage createCompatibleDestImage(BufferedImage, ColorModel)LookupOp
object given the lookup table and aRenderingHints
object(whichmaymight benull
. @param lookup the specified)LookupTable
@param hints the specifiedRenderingHints
ornull
Creates a zeroed destination image with the correct size and number of bands. If destCM isClass LookupOp, WritableRaster createCompatibleDestRaster(Raster)null
an appropriateColorModel
will be used. @param src Source image for the filter operation. @param destCMColorModel ofthe destination.'sCanColorModel
which can benull
. @return a filtered destinationBufferedImage
.
Creates a zeroedClass LookupOp, BufferedImage filter(BufferedImage, BufferedImage)-destinationRaster
with the correct size and number of bands given this source. @param src theRaster
to be transformed @return the zeroed-destinationRaster
.
Performs a lookup operation on aClass LookupOp, WritableRaster filter(Raster, WritableRaster)BufferedImage
. If the color model in the source image is not the same as that in the destination image the pixels will be converted in the destination. If the destination image isnull
aBufferedImage
will be created with an appropriateColorModel
. AnIllegalArgumentException
maymight be thrown if the number of arrays in theLookupTable
does not meet the restrictions stated in the class comment above or if the source image has anIndexColorModel
. @param src theBufferedImage
to be filtered @param dst theBufferedImage
in which to store the results of the filter operation @return the filteredBufferedImage
. @throws IllegalArgumentException if the number of arrays in theLookupTable
does not meet the restrictions described in the class comments or if the source image has anIndexColorModel
.
Performs a lookup operation on aClass LookupOp, Rectangle2D getBounds2D(BufferedImage)Raster
. If the destinationRaster
isnull
a newRaster
will be created. TheIllegalArgumentException
maymight be thrown if the sourceRaster
and the destinationRastersRaster
do not havedifferentthe samenumbersnumber of bands or if the number of arrays in theLookupTable
does not meet the restrictions stated in the class comment above. @param src the sourceRaster
to filter @param dst the destinationWritableRaster
for the filteredsrc
@return the filteredWritableRaster
. @throws IllegalArgumentException if the source and destinations rasters do not have the same number of bands or the number of arrays in theLookupTable
does not meet the restrictions described in the class comments.
Returns the bounding box of the filtered destination image. Since this is not a geometric operation the bounding box does not change. @param src the BufferedImage
to be filtered @return the bounds of the filtered definition image.
Class LookupOp, Rectangle2D getBounds2D(Raster)Returns the bounding box of the filtered destination Raster. Since this is not a geometric operation the bounding box does not change. @param src theClass LookupOp, Point2D getPoint2D(Point2D, Point2D)Raster
to be filtered @return the bounds of the filtered definitionRaster
.
Returns the location of the destination point given a point in the source. IfClass LookupOp, RenderingHints getRenderingHints()dstPt
isnon-notnull it will be used to hold the return value. Since this is not a geometric operation the
srcPt
will equal thedstPt
. @param srcPt aPoint2D
that represents a point in the source image @param dstPt aPoint2D
that represents the location in the destination @return thePoint2D
in the destination that corresponds to the specified point in the source.
Returns the rendering hints for this op. @return the RenderingHints
object associated with this op.
Class LookupOp, LookupTable getTable()Returns theLookupTable
. @return theLookupTable
of thisLookupOp
.
Returns the number of components in the lookup table. @return the number of components in this LookupTable
.
Class LookupTable, int getOffset()Returns the offset. @return the offset of this LookupTable
.
Class LookupTable, int[] lookupPixel(int[], int[])Returns anint
array of components for one pixel.SourceTheanddest
destination may bearray contains theequal.resultThe destof thearraylookup and is returned. If dest isnull
a new arraywillis allocated. The source and destination can beallocatedequal. @param src the source array of components of one pixel @param dest the destination array of components for one pixel translated with thisLookupTable
@return anint
array of components for one pixel.
This class is an implementation of the ImageProducer interface which uses an array to produce pixel values for an Image. Here is an example which calculates a 100x100 image representing a fade from black to blue along the X axis and a fade from black to red along the Y axis:Class MemoryImageSource, constructor MemoryImageSource(int, int, ColorModel, byte[], int, int)int w = 100; int h = 100; int pix[] = new int[w * h]; int index = 0; for (int y = 0; yThe MemoryImageSource is also capable of managing a memory image which varies over time to allow animation or custom rendering. Here is an example showing how to set up the animation source and signal changes in the data (adapted from the MemoryAnimationSourceDemo by Garth Dickie): int pixels[]; MemoryImageSource source; public void init() { int width = 50; int height = 50; int size = width * height; pixels = new int[size]; int value = getBackground().getRGB(); for (int i = 0; i@see ImageProducer @version 1. 23 0227 12/0203/0001 @author Jim Graham @author Animation capabilities inspired by the MemoryAnimationSource class written by Garth Dickie
Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param cm the specified ColorModel
@param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @see java.awt.Component#createImage
Class MemoryImageSource, constructor MemoryImageSource(int, int, ColorModel, byte[], int, int, Hashtable)Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param cm the specifiedClass MemoryImageSource, constructor MemoryImageSource(int, int, ColorModel, int[], int, int)ColorModel
@param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @param props a list of properties that theImageProducer
uses to process an image @see java.awt.Component#createImage
Constructs an ImageProducer object which uses an array of integers to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param cm the specified ColorModel
@param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @see java.awt.Component#createImage
Class MemoryImageSource, constructor MemoryImageSource(int, int, ColorModel, int[], int, int, Hashtable)Constructs an ImageProducer object which uses an array of integers to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param cm the specifiedClass MemoryImageSource, constructor MemoryImageSource(int, int, int[], int, int)ColorModel
@param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @param props a list of properties that theImageProducer
uses to process an image @see java.awt.Component#createImage
Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @see java.awt.Component#createImage @see ColorModel#getRGBdefaultClass MemoryImageSource, constructor MemoryImageSource(int, int, int[], int, int, Hashtable)
Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object. @param w the width of the rectangle of pixels @param h the height of the rectangle of pixels @param pix an array of pixels @param off the offset into the array of where to store the first pixel @param scan the distance from one row of pixels to the next in the array @param props a list of properties that the ImageProducer
uses to process an image @see java.awt.Component#createImage @see ColorModel#getRGBdefault
Class MemoryImageSource, void addConsumer(ImageConsumer)Adds an ImageConsumer to the list of consumers interested in data for this image. @param ic the specified ImageConsumer
@see ImageConsumer
Class MemoryImageSource, boolean isConsumer(ImageConsumer)Class MemoryImageSource, void newPixels()DetermineDetermines if an ImageConsumer is on the list of consumers currently interested in data for this image. @param ic the specifiedImageConsumer
@returntrue
if theImageConsumer
is on the list;false
otherwise. @see ImageConsumer
Class MemoryImageSource, void newPixels(byte[], ColorModel, int, int)SendSends a whole new buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method. @see #newPixels(int int int int boolean) @see ImageConsumer @see #setAnimated
Class MemoryImageSource, void newPixels(int, int, int, int)ChangeChanges to a new byte array to hold the pixels for this image. If the animation flag has been turned on through the setAnimated() method then the new pixels will be immediately delivered to any ImageConsumers that are currently interested in the data for this image. @param newpix the new pixel array @param newmodel the specifiedColorModel
@param offset the offset into the array @param scansize the distance from one row of pixels to the next in the array @see #newPixels(int int int int boolean) @see #setAnimated
Class MemoryImageSource, void newPixels(int, int, int, int, boolean)SendSends a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method. If the full buffer update flag was turned on with the setFullBufferUpdates() method then the rectangle parameters will be ignored and the entire buffer will always be sent. @param x the x coordinate of the upper left corner of the rectangle of pixels to be sent @param y the y coordinate of the upper left corner of the rectangle of pixels to be sent @param w the width of the rectangle of pixels to be sent @param h the height of the rectangle of pixels to be sent @see #newPixels(int int int int boolean) @see ImageConsumer @see #setAnimated @see #setFullBufferUpdates
Class MemoryImageSource, void newPixels(int[], ColorModel, int, int)SendSends a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image. If the framenotify parameter is true then the consumers are also notified that an animation frame is complete. This method only has effect if the animation flag has been turned on through the setAnimated() method. If the full buffer update flag was turned on with the setFullBufferUpdates() method then the rectangle parameters will be ignored and the entire buffer will always be sent. @param x the x coordinate of the upper left corner of the rectangle of pixels to be sent @param y the y coordinate of the upper left corner of the rectangle of pixels to be sent @param w the width of the rectangle of pixels to be sent @param h the height of the rectangle of pixels to be sent @param framenotifytrue
if the consumers should be sent a SINGLEFRAMEDONE notification @see ImageConsumer @see #setAnimated @see #setFullBufferUpdates
Class MemoryImageSource, void removeConsumer(ImageConsumer)ChangeChanges to a new int array to hold the pixels for this image. If the animation flag has been turned on through the setAnimated() method then the new pixels will be immediately delivered to any ImageConsumers that are currently interested in the data for this image. @param newpix the new pixel array @param newmodel the specifiedColorModel
@param offset the offset into the array @param scansize the distance from one row of pixels to the next in the array @see #newPixels(int int int int boolean) @see #setAnimated
Class MemoryImageSource, void requestTopDownLeftRightResend(ImageConsumer)RemoveRemoves an ImageConsumer from the list of consumers interested in data for this image. @param ic the specifiedImageConsumer
@see ImageConsumer
Requests that a given ImageConsumer have the image data delivered one more time in top-down left-right order. @param ic the specified ImageConsumer
@see ImageConsumer
Class MemoryImageSource, void setAnimated(boolean)Class MemoryImageSource, void setFullBufferUpdates(boolean)ChangeChanges this memory image into a multi-frame animation or a single-frame static image depending on the animated parameter.This method should be called immediately after the MemoryImageSource is constructed and before an image is created with it to ensure that all ImageConsumers will receive the correct multi-frame data. If an ImageConsumer is added to this ImageProducer before this flag is set then that ImageConsumer will see only a snapshot of the pixel data that was available when it connected. @param animated
true
if the image is a multi-frame animation
Class MemoryImageSource, void startProduction(ImageConsumer)SpecifySpecifies whether this animated memory image should always be updated by sending the complete buffer of pixels whenever there is a change. This flag is ignored if the animation flag is not turned on through the setAnimated() method.This method should be called immediately after the MemoryImageSource is constructed and before an image is created with it to ensure that all ImageConsumers will receive the correct pixel delivery hints. @param fullbuffers
true
if the complete pixel buffer should always be sent @see #setAnimated
Adds an ImageConsumer to the list of consumers interested in data for this image and immediatelystartstarts delivery of the image data through the ImageConsumer interface. @param ic the specifiedImageConsumer
image data through the ImageConsumer interface. @see ImageConsumer
Returns data for a single pixel in a primitive array of type TransferType. For aClass MultiPixelPackedSampleModel, int[] getPixel(int, int, int[], DataBuffer)MultiPixelPackedSampleModel
the array has one element and the type is the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel. Generallyobj
should be passed in asnull
so that theObject
is created automatically and is the correct primitive data type.The following code illustrates transferring data for one pixel from
DataBuffer
db1
whose storage layout is described byMultiPixelPackedSampleModel
mppsm1
toDataBuffer
db2
whose storage layout is described byMultiPixelPackedSampleModel
mppsm2
. The transfer is generally more efficient than usinggetPixel
orsetPixel
.MultiPixelPackedSampleModel mppsm1 mppsm2; DataBufferInt db1 db2; mppsm2.setDataElements(x y mppsm1.getDataElements(x y null db1) db2);UsinggetDataElements
orsetDataElements
to transfer between twoDataBuffer/SampleModel
pairs is legitimate if theSampleModels
have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.If
obj
is notnull
it should be a primitive array of type TransferType. Otherwise aClassCastException
is thrown. AnArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds or ifobj
is notnull
and is not large enough to hold the pixel data. @param x y coordinates of the pixel location. @param obj a primitive array in which to return the pixel data ornull
. @param data theDataBuffer
containing the image data. @return anObject
containing data for the specified pixel. @exception ClassCastException ifobj
is not a primitive array of type TransferType or is notnull
@exception ArrayIndexOutOfBoundsException if the coordinates are not in bounds or ifobj
is notnull
or not large enough to hold the pixel data @see #setDataElements(int int Object DataBuffer)
Returns the specified single band pixel in the first element of anClass MultiPixelPackedSampleModel, int getSample(int, int, int, DataBuffer)int
array.ArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds. @param x y the coordinates of the pixel location @param iArray the array containing the pixel to be returned ornull
@param data theDataBuffer
where image data is stored @return an array containing the specified pixel. @exception ArrayIndexOutOfBoundsException if the coordinates are not in bounds @see #setPixel(int int int[] DataBuffer)
Returns asClass MultiPixelPackedSampleModel, void setDataElements(int, int, Object, DataBuffer)int
the sample in a specified band for the pixel located at (x y). AnArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds. @param x y the coordinates of the specified pixel @param b the band to return which is assumed to be 0 @param data theDataBuffer
containing the image data @return the specified band containing the sample of the specified pixel. @exception ArrayIndexOutOfBoundException if the specified coordinates are not in bounds. @see #setSample(int int int int DataBuffer)
Sets the data for a single pixel in the specifiedClass MultiPixelPackedSampleModel, void setPixel(int, int, int[], DataBuffer)DataBuffer
from a primitive array of type TransferType. For aMultiPixelPackedSampleModel
only the first element of the array holds valid data and the type must be the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel.The following code illustrates transferring data for one pixel from
DataBuffer
db1
whose storage layout is described byMultiPixelPackedSampleModel
mppsm1
toDataBuffer
db2
whose storage layout is described byMultiPixelPackedSampleModel
mppsm2
. The transfer is generally more efficient than usinggetPixel
orsetPixel
.MultiPixelPackedSampleModel mppsm1 mppsm2; DataBufferInt db1 db2; mppsm2.setDataElements(x y mppsm1.getDataElements(x y null db1) db2);UsinggetDataElements
orsetDataElements
to transfer between twoDataBuffer/SampleModel
pairs is legitimate if theSampleModel
objects have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.
obj
must be a primitive array of type TransferType. Otherwise aClassCastException
is thrown. AnArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds or ifobj
is not large enough to hold the pixel data. @param x y the coordinates of the pixel location @param obj a primitive array containing pixel data @param data theDataBuffer
containing the image data @see #getDataElements(int int Object DataBuffer)
Sets a pixel in theClass MultiPixelPackedSampleModel, void setSample(int, int, int, int, DataBuffer)DataBuffer
using anint
array for input.ArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds. @param x y the coordinates of the pixel location @param iArray the input pixel in anint
array @param data theDataBuffer
containing the image data @see #getPixel(int int int[] DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in theDataBuffer
using anint
for input. AnArrayIndexOutOfBoundsException
is thrown if the coordinates are not in bounds. @param x y the coordinates of the specified pixel @param b the band to return which is assumed to be 0 @param s the input sample as anint
@param data theDataBuffer
where image data is stored @exception ArrayIndexOutOfBoundsException if the coordinates are not in bounds. @see #getSample(int int int DataBuffer)
The PixelGrabber class implements an ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image. Here is an example:Class PixelGrabber, constructor PixelGrabber(ImageProducer, int, int, int, int, int[], int, int)public void handlesinglepixel(int x int y int pixel) { int alpha = (pixel >> 24) & 0xff; int red = (pixel >> 16) & 0xff; int green = (pixel >> 8) & 0xff; int blue = (pixel ) & 0xff; // Deal with the pixel as necessary... } public void handlepixels(Image img int x int y int w int h) { int[] pixels = new int[w * h]; PixelGrabber pg = new PixelGrabber(img x y w h pixels 0 w); try { pg.grabPixels(); } catch (InterruptedException e) { System.err.println("interrupted waiting for pixels "); return; } if ((pg.getStatus() & ImageObserver.ABORT) = 0) { System.err.println("image fetch aborted or errored"); return; } for (int j = 0; j@see ColorModel#getRGBdefault @version 1. 19 0221 12/0203/0001 @author Jim Graham
Create a PixelGrabber object to grab the (x y w h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i j) where (i j) is inside the rectangle (x y w h) is stored in the array at pix[(j - y) * scansize + (i - x) + off]. @Class PixelGrabber, ColorModel getColorModel()seeparamColorModel#getRGBdefaultip@paramtheImageProducer
thatimgproduces the image from which to retrieve pixelsfrom@param x the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image relative to the default (unscaled) size of the image @param y the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image @param w the width of the rectangle of pixels to retrieve @param h the height of the rectangle of pixels to retrieve @param pix the array of integers which are to be used to hold the RGB pixels retrieved from the image @param off the offset into the array of where to store the first pixel @param scansize the distance from one row of pixels to the next in the array @see ColorModel#getRGBdefault
Get the ColorModel for the pixels stored in the array. If the PixelGrabber was constructed with an explicit pixel buffer then this method will always return the default RGB ColorModel otherwise it may return null until the ColorModel used by the ImageProducer is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data the ColorModel object returned by this method may change over time until the image grab is complete and may not reflect any of the ColorModel objects that was used by the ImageProducer to deliver the pixels. @return the ColorModel object used for storing the pixels @see #getStatus @see ColorModel#getRGBdefault @see #setColorModel(ColorModel)Class PixelGrabber, Object getPixels()
Get the pixel buffer. If the PixelGrabber was not constructed with an explicit pixel buffer to hold the pixels then this method will return null until the size and format of the image data is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data the array object returned by this method may change over time until the image grab is complete. @return either a byte array or an int array @see #getStatus @see #setPixels(int int int int ColorModel byte[] int int) @see #setPixels(int int int int ColorModel int[] int int)Class PixelGrabber, int getStatus()
Return the status of the pixels. The ImageObserver flags representing the available pixel information are returned. @Class PixelGrabber, void imageComplete(int)see ImageObserver @return the bitwise OR of all relevant ImageObserver flags @see ImageObserver
The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setColorModel(ColorModel)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param status the status of image loading
The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setDimensions(int, int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param model the specified
ColorModel
@see #getColorModel
The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setHints(int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param width the width of the dimension @param height the height of the dimension
The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setPixels(int, int, int, int, ColorModel, byte[], int, int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param hints a set of hints used to process the pixels
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setPixels(int, int, int, int, ColorModel, int[], int, int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param srcX srcY the coordinates of the upper-left corner of the area of pixels to be set @param srcW the width of the area of pixels @param srcH the height of the area of pixels @param model the specified
ColorModel
@param pixels the array of pixels @param srcOff the offset into the pixels array @param srcScan the distance from one row of pixels to the next in the pixels array @see #getPixels
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Class PixelGrabber, void setProperties(Hashtable)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param srcX srcY the coordinates of the upper-left corner of the area of pixels to be set @param srcW the width of the area of pixels @param srcH the height of the area of pixels @param model the specified
ColorModel
@param pixels the array of pixels @param srcOff the offset into the pixels array @param srcScan the distance from one row of pixels to the next in the pixels array @see #getPixels
The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels. @param props the list of properties
Creates a new PixelInterleavedSampleModel with the specified width and height. The new PixelInterleavedSampleModel will have the same number of bands storage data type and pixel stride as this PixelInterleavedSampleModel. The band offsets may be compressed such that the minimum of all of the band offsets is zero. @param w the width of the resultingSampleModel
@param h the height of the resultingSampleModel
@return a newSampleModel
with the specified width and height. @throws IllegalArgumentException ifw
orh
is not greater than 0
This class provides an easy way to create an ImageFilter which modifies the pixels of an image in the default RGB ColorModel. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is an abstract class that provides the calls needed to channel all of the pixel data through a single method which converts pixels one at a time in the default RGB ColorModel regardless of the ColorModel being used by the ImageProducer. The only method which needs to be defined to create a useable image filter is the filterRGB method. Here is an example of a definition of a filter which swaps the red and blue components of an image:Class RGBImageFilter, int filterRGB(int, int, int)class RedBlueSwapFilter extends RGBImageFilter { public RedBlueSwapFilter() { // The filter's operation does not depend on the // pixel's location so IndexColorModels can be // filtered directly. canFilterIndexColorModel = true; } public int filterRGB(int x int y int rgb) { return ((rgb & 0xff00ff00) | ((rgb & 0xff0000) >> 16) | ((rgb & 0xff) < 16)); } }@see FilteredImageSource @see ImageFilter @see ColorModel#getRGBdefault @version 1.19 0221 12/0203/0001 @author Jim Graham
Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel. @param x y the coordinates of the pixel @param rgb the integer pixel representation in the default RGB color model @return a filtered pixel in the default RGB color model. @see ColorModel#getRGBdefault @see #filterRGBPixelsClass RGBImageFilter, void filterRGBPixels(int, int, int, int, int[], int, int)
Filters a buffer of pixels in the default RGB ColorModel by passing them one by one through the filterRGB method. @param x y the coordinates of the upper-left corner of the region of pixels @param w the width of the region of pixels @param h the height of the region of pixels @param pixels the array of pixels @param off the offset into the pixels
array @param scansize the distance from one row of pixels to the next in the array @see ColorModel#getRGBdefault @see #filterRGB
Constructs a Raster 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 compatible with SampleModel. @param sampleModel The SampleModel that specifies the layoutClass Raster, constructor Raster(SampleModel, DataBuffer, Rectangle, Point, Raster).@param dataBuffer The DataBuffer that contains the image data.@param origin The Point that specifies the origin @throws RasterFormatException if computing eitherorigin.x + sampleModel.getWidth()
ororigin.y + sampleModel
.getHeight() results in integer overflow @throws NullPointerException eithersampleModel
ororigin
is null
Constructs a Raster with the given SampleModel DataBuffer and parent. aRegion specifies the bounding rectangle of the new Raster. When translated into the base Raster's coordinate system aRegion must be contained by the base Raster. (The base Raster is the Raster's ancestor which has no parent.) sampleModelTranslate specifies the sampleModelTranslateX and sampleModelTranslateY values of the new Raster. Note that this constructor should generally be called by other constructors or create methods it should not be used directly. @param sampleModel The SampleModel that specifies the layoutClass Raster, constructor Raster(SampleModel, Point).@param dataBuffer The DataBuffer that contains the image data.@param aRegion The Rectangle that specifies the image area.@param sampleModelTranslate The Point that specifies the translation from SampleModel to Raster coordinates.@param parent The parent (if any) of this raster @throws NullPointerException if any ofsampleModel
dataBuffer
aRegion
orsampleModelTranslate
is null @throws RasterFormatException ifaRegion
has width or height less than or equal to zero or computing eitheraRegion
.x + aRegion.width oraRegion.y + aRegion.height
results in integer overflow
Constructs a Raster 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. @param sampleModel The SampleModel that specifies the layoutClass Raster, WritableRaster createBandedRaster(DataBuffer, int, int, int, int[], int[], Point).@param origin The Point that specified the origin @throws RasterFormatException if computing eitherorigin.x + sampleModel.getWidth()
ororigin.y + sampleModel
.getHeight() results in integer overflow @throws NullPointerException eithersampleModel
ororigin
is null
Creates a Raster based on a BandedSampleModel with the specified DataBuffer width height scanline stride bank indices and band offsets. The number of bands is inferred from bankIndices.length and bandOffsets.length which must be the same. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @param dataBuffer theClass Raster, WritableRaster createBandedRaster(int, int, int, int, Point)DataBuffer
that contains the image data @param w the width in pixels of the image data @param h the height in pixels of the image data @param scanlineStride the line stride of the image data @param bankIndices the bank indices for each band @param bandOffsets the offsets of all bands @param location the upper-left corner of theRaster
@return a WritableRaster object with the specifiedDataBuffer
width height scanline stride bank indices and band offsets. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
@throws NullPointerException ifdataBuffer
is null
Creates a Raster based on a BandedSampleModel with the specified data type width height and number of bands.Class Raster, WritableRaster createBandedRaster(int, int, int, int, int[], int[], Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param bands the number of bands @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height and number of bands. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws ArrayIndexOutOfBoundsException ifbands
is less than 1
Creates a Raster based on a BandedSampleModel with the specified data type width height scanline stride bank indices and band offsets. The number of bands is inferred from bankIndices.length and bandOffsets.length which must be the same.Class Raster, Raster createChild(int, int, int, int, int, int, int[])The upper left corner of the Raster is given by the location argument. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param scanlineStride the line stride of the image data @param bankIndices the bank indices for each band @param bandOffsets the offsets of all bands @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height scanline stride bank indices and band offsets. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
@throws ArrayIndexOutOfBoundsException ifbankIndices
orbandOffsets
isnull
Returns a new Raster which shares all or part of this Raster's DataBuffer. The new Raster will possess a reference to the current Raster accessible through its getParent() method.Class Raster, WritableRaster createCompatibleWritableRaster()The parentX parentY width and height parameters form a Rectangle in this Raster'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 Raster.
The new Raster may additionally be translated to a different coordinate system for the plane than that used by the current Raster. The childMinX and childMinY parameters give the new (x y) coordinate of the upper-left pixel of the returned Raster; the coordinate (childMinX childMinY) in the new Raster will map to the same pixel as the coordinate (parentX parentY) in the current Raster.
The new Raster may be defined to contain only a subset of the bands of the current Raster possibly reordered by means of the bandList parameter. If bandList is null it is taken to include all of the bands of the current Raster in their current order.
To create a new Raster that contains a subregion of the current Raster 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. @param parentX
X coordinate of the upper left corner in this Raster's coordinates. @paramparentYY coordinatecoordinates of the upper-left corner in this Raster's coordinates.@param width Width of the region starting at (parentX parentY).@param height Height of the region starting at (parentX parentY). @param childMinXX coordinate of the upper left corner of the returned Raster. @paramchildMinYY coordinatecoordinates of the upper-left corner of the returned Raster.@param bandList Array of band indices or null to use all bands @return a newRaster
. @exception RasterFormatException if the specified subregion is outside of the raster bounds. @throws RasterFormatException ifwidth
orheight
is less than or equal to zero or computing any ofparentX + width
parentY + height
childMinX + width
orchildMinY + height
results in integer overflow
Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer. @return a compatible WritableRaster
with the same sample model and a new data buffer.
Class Raster, WritableRaster createCompatibleWritableRaster(Rectangle)Create a compatible WritableRaster with location (minX minY) and size (width height) specified by rect a new SampleModel and a new initialized DataBuffer. @param rect aClass Raster, WritableRaster createCompatibleWritableRaster(int, int)Rectangle
that specifies the size and location of theWritableRaster
@return a compatibleWritableRaster
with the specified size and location and a new sample model and data buffer. @throws RasterFormatException ifrect
has width or height less than or equal to zero or computing eitherrect.x + rect.width
orrect.y + rect.height
results in integer overflow @throws NullPointerException ifrect
is null
Create a compatible WritableRaster with the specified size a new SampleModel and a new initialized DataBuffer. @param w the specified width of the newClass Raster, WritableRaster createCompatibleWritableRaster(int, int, int, int)WritableRaster
@param h the specified height of the newWritableRaster
@return a compatibleWritableRaster
with the specified size and a new sample model and data buffer. @exception RasterFormatException if the width or height is less than or equal to zero.
Create a compatible WritableRaster with the specified location (minX minY) and size (width height) a new SampleModel and a new initialized DataBuffer. @param x y the coordinates of the upper-left corner of theClass Raster, WritableRaster createInterleavedRaster(DataBuffer, int, int, int, int, int[], Point)WritableRaster
@param w the specified width of theWritableRaster
@param h the specified height of theWritableRaster
@return a compatibleWritableRaster
with the specified size and location and a new sample model and data buffer. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherx + w
ory + h
results in integer overflow
Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer width height scanline stride pixel stride and band offsets. The number of bands is inferred from bandOffsets.length. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used.Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, Point)Note that interleaved
DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INT
use Raster.createPackedRaster(). @param dataBuffer theDataBuffer
that contains the image data @param w the width in pixels of the image data @param h the height in pixels of the image data @param scanlineStride the line stride of the image data @param pixelStride the pixel stride of the image data @param bandOffsets the offsets of all bands @param location the upper-left corner of theRaster
@return a WritableRaster object with the specifiedDataBuffer
width height scanline stride pixel stride and band offsets. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
@throws RasterFormatException ifdataBuffer
has more than one bank. @throws NullPointerException ifdataBuffer
is null
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type width height and number of bands.Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, int, int[], Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
Note that interleaved
DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INT
use Raster.createPackedRaster().The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param bands the number of bands @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height and number of bands. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type width height scanline stride pixel stride and band offsets. The number of bands is inferred from bandOffsets.length.Class Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
Note that interleaved
DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INT
use Raster.createPackedRaster().The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param scanlineStride the line stride of the image data @param pixelStride the pixel stride of the image data @param bandOffsets the offsets of all bands @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height scanline stride pixel stride and band offsets. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORTorDataBuffer.TYPE_
.INTUSHORT
Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer width height and bits per pixel. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @param dataBuffer theClass Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, int[], Point)DataBuffer
that contains the image data @param w the width in pixels of the image data @param h the height in pixels of the image data @param bitsPerPixel the number of bits for each pixel @param location the upper-left corner of theRaster
@return a WritableRaster object with the specifiedDataBuffer
width height and bits per pixel. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
@throws RasterFormatException ifdataBuffer
has more than one bank. @throws NullPointerException ifdataBuffer
is null
Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer width height scanline stride and band masks. The number of bands is inferred from bandMasks.length. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @param dataBuffer theClass Raster, WritableRaster createPackedRaster(int, int, int, int, int, Point)DataBuffer
that contains the image data @param w the width in pixels of the image data @param h the height in pixels of the image data @param scanlineStride the line stride of the image data @param bandMasks an array containing an entry for each band @param location the upper-left corner of theRaster
@return a WritableRaster object with the specifiedDataBuffer
width height scanline stride and band masks. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
@throws RasterFormatException ifdataBuffer
has more than one bank. @throws NullPointerException ifdataBuffer
is null
Creates a Raster based on a packed SampleModel with the specified data type width height number of bands and bits per band. If the number of bands is one the SampleModel will be a MultiPixelPackedSampleModel.Class Raster, WritableRaster createPackedRaster(int, int, int, int[], Point)If the number of bands is more than one the SampleModel will be a SinglePixelPackedSampleModel with each band having bitsPerBand bits. In either case the requirements on dataType and bitsPerBand imposed by the corresponding SampleModel must be met.
The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param bands the number of bands @param bitsPerBand the number of bits per band @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height number of bands and bits per band. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException if the product ofbitsPerBand
andbands
is greater than the number of bits held bydataType
@throws IllegalArgumentException ifbitsPerBand
orbands
is not greater than zero @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type width height and band masks. The number of bands is inferred from bandMasks.length.Class Raster, Raster createRaster(SampleModel, DataBuffer, Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @param dataType the data type for storing samples @param w the width in pixels of the image data @param h the height in pixels of the image data @param bandMasks an array containing an entry for each band @param location the upper-left corner of the
Raster
@return a WritableRaster object with the specified data type width height and band masks. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing eitherlocation.x + w
orlocation.y + h
results in integer overflow @throws IllegalArgumentException ifdataType
is not one of the supported data types which areDataBuffer.TYPE_BYTE
DataBuffer.TYPE_USHORT
orDataBuffer.TYPE_INT
Creates a Raster with the specified SampleModel and DataBuffer. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @param sm the specifiedClass Raster, Raster createTranslatedChild(int, int)SampleModel
@param db the specifiedDataBuffer
@param location the upper-left corner of theRaster
@return aRaster
with the specifiedSampleModel
DataBuffer
and location. @throws RasterFormatException if computing eitherlocation.x + sm.getWidth()
orlocation.y + sm.getHeight()
results in integer overflow @throws RasterFormatException ifdataBuffer
has more than one bank and thesampleModel
is PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel. @throws NullPointerException if either SampleModel or DataBuffer is null
Create a Raster with the same size SampleModel and DataBuffer as this one but with a different location. The new Raster will possess a reference to the current Raster accessible through its getParent() method. @param childMinXClass Raster, WritableRaster createWritableRaster(SampleModel, DataBuffer, Point)XchildMinYcoordcoordinates of the upper-left corner of the newRaster
@.paramreturnchildMinY Ya newcoordRaster
ofwith theuppersameleft corner of thesize SampleModel and DataBuffernewas thisRaster
but with the specified location. @throws RasterFormatException if computing eitherchildMinX + this
.getWidth() orchildMinY + this.getHeight()
results in integer overflow
Creates a WritableRaster with the specified SampleModel and DataBuffer. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @paramClass Raster, WritableRaster createWritableRaster(SampleModel, Point)Thesm the specifiedSampleModel
@param db the specifiedDataBuffer
@param location theonlyupper-left corner of theWritableRaster
@returndataTypesaWritableRaster
supported currently arewith the specifiedTYPE_BYTESampleModel
TYPE_USHORTDataBuffer
andTYPE_INTlocation. @throws RasterFormatException if computing eitherlocation.x + sm.getWidth()
orlocation.y + sm
.getHeight() results in integer overflow @throws RasterFormatException ifdataBuffer
has more than one bank and thesampleModel
is PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel. @throws NullPointerException if either SampleModel or DataBuffer is null
Creates a WritableRaster with the specified SampleModel. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @paramClass Raster, Rectangle getBounds()Thesm the specifiedSampleModel
@param location the upper-left corner of theonlyWritableRaster
@returndataTypesasupportedWritableRaster
currently arewith theTYPE_BYTEspecifiedTYPE_USHORTSampleModel
andTYPE_INTlocation. @throws RasterFormatException if computing eitherlocation.x + sm.getWidth()
orlocation.y + sm
.getHeight() results in integer overflow
Returns the bounding Rectangle of this Raster. This function returns the same information as getMinX/MinY/Width/Height. @return the bounding box of this Raster
.
Class Raster, DataBuffer getDataBuffer()Returns the DataBuffer associated with this Raster. @return theClass Raster, Object getDataElements(int, int, Object)DataBuffer
of thisRaster
.
Returns data for a single pixel in a primitive array of type TransferType. For image data supported by the Java 2D(tm) API this will be one of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class Raster, Object getDataElements(int, int, int, int, Object)INTDOUBLE. Data may be returned in a packed format thus increasing efficiency for data transfers.There will be no explicit bounds checking on the parameters.An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of TransferType. @see java.awt.image.SampleModel#getDataElements(int int Object DataBuffer) @param xThe X coordinate of the pixel location. @paramyThe Ythecoordinatecoordinates of the pixel location.@param 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.@return An object reference to an array of type defined by getTransferType() with the requested pixel data. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if outData is too small to hold the output.
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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class Raster, int getHeight()INTDOUBLE. Data may be returned in a packed format thus increasing efficiency for data transfers.There will be no explicit bounds checking on the parameters.An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of TransferType. @see java.awt.image.SampleModel#getDataElements(int int int int Object DataBuffer) @param xThe X coordinate of the upper left pixel location. @paramyThe Ythecoordinatecoordinates of the upper-left pixel location.@paramwidthw Width of the pixel rectangle.@paramheighth Height of the pixel rectangle.@param 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. @return An object reference to an array of type defined by getTransferType() with the requested pixel data. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if outData is too small to hold the output.
Returns the height in pixels of the Raster. @return the height of this Raster
.
Class Raster, int getMinX()Returns the minimum valid X coordinate of the Raster. @return the minimum x coordinate of this Raster
.
Class Raster, int getMinY()Returns the minimum valid Y coordinate of the Raster. @return the minimum y coordinate of this Raster
.
Class Raster, int getNumBands()Returns the number of bands (samples per pixel) in this Raster. @return the number of bands of this Raster
.
Class Raster, int getNumDataElements()Returns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods. When pixels are transferred via these methods they may be transferred in a packed or unpacked format depending on the implementation of the underlying SampleModel. Using these methods pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage data type of the DataBuffer. @return the number of data elements.Class Raster, Raster getParent()
Returns the parent Raster (if any) of this Raster orClass Raster, double[] getPixel(int, int, double[])elsenull. @return the parent Raster ornull
.
Returns the samples in an array of double for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, float[] getPixel(int, int, float[])@param xHoweverTheexplicitX coordinateboundsof the pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the pixel location.@param dArray An optionally preallocated double array @return the samples for the specified pixel. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the output.
Returns the samples in an array of float for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, int[] getPixel(int, int, int[])@param xHoweverTheexplicitX coordinateboundsof the pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the pixel location.@param fArray An optionally preallocated float array @return the samples for the specified pixel. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the output.
Returns the samples in an array of int for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, double[] getPixels(int, int, int, int, double[])@param xHoweverTheexplicitX coordinateboundsof the pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the pixel location.@param iArray An optionally preallocated int array @return the samples for the specified pixel. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the output.
Returns a double 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.Class Raster, float[] getPixels(int, int, int, int, float[])@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the upper-left pixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param dArray An optionally pre-allocated double array @return the samples for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the output.
Returns a float 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.Class Raster, int[] getPixels(int, int, int, int, int[])@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of theupper leftpixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param fArray An optionally pre-allocated float array @return the samples for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the output.
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.Class Raster, int getSample(int, int, int)@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the upper-left pixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param iArray An optionally pre-allocated int array @return the samples for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the output.
Returns the sample in a specified band for the pixel located at (x y) as an int. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param xClass Raster, double getSampleDouble(int, int, int)TheyX coordinatethe coordinates of the pixel location.@paramyb TheYbandcoordinatetoofreturn @return the sample in the specified band for the pixellocationat the specified coordinate. @param bthrows ArrayIndexOutOfBoundsExceptionTheif the coordinates or the bandtoindexreturnare not in bounds.
Returns the sample in a specified band for a pixel located at (x y) as a double. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param xClass Raster, float getSampleFloat(int, int, int)TheyX coordinatethe coordinates of the pixel location.@paramyb TheYbandcoordinatetoofreturn @return the sample in the specified band for the pixellocationat the specified coordinate. @param bthrows ArrayIndexOutOfBoundsExceptionTheif the coordinates or the bandtoindexreturnare not in bounds.
Returns the sample in a specified band for the pixel located at (x y) as a float. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param xClass Raster, SampleModel getSampleModel()TheyX coordinatethe coordinates of the pixel location.@paramyb TheYbandcoordinatetoofreturn @return the sample in the specified band for the pixellocationat the specified coordinate. @param bthrows ArrayIndexOutOfBoundsExceptionTheif the coordinates or the bandtoindexreturnare not in bounds.
Returns the SampleModel that describes the layout of the image data. @return theClass Raster, int getSampleModelTranslateX()SampleModel
of thisRaster
.
Returns the X translation from the coordinate system of the SampleModel to that of the Raster. To convert a pixel's X coordinate from the Raster coordinate system to the SampleModel coordinate system this value must be subtracted. @return the X translation from the coordinate space of the Raster's SampleModel to that of the Raster.Class Raster, int getSampleModelTranslateY()
Returns the Y translation from the coordinate system of the SampleModel to that of the Raster. To convert a pixel's Y coordinate from the Raster coordinate system to the SampleModel coordinate system this value must be subtracted. @return the Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.Class Raster, double[] getSamples(int, int, int, int, int, double[])
Returns the samples for a specified band for a specified rectangle of pixels in a double array one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, float[] getSamples(int, int, int, int, int, float[])@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the upper-left pixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param b The band to return.@param dArray An optionally pre-allocated double array @return the samples for the specified band for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if dArray is too small to hold the output.
Returns the samples for a specified band for the specified rectangle of pixels in a float array one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, int[] getSamples(int, int, int, int, int, int[])@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the upper-left pixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param b The band to return.@param fArray An optionally pre-allocated float array @return the samples for the specified band for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if fArray is too small to hold the output.
Returns the samples for a specified band for the specified rectangle of pixels in an int array one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.Class Raster, int getTransferType()@param x TheHoweverXexplicitcoordinate of theboundsupper left pixel locationchecking is not guaranteed. @paramyxTheyY coordinatethe coordinates of the upper-left pixel location.@param w Width of the pixel rectangle.@param h Height of the pixel rectangle.@param b The band to return.@param iArray An optionally pre-allocated int array @return the samples for the specified band for the specified rectangle of pixels. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if iArray is too small to hold the output.
Returns the TransferType used to transfer pixels via the getDataElements and setDataElements methods. When pixels are transferred via these methods they may be transferred in a packed or unpacked format depending on the implementation of the underlying SampleModel. Using these methods pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage data type of the DataBuffer. The TransferType will be one of the types defined in DataBuffer. @return this transfer type.Class Raster, int getWidth()
Returns the width in pixels of the Raster. @return the width of this Raster
.
Creates a zeroed destination Raster with the correct size and number of bands. The IllegalArgumentException may be thrown if the source Raster is incompatible with the types of Rasters allowed by the class implementing this filter. @param src the sourceClass RasterOp, WritableRaster filter(Raster, WritableRaster)Raster
@return aWritableRaster
that is compatible withsrc
Performs a single-input/single-output operation from a source Raster to a destination Raster. If the destination Raster is null a new Raster will be created. The IllegalArgumentException may be thrown if the source and/or destination Raster is incompatible with the types of Rasters allowed by the class implementing this filter. @param src the sourceClass RasterOp, Rectangle2D getBounds2D(Raster)Raster
@param dest the destinationWritableRaster
@return aWritableRaster
that represents the result of the filtering operation.
Returns the bounding box of the filtered destination Raster. The IllegalArgumentException may be thrown if the source Raster is incompatible with the types of Rasters allowed by the class implementing this filter. @param src the sourceClass RasterOp, Point2D getPoint2D(Point2D, Point2D)Raster
@return aRectangle2D
that is the bounding box of theRaster
resulting from the filtering operation.
Returns the location of the destination point given a point in the source Raster. If dstPt is non-null it will be used to hold the return value. @param srcPt the sourceClass RasterOp, RenderingHints getRenderingHints()Point2D
@param dstPt the destinationPoint2D
@return the location of the destination point.
Returns the rendering hints for this RasterOp. Returns null if no hints have been set. @return theRenderingHints
object of thisRasterOp
.
Returns the ColorModel associated with this image. All Rasters returned from this image will have this as their ColorModel. This can return null. @return the ColorModel
of this image.
Class RenderedImage, Raster getData()Returns the image as one large tile (for tile based images this will require fetching the whole image and copying the image data over). The Raster returned is a copy of the image data and will not be updated if the image is changed. @return the image as one large tile.Class RenderedImage, Raster getData(Rectangle)
Computes and returns an arbitrary region of the RenderedImage. The Raster returned is a copy of the image data and will not be updated if the image is changed. @param rect the region of the RenderedImage to be returned. @return the region of theClass RenderedImage, int getHeight()RenderedImage
indicated by the specifiedRectangle
.
Returns the height of the RenderedImage. @return the height of this RenderedImage
.
Class RenderedImage, int getMinTileX()Returns the minimum tile index in the X direction. @return the minimum tile index in the X direction.Class RenderedImage, int getMinTileY()
Returns the minimum tile index in the Y direction. @return the minimum tile index in the X direction.Class RenderedImage, int getMinX()
Returns the minimum X coordinate (inclusive) of the RenderedImage. @return the X coordinate of this RenderedImage
.
Class RenderedImage, int getMinY()Returns the minimum Y coordinate (inclusive) of the RenderedImage. @return the Y coordinate of this RenderedImage
.
Class RenderedImage, int getNumXTiles()Returns the number of tiles in the X direction. @return the number of tiles in the X direction.Class RenderedImage, int getNumYTiles()
Returns the number of tiles in the Y direction. @return the number of tiles in the Y direction.Class RenderedImage, Object getProperty(String)
Gets a property from the property set of this image. The set of properties and whether it is immutable is determined by the implementing class. This method returns java.awt.Image.UndefinedProperty if the specified property is not defined for this RenderedImage. @param name the name of the property @return the property indicated by the specified name. @see java.awt.Image#UndefinedPropertyClass RenderedImage, SampleModel getSampleModel()
Returns the SampleModel associated with this image. All Rasters returned from this image will have this as their SampleModel. @return the SampleModel
of this image.
Class RenderedImage, Vector getSources()Returns a vector of RenderedImages that are the immediate sources of image data for this RenderedImage. This method returns null if the RenderedImage object has no information about its immediate sources. It returns an empty Vector if the RenderedImage object has no immediate sources. @return a Vector of RenderedImage
objects.
Class RenderedImage, Raster getTile(int, int)Returns tile (tileX tileY). Note that tileX and tileY are indices into the tile array not pixel locations. The Raster that is returned is live and will be updated if the image is changed. @param tileX the X index of the requested tile in the tile arrayClass RenderedImage, int getTileGridXOffset().@param tileY the Y index of the requested tile in the tile array @return the tile given the specified indices.
Returns the X offset of the tile grid relative to the origin i.e. the X coordinate of the upper-left pixel of tile (0 0). (Note that tile (0 0) may not actually exist.) @return the X offset of the tile grid relative to the origin.Class RenderedImage, int getTileGridYOffset()
Returns the Y offset of the tile grid relative to the origin i.e. the Y coordinate of the upper-left pixel of tile (0 0). (Note that tile (0 0) may not actually exist.) @return the Y offset of the tile grid relative to the origin.Class RenderedImage, int getTileHeight()
Returns the tile height in pixels. All tiles must have the same height. @return the tile height in pixels.Class RenderedImage, int getTileWidth()
Returns the tile width in pixels. All tiles must have the same width. @return the tile width in pixels.Class RenderedImage, int getWidth()
Returns the width of the RenderedImage. @return the width of this RenderedImage
.
An ImageFilter class for scaling images using the simplest algorithm. This class extends the basic ImageFilter Class to scale an existing image and provide a source for a new image containing the resampled image. The pixels in the source image are sampled to produce pixels for an image of the specified size by replicating rows and columns of pixels to scale up or omitting rows and columns of pixels to scale down. It is meant to be used in conjunction with a FilteredImageSource object to produce scaled versions of existing images. @see FilteredImageSource @see ImageFilter @version 1.12 0214 12/0203/0001 @author Jim Graham
Constructs a new RescaleOp with the desired scale factor and offset. The scaleFactor and offset will be applied to all bands in a source Raster and to all color (but not alpha) components in a BufferedImage. The RenderingHints argument may be null. @param scaleFactor the specified scale factor @param offset the specified offset @param hints the specifiedClass RescaleOp, constructor RescaleOp(float[], float[], RenderingHints)RenderingHints
ornull
Constructs a new RescaleOp with the desired scale factors and offsets. The length of the scaleFactor and offset arrays must meet the restrictions stated in the class comments above. The RenderingHints argument may be null. @param scaleFactors the specified scale factors @param offsets the specified offsets @param hints the specifiedClass RescaleOp, BufferedImage createCompatibleDestImage(BufferedImage, ColorModel)RenderingHints
ornull
Creates a zeroed destination image with the correct size and number of bands. @param src Source image for the filter operation. @param destCM ColorModel of the destination. If null the ColorModel of the source will be used. @return the zeroed-destination image.Class RescaleOp, WritableRaster createCompatibleDestRaster(Raster)
Creates a zeroedClass RescaleOp, BufferedImage filter(BufferedImage, BufferedImage)-destinationRaster
with the correct size and number of bands given this source. @param src the sourceRaster
@return the zeroed-destinationRaster
.
Rescales the source BufferedImage. If the color model in the source image is not the same as that in the destination image the pixels will be converted in the destination. If the destination image is null a BufferedImage will be created with the source ColorModel. An IllegalArgumentException may be thrown if the number of scaling factors/offsets in this object does not meet the restrictions stated in the class comments above or if the source image has an IndexColorModel. @param src theClass RescaleOp, WritableRaster filter(Raster, WritableRaster)BufferedImage
to be filtered @param dst the destination for the filtering operation ornull
@return the filteredBufferedImage
. @throws IllegalArgumentException if theColorModel
ofsrc
is anIndexColorModel
or if the number of scaling factors and offsets in thisRescaleOp
do not meet the requirements stated in the class comments.
Rescales the pixel data in the source Raster. If the destination Raster is null a new Raster will be created. The source and destination must have the same number of bands. Otherwise an IllegalArgumentException is thrown. Note that the number of scaling factors/offsets in this object must meet the restrictions stated in the class comments above. Otherwise an IllegalArgumentException is thrown. @param src theClass RescaleOp, Rectangle2D getBounds2D(Raster)Raster
to be filtered @param dst the destination for the filtering operation ornull
@return the filteredWritableRaster
. @throws IllegalArgumentException ifsrc
anddst
do not have the same number of bands or if the number of scaling factors and offsets in thisRescaleOp
do not meet the requirements stated in the class comments.
Returns the bounding box of the rescaled destination Raster. Since this is not a geometric operation the bounding box does not change. @param src the rescaled destinationClass RescaleOp, int getNumFactors()Raster
@return the bounds of the specifiedRaster
.
Returns the number of scaling factors and offsets used in this RescaleOp. @return the number of scaling factors and offsets of this RescaleOp
.
Class RescaleOp, float[] getOffsets(float[])Returns the offsets in the given array. The array is also returned for convenience. If offsets is null a new array will be allocated. @param offsets the array to contain the offsets of thisClass RescaleOp, Point2D getPoint2D(Point2D, Point2D)RescaleOp
@return the offsets of thisRescaleOp
.
Returns the location of the destination point given a point in the source. If dstPt is non-null it will be used to hold the return value. Since this is not a geometric operation the srcPt will equal the dstPt. @param srcPt a point in the source image @param dstPt the destination point or null
@return the location of the destination point.
Class RescaleOp, RenderingHints getRenderingHints()Returns the rendering hints for this op. @return the rendering hints of this RescaleOp
.
Class RescaleOp, float[] getScaleFactors(float[])Returns the scale factors in the given array. The array is also returned for convenience. If scaleFactors is null a new array will be allocated. @param scaleFactors the array to contain the scale factors of thisRescaleOp
@return the scale factors of thisRescaleOp
.
This abstract class defines an interface for extracting samples of pixels in an image. All image data is expressed as a collection of pixels. Each pixel consists of a number of samples. A sample is a datum for one band of an image and a band consists of all samples of a particular type in an image. For example a pixel might contain three samples representing its red green and blue components. There are three bands in the image containing this pixel. One band consists of all the red samples from all pixels in the image. The second band consists of all the green samples and the remaining band consists of all of the blue samples. The pixel can be stored in various formats. For example all samples from a particular band can be stored contiguously or all samples from a single pixel can be stored contiguously.Class SampleModel, SampleModel createCompatibleSampleModel(int, int)Subclasses of SampleModel specify the types of samples they can represent (e.g. unsigned 8-bit byte signed 16-bit short etc.) and may specify how the samples are organized in memory. In the Java 2D(tm) API
allbuilt-in image processingand display operators process samples whichoperators may not operate on allrepresentpossible sample types but generally will work for unsigned integralvaluessamples of 16 bits or less. Some operators support a wider variety of sample types.A collection of pixels is represented as a Raster which consists of a DataBuffer and a SampleModel. The SampleModel allows access to samples in the DataBuffer and may provide low-level information that a programmer can use to directly manipulate samples and pixels in the DataBuffer.
This class is generally a fall back method for dealing with images. More efficient code will cast the SampleModel to the appropriate subclass and extract the information needed to directly manipulate pixels in the DataBuffer. @see java.awt.image.DataBuffer @see java.awt.image.Raster @see java.awt.image.ComponentSampleModel @see java.awt.image.PixelInterleavedSampleModel @see java.awt.image.BandedSampleModel @see java.awt.image.MultiPixelPackedSampleModel @see java.awt.image.SinglePixelPackedSampleModel
Creates a SampleModel which describes data in this SampleModel's format but with a different width and height. @param w the width of the image data @param h the height of the image data @return aClass SampleModel, DataBuffer createDataBuffer()SampleModel
describing the same image data as thisSampleModel
but with a different size.
Creates a DataBuffer that corresponds to this SampleModel. The DataBuffer's width and height will match this SampleModel's. @return aClass SampleModel, SampleModel createSubsetSampleModel(int[])DataBuffer
corresponding to thisSampleModel
.
Creates a new SampleModel with a subset of the bands of this SampleModel. @param bands the subset of bands of thisClass SampleModel, Object getDataElements(int, int, Object, DataBuffer)SampleModel
@return aSampleModel
with a subset of bands of thisSampleModel
.
Returns data for a single pixel 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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class SampleModel, Object getDataElements(int, int, int, int, Object, DataBuffer)INTDOUBLE. Data may be returned in a packed format thus increasing efficiency for data transfers. Generally obj should be passed in as null so that the Object will be created automatically and will be of the right primitive data type.The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by SampleModelsm1
to DataBufferdb2
whose storage layout is described by SampleModelsm2
. The transfer will generally be more efficient than using getPixel/setPixel.SampleModel sm1 sm2; DataBuffer db1 db2; sm2.setDataElements(x y sm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.If obj is non-null it should be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is non-null and is not large enough to hold the pixel data. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param obj If non-null a primitive array in which to return the pixel data. @param data The DataBuffer containing the image data. @return the data elements for the specified pixel. @see #getNumDataElements @see #getTransferType @see java.awt.image.DataBuffer @see #setDataElements(int int Object DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if obj is too small to hold the output.
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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class SampleModel, int getDataType()INTDOUBLE. Data may be returned in a packed format thus increasing efficiency for data transfers. Generally obj should be passed in as null so that the Object will be created automatically and will be of the right primitive data type.The following code illustrates transferring data for a rectangular region of pixels from DataBuffer
db1
whose storage layout is described by SampleModelsm1
to DataBufferdb2
whose storage layout is described by SampleModelsm2
. The transfer will generally be more efficient than using getPixels/setPixels.SampleModel sm1 sm2; DataBuffer db1 db2; sm2.setDataElements(x y w h sm1.getDataElements(x y w h null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.If obj is non-null it should be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is non-null and is not large enough to hold the pixel data. @param x The minimum X coordinate of the pixel rectangle. @param y The minimum Y coordinate of the pixel rectangle. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param obj If non-null a primitive array in which to return the pixel data. @param data The DataBuffer containing the image data. @return the data elements for the specified region of pixels. @see #getNumDataElements @see #getTransferType @see #setDataElements(int int int int Object DataBuffer) @see java.awt.image.DataBuffer @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if obj is too small to hold the output.
Returns the data type of the DataBuffer storing the pixel data. @return the data type.Class SampleModel, int getHeight()
Returns the height in pixels. @return the height in pixels of the region of image data that this SampleModel
describes.
Class SampleModel, int getNumBands()Returns the total number of bands of image data. @return the number of bands of image data that this SampleModel
describes.
Class SampleModel, int getNumDataElements()Returns the number of data elements needed to transfer a pixel via the getDataElements and setDataElements methods. When pixels are transferred via these methods they may be transferred in a packed or unpacked format depending on the implementation of the SampleModel. Using these methods pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage DataType. @return the number of data elements. @see #getDataElements(int int Object DataBuffer) @see #getDataElements(int int int int Object DataBuffer) @see #setDataElements(int int Object DataBuffer) @see #setDataElements(int int int int Object DataBuffer) @see #getTransferTypeClass SampleModel, double[] getPixel(int, int, double[], DataBuffer)
Returns the samples for the specified pixel in an array of double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param dArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified pixel. @see #setPixel(int int double[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the output.Class SampleModel, float[] getPixel(int, int, float[], DataBuffer)
Returns the samples for the specified pixel in an array of float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param fArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified pixel. @see #setPixel(int int float[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the output.Class SampleModel, int[] getPixel(int, int, int[], DataBuffer)
Returns the samples for a specified pixel in an int array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param xClass SampleModel, double[] getPixels(int, int, int, int, double[], DataBuffer)The X coordinate of the pixel location. @paramy TheY coordinatecoordinates of the pixel location.@param iArray If non-null returns the samples in this array.@param data The DataBuffer containing the image data @return the samples for the specified pixel. @see #setPixel(int int int[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the output.
Returns all samples for a rectangle of pixels in a double array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param dArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified region of pixels. @see #setPixels(int int int int double[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the output.Class SampleModel, float[] getPixels(int, int, int, int, float[], DataBuffer)
Returns all samples for a rectangle of pixels in a float array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param fArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified region of pixels. @see #setPixels(int int int int float[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the output.Class SampleModel, int[] getPixels(int, int, int, int, int[], DataBuffer)
Returns all samples for a rectangle of pixels in an int array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param iArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified region of pixels. @see #setPixels(int int int int int[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the output.Class SampleModel, int getSample(int, int, int, DataBuffer)
Returns the sample in a specified band for the pixel located at (x y) as an int. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to return. @param data The DataBuffer containing the image data. @return the sample in a specified band for the specified pixel. @see #setSample(int int int int DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, double getSampleDouble(int, int, int, DataBuffer)
Returns the sample in a specified band for a pixel located at (x y) as a double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to return. @param data The DataBuffer containing the image data. @return the sample in a specified band for the specified pixel. @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, float getSampleFloat(int, int, int, DataBuffer)
Returns the sample in a specified band for the pixel located at (x y) as a float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to return. @param data The DataBuffer containing the image data. @return the sample in a specified band for the specified pixel. @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, int[] getSampleSize()
Returns the size in bits of samples for all bands. @return the size of samples for all bands.Class SampleModel, int getSampleSize(int)
Returns the size in bits of samples for the specified band. @param band the specified band @return the size of the samples of the specified band.Class SampleModel, double[] getSamples(int, int, int, int, int, double[], DataBuffer)
Returns the samples for a specified band for a specified rectangle of pixels in a double array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to return. @param dArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified band for the specified region of pixels. @see #setSamples(int int int int int double[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if dArray is too small to hold the output.Class SampleModel, float[] getSamples(int, int, int, int, int, float[], DataBuffer)
Returns the samples for a specified band for the specified rectangle of pixels in a float array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to return. @param fArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified band for the specified region of pixels. @see #setSamples(int int int int int float[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if fArray is too small to hold the output.Class SampleModel, int[] getSamples(int, int, int, int, int, int[], DataBuffer)
Returns the samples for a specified band for the specified rectangle of pixels in an int array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to return. @param iArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified band for the specified region of pixels. @see #setSamples(int int int int int int[] DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if iArray is too small to hold the output.Class SampleModel, int getTransferType()
Returns the TransferType used to transfer pixels via the getDataElements and setDataElements methods. When pixels are transferred via these methods they may be transferred in a packed or unpacked format depending on the implementation of the SampleModel. Using these methods pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage DataType. The TransferType will be one of the types defined in DataBuffer. @return the transfer type. @see #getDataElements(int int Object DataBuffer) @see #getDataElements(int int int int Object DataBuffer) @see #setDataElements(int int Object DataBuffer) @see #setDataElements(int int int int Object DataBuffer) @see #getNumDataElements @see java.awt.image.DataBufferClass SampleModel, int getWidth()
Returns the width in pixels. @return the width in pixels of the region of image data that this SampleModel
describes.
Class SampleModel, void setDataElements(int, int, Object, DataBuffer)Sets the data for a single pixel in the specified DataBuffer from 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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class SampleModel, void setDataElements(int, int, int, int, Object, DataBuffer)INTDOUBLE. Data in the array may be in a packed format thus increasing efficiency for data transfers.The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by SampleModelsm1
to DataBufferdb2
whose storage layout is described by SampleModelsm2
. The transfer will generally be more efficient than using getPixel/setPixel.SampleModel sm1 sm2; DataBuffer db1 db2; sm2.setDataElements(x y sm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.obj must be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is not large enough to hold the pixel data. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param obj A primitive array containing pixel data. @param data The DataBuffer containing the image data. @see #getNumDataElements @see #getTransferType @see #getDataElements(int int Object DataBuffer) @see java.awt.image.DataBuffer @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if obj is too small to hold the input.
Sets the data for a rectangle of pixels in the specified DataBuffer from 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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class SampleModel, void setPixel(int, int, double[], DataBuffer)INTDOUBLE. Data in the array may be in a packed format thus increasing efficiency for data transfers.The following code illustrates transferring data for a rectangular region of pixels from DataBuffer
db1
whose storage layout is described by SampleModelsm1
to DataBufferdb2
whose storage layout is described by SampleModelsm2
. The transfer will generally be more efficient than using getPixels/setPixels.SampleModel sm1 sm2; DataBuffer db1 db2; sm2.setDataElements(x y w h sm1.getDataElements(x y w h null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.obj must be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is not large enough to hold the pixel data. @param x The minimum X coordinate of the pixel rectangle. @param y The minimum Y coordinate of the pixel rectangle. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param obj A primitive array containing pixel data. @param data The DataBuffer containing the image data. @see #getNumDataElements @see #getTransferType @see #getDataElements(int int int int Object DataBuffer) @see java.awt.image.DataBuffer @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if obj is too small to hold the input.
Sets a pixel in the DataBuffer using a double array of samples for input. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param dArray The input samples in a double array. @param data The DataBuffer containing the image data. @see #getPixel(int int double[] DataBuffer) @throws NullPointerException if dArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the input.Class SampleModel, void setPixel(int, int, float[], DataBuffer)
Sets a pixel in the DataBuffer using a float array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param fArray The input samples in a float array. @param data The DataBuffer containing the image data. @see #getPixel(int int float[] DataBuffer) @throws NullPointerException if fArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the input.Class SampleModel, void setPixel(int, int, int[], DataBuffer)
Sets a pixel in the DataBuffer using an int array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getPixel(int int int[] DataBuffer) @throws NullPointerException if iArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the input.Class SampleModel, void setPixels(int, int, int, int, double[], DataBuffer)
Sets all samples for a rectangle of pixels from a double array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param dArray The input samples in a double array. @param data The DataBuffer containing the image data. @see #getPixels(int int int int double[] DataBuffer) @throws NullPointerException if dArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the input.Class SampleModel, void setPixels(int, int, int, int, float[], DataBuffer)
Sets all samples for a rectangle of pixels from a float array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param fArray The input samples in a float array. @param data The DataBuffer containing the image data. @see #getPixels(int int int int float[] DataBuffer) @throws NullPointerException if fArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the input.Class SampleModel, void setPixels(int, int, int, int, int[], DataBuffer)
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getPixels(int int int int int[] DataBuffer) @throws NullPointerException if iArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the input.Class SampleModel, void setSample(int, int, int, double, DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a double for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as a double. @param data The DataBuffer containing the image data. @see #getSample(int int int DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, void setSample(int, int, int, float, DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a float for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as a float. @param data The DataBuffer containing the image data. @see #getSample(int int int DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, void setSample(int, int, int, int, DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using an int for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as an int. @param data The DataBuffer containing the image data. @see #getSample(int int int DataBuffer) @throws NullPointerException if data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class SampleModel, void setSamples(int, int, int, int, int, double[], DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to set. @param dArray The input samples in a double array. @param data The DataBuffer containing the image data. @see #getSamples(int int int int int double[] DataBuffer) @throws NullPointerException if dArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if dArray is too small to hold the input.Class SampleModel, void setSamples(int, int, int, int, int, float[], DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to set. @param fArray The input samples in a float array. @param data The DataBuffer containing the image data. @see #getSamples(int int int int int float[] DataBuffer) @throws NullPointerException if fArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if fArray is too small to hold the input.Class SampleModel, void setSamples(int, int, int, int, int, int[], DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to set. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getSamples(int int int int int int[] DataBuffer) @throws NullPointerException if iArray or data is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if iArray is too small to hold the input.
Constructs a ShortLookupTable object from an array of shorts representing a lookup table for each band. The offset will be subtracted from the input values before indexing into the array. The data array is stored as a reference. @param offset the value subtracted from the input values before indexing into the arrays @param data an array of shortsClass ShortLookupTable, constructor ShortLookupTable(int, short[][])
Constructs a ShortLookupTable object from an array of short arrays representing a lookup table for each band. The offset will be subtracted from the input values before indexing into the arrays. The number of bands is the length of the data argument. The data array for each band is stored as a reference. @param offset the value subtracted from the input values before indexing into the arrays @param data an array of short arrays representing a lookup table for each band
Class SinglePixelPackedSampleModel, int[] getBitMasks()ThisCreatescreatesa new SinglePixelPackedSampleModel with the specified width and height. The new SinglePixelPackedSampleModel will have the same storage data type and bit masks as this SinglePixelPackedSampleModel. @param w the width of the resultingSampleModel
@param h the height of the resultingSampleModel
@return aSinglePixelPackedSampleModel
with the specified width and height. @throws IllegalArgumentException ifw
orh
is not greater than 0
Returns the bit masks for all bands. @return the bit masks for all bands.Class SinglePixelPackedSampleModel, int[] getBitOffsets()
Returns the bit offsets into the data array element representing a pixel for all bands. @return the bit offsets representing a pixel for all bands.Class SinglePixelPackedSampleModel, Object getDataElements(int, int, Object, DataBuffer)
Returns data for a single pixel in a primitive array of type TransferType. For a SinglePixelPackedSampleModel the array will have one element and the type will be the same as the storage data type. Generally obj should be passed in as null so that the Object will be created automatically and will be of the right primitive data type.Class SinglePixelPackedSampleModel, int getOffset(int, int)The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by SinglePixelPackedSampleModelsppsm1
to DataBufferdb2
whose storage layout is described by SinglePixelPackedSampleModelsppsm2
. The transfer will generally be more efficient than using getPixel/setPixel.SinglePixelPackedSampleModel sppsm1 sppsm2; DataBufferInt db1 db2; sppsm2.setDataElements(x y sppsm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.If obj is non-null it should be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is non-null and is not large enough to hold the pixel data. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param obj If non-null a primitive array in which to return the pixel data. @param data The DataBuffer containing the image data. @return the data for the specified pixel. @see #setDataElements(int int Object DataBuffer)
Returns the offset (in data array elements) of pixel (x y). The data element containing pixelClass SinglePixelPackedSampleModel, int[] getPixel(int, int, int[], DataBuffer)x y
can be retrieved from a DataBufferdata
with a SinglePixelPackedSampleModelsppsm
as:data.getElem(sppsm.getOffset(x y));@param x y the coordinates of the specified pixel @return the offset of the specified pixel.
Returns all samples in for the specified pixel in an int array. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param iArray If non-null returns the samples in this array @param data The DataBuffer containing the image data. @return all samples for the specified pixel. @see #setPixel(int int int[] DataBuffer)Class SinglePixelPackedSampleModel, int[] getPixels(int, int, int, int, int[], DataBuffer)
Returns all samples for the specified rectangle of pixels in an int array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param iArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return all samples for the specified region of pixels. @see #setPixels(int int int int int[] DataBuffer)Class SinglePixelPackedSampleModel, int getSample(int, int, int, DataBuffer)
Returns as int the sample in a specified band for the pixel located at (x y). ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to return. @param data The DataBuffer containing the image data. @return the sample in a specified band for the specified pixel. @see #setSample(int int int int DataBuffer)Class SinglePixelPackedSampleModel, int[] getSamples(int, int, int, int, int, int[], DataBuffer)
Returns the samples for a specified band for the specified rectangle of pixels in an int array one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to return. @param iArray If non-null returns the samples in this array. @param data The DataBuffer containing the image data. @return the samples for the specified band for the specified region of pixels. @see #setSamples(int int int int int int[] DataBuffer)Class SinglePixelPackedSampleModel, int getScanlineStride()
Returns the scanline stride of this SinglePixelPackedSampleModel. @return the scanline stride of this SinglePixelPackedSampleModel
.
Class SinglePixelPackedSampleModel, void setDataElements(int, int, Object, DataBuffer)Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. For a SinglePixelPackedSampleModel only the first element of the array will hold valid data and the type of the array must be the same as the storage data type of the SinglePixelPackedSampleModel.Class SinglePixelPackedSampleModel, void setPixel(int, int, int[], DataBuffer)The following code illustrates transferring data for one pixel from DataBuffer
db1
whose storage layout is described by SinglePixelPackedSampleModelsppsm1
to DataBufferdb2
whose storage layout is described by SinglePixelPackedSampleModelsppsm2
. The transfer will generally be more efficient than using getPixel/setPixel.SinglePixelPackedSampleModel sppsm1 sppsm2; DataBufferInt db1 db2; sppsm2.setDataElements(x y sppsm1.getDataElements(x y null db1) db2);Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands corresponding bands have the same number of bits per sample and the TransferTypes are the same.obj must be a primitive array of type TransferType. Otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if obj is not large enough to hold the pixel data. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param obj A primitive array containing pixel data. @param data The DataBuffer containing the image data. @see #getDataElements(int int Object DataBuffer)
Sets a pixel in the DataBuffer using an int array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getPixel(int int int[] DataBuffer)Class SinglePixelPackedSampleModel, void setPixels(int, int, int, int, int[], DataBuffer)
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getPixels(int int int int int[] DataBuffer)Class SinglePixelPackedSampleModel, void setSample(int, int, int, int, DataBuffer)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using an int for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as an int. @param data The DataBuffer containing the image data. @see #getSample(int int int DataBuffer)Class SinglePixelPackedSampleModel, void setSamples(int, int, int, int, int, int[], DataBuffer)
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w The width of the pixel rectangle. @param h The height of the pixel rectangle. @param b The band to set. @param iArray The input samples in an int array. @param data The DataBuffer containing the image data. @see #getSamples(int int int int int int[] DataBuffer)
Constructs a WritableRaster with the given SampleModel and DataBuffer. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be compatible with SampleModel. @param sampleModel The SampleModel that specifies the layout. @param dataBuffer The DataBuffer that contains the image data. @param origin The Point that specifies the origin. @throws RasterFormatException if computing eitherClass WritableRaster, constructor WritableRaster(SampleModel, DataBuffer, Rectangle, Point, WritableRaster)origin.x + sampleModel.getWidth()
ororigin.y + sampleModel.getHeight()
results in integer overflow
Constructs a WritableRaster with the given SampleModel DataBuffer and parent. aRegion specifies the bounding rectangle of the new Raster. When translated into the base Raster's coordinate system aRegion must be contained by the base Raster. (The base Raster is the Raster's ancestor which has no parent.) sampleModelTranslate specifies the sampleModelTranslateX and sampleModelTranslateY values of the new Raster. Note that this constructor should generally be called by other constructors or create methods it should not be used directly. @param sampleModel The SampleModel that specifies the layout. @param dataBuffer The DataBuffer that contains the image data. @param aRegion The Rectangle that specifies the image area. @param sampleModelTranslate The Point that specifies the translation from SampleModel to Raster coordinates. @param parent The parent (if any) of this raster. @throws RasterFormatException ifClass WritableRaster, constructor WritableRaster(SampleModel, Point)aRegion
has width or height less than or equal to zero or computing eitheraRegion.x + aRegion.width
oraRegion.y + aRegion.height
results in integer overflow
Constructs a WritableRaster with the given SampleModel. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the WritableRaster is automatically created. @param sampleModel The SampleModel that specifies the layout. @param origin The Point that specifies the origin. @throws RasterFormatException if computing eitherClass WritableRaster, WritableRaster createWritableChild(int, int, int, int, int, int, int[])origin.x + sampleModel.getWidth()
ororigin.y + sampleModel.getHeight()
results in integer overflow
Returns a new WritableRaster which shares all or part of this WritableRaster's DataBuffer. The new WritableRaster will possess a reference to the current WritableRaster accessible through its getParent() and getWritableParent() methods.Class WritableRaster, WritableRaster createWritableTranslatedChild(int, int)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. @param parentX X coordinate of the upper left corner in this WritableRaster's coordinates. @param parentY Y coordinate of the upper left corner in this WritableRaster's coordinates. @param
widthw Width of the region starting at (parentX parentY). @paramheighth Height of the region starting at (parentX parentY). @param childMinX X coordinate of the upper left corner of the returned WritableRaster. @param childMinY Y coordinate of the upper left corner of the returned WritableRaster. @param bandList Array of band indices or null to use all bands. @return aWritableRaster
sharing all or part of theDataBuffer
of thisWritableRaster
. @exception RasterFormatException if the subregion is outside of the raster bounds. @throws RasterFormatException ifw
orh
is less than or equal to zero or computing any ofparentX + w
parentY + h
childMinX + w
orchildMinY + h
results in integer overflow
Create a WritableRaster with the same size SampleModel and DataBuffer as this one but with a different location. The new WritableRaster will possess a reference to the current WritableRaster accessible through its getParent() and getWritableParent() methods. @param childMinX X coord of the upper left corner of the new Raster. @param childMinY Y coord of the upper left corner of the new Raster. @return aClass WritableRaster, WritableRaster getWritableParent()WritableRaster
the same as this one except for the specified location. @throws RasterFormatException if computing eitherchildMinX + this.getWidth()
orchildMinY + this.getHeight()
results in integer overflow
Returns the parent WritableRaster (if any) of this WritableRaster or else null. @return the parent of thisClass WritableRaster, void setDataElements(int, int, Object)WritableRaster
ornull
.
Sets the data for a single pixel from a primitive array of type TransferType. For image data supported by the Java 2D(tm) API this will be one of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class WritableRaster, void setDataElements(int, int, Raster)INTDOUBLE. Data in the array may be in a packed format thus increasing efficiency for data transfers.There will be no explicit bounds checking on the parameters.An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if inData is not large enough to hold the pixel data. However explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is not null and references anything other than an array of TransferType. @see java.awt.image.SampleModel#setDataElements(int int Object DataBuffer) @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param inData An object reference to an array of type defined by getTransferType() and length getNumDataElements() containing the pixel data to place at x y. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if inData is too small to hold the input.
Sets the data for a rectangle of pixels from an input Raster. The input Raster must be compatible with this WritableRaster in that they must have the same number of bands corresponding bands must have the same number of bits per sample the TransferTypes and NumDataElements must be the same and the packing used by the getDataElements/setDataElements must be identical.Class WritableRaster, void setDataElements(int, int, int, int, Object)There will be no explicit bounds checking on the parameters.An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param inRaster Raster containing data to place at x y. @throws NullPointerException if inRaster is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds.
Sets the data for a rectangle of pixels from 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 DataBuffer.TYPE_INT DataBuffer.TYPE_SHORT DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_Class WritableRaster, void setPixel(int, int, double[])INTDOUBLE. Data in the array may be in a packed format thus increasing efficiency for data transfers.There will be no explicit bounds checking on the parameters.An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds or if inData is not large enough to hold the pixel data. However explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is not null and references anything other than an array of TransferType. @see java.awt.image.SampleModel#setDataElements(int int int int Object DataBuffer) @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param 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+w-1 y+h-1. @throws NullPointerException if inData is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if inData is too small to hold the input.
Sets a pixel in the DataBuffer using a double array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param dArray The input samples in a double array. @throws NullPointerException if dArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the input.Class WritableRaster, void setPixel(int, int, float[])
Sets a pixel in the DataBuffer using a float array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param fArray The input samples in a float array. @throws NullPointerException if fArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the input.Class WritableRaster, void setPixel(int, int, int[])
Sets a pixel in the DataBuffer using an int array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param iArray The input samples in a int array. @throws NullPointerException if iArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the input.Class WritableRaster, void setPixels(int, int, int, int, double[])
Sets all samples for a rectangle of pixels from a double array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param dArray The input double pixel array. @throws NullPointerException if dArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if dArray is too small to hold the input.Class WritableRaster, void setPixels(int, int, int, int, float[])
Sets all samples for a rectangle of pixels from a float array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param fArray The input float pixel array. @throws NullPointerException if fArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if fArray is too small to hold the input.Class WritableRaster, void setPixels(int, int, int, int, int[])
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. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param iArray The input int pixel array. @throws NullPointerException if iArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates are not in bounds or if iArray is too small to hold the input.Class WritableRaster, void setRect(Raster)
Copies pixels from Raster srcRaster to this WritableRaster. Each pixel in srcRaster is copied to the same x y address in this raster unless the address 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.Class WritableRaster, void setRect(int, int, Raster)If all samples of both source and destination Rasters are of integral type and less than or equal to 32 bits in size then calling this method is equivalent to executing the following code for all
x y
addresses valid in both Rasters.Raster srcRaster; WritableRaster dstRaster; for (int b = 0; bThus when copying an integral type source to an integral type destination if the source sample size is greater than the destination sample size for a particular band the high order bits of the source sample are truncated. If the source sample size is less than the destination size for a particular band the high order bits of the destination are zero-extended or sign-extended depending on whether srcRaster's SampleModel treats the sample as a signed or unsigned quantity. When copying a float or double source to an integral type destination each source sample is cast to the destination type. When copying an integral type source to a float or double destination the source is first converted to a 32-bit int (if necessary) using the above rules for integral types and then the int is cast to float or double.
@param srcRaster The Raster from which to copy pixels. @throws NullPointerException if srcRaster is null.
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 WritableRaster#setRect(Raster) @param dx The X translation factor from src space to dst space of the copy. @param dy The Y translation factor from src space to dst space of the copy. @param srcRaster The Raster from which to copy pixels. @throws NullPointerException if srcRaster is null.Class WritableRaster, void setSample(int, int, int, double)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a double for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as a double. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class WritableRaster, void setSample(int, int, int, float)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using a float for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample as a float. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class WritableRaster, void setSample(int, int, int, int)
Sets a sample in the specified band for the pixel located at (x y) in the DataBuffer using an int for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the pixel location. @param y The Y coordinate of the pixel location. @param b The band to set. @param s The input sample. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds.Class WritableRaster, void setSamples(int, int, int, int, int, double[])
Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param b The band to set. @param dArray The input double sample array. @throws NullPointerException if dArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if dArray is too small to hold the input.Class WritableRaster, void setSamples(int, int, int, int, int, float[])
Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param b The band to set. @param fArray The input float sample array. @throws NullPointerException if fArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if fArray is too small to hold the input.Class WritableRaster, void setSamples(int, int, int, int, int, int[])
Sets the samples in the specified band for the specified 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. However explicit bounds checking is not guaranteed. @param x The X coordinate of the upper left pixel location. @param y The Y coordinate of the upper left pixel location. @param w Width of the pixel rectangle. @param h Height of the pixel rectangle. @param b The band to set. @param iArray The input int sample array. @throws NullPointerException if iArray is null. @throws ArrayIndexOutOfBoundsException if the coordinates or the band index are not in bounds or if iArray is too small to hold the input.
Adds an observer. If the observer is already present it will receive multiple notifications. @param to the specified TileObserver
Class WritableRenderedImage, WritableRaster getWritableTile(int, int)Checks out a tile for writing. The WritableRenderedImage is responsible for notifying all of its TileObservers when a tile goes from having no writers to having one writer. @param tileX the X index of the tile. @param tileY the Y index of the tile. @return a writable tile.Class WritableRenderedImage, Point[] getWritableTileIndices()
Returns an array of Point objects indicating which tiles are checked out for writing. Returns null if none are checked out. @return an array containing the locations of tiles that are checked out for writing.Class WritableRenderedImage, boolean hasTileWriters()
Returns whether any tile is checked out for writing. Semantically equivalent to (getWritableTileIndices() = null). @returnClass WritableRenderedImage, boolean isTileWritable(int, int)true
if any tiles are checked out for writing;false
otherwise.
Returns whether a tile is currently checked out for writing. @param tileX the X index of the tile. @param tileY the Y index of the tile. @returnClass WritableRenderedImage, void removeTileObserver(TileObserver)true
if specified tile is checked out for writing;false
otherwise.
Removes an observer. If the observer was not registered nothing happens. If the observer was registered for multiple notifications it will now be registered for one fewer. @param to the specified TileObserver
Class WritableRenderedImage, void setData(Raster)Sets a rect of the image to the contents of the Raster r which is assumed to be in the same coordinate space as the WritableRenderedImage. The operation is clipped to the bounds of the WritableRenderedImage. @param r the specified Raster