Generated by
JDiff

java.awt.image Documentation Differences

This file contains all the changes in documentation in the package java.awt.image as colored differences. Deletions are shown like 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.

Class AffineTransformOp, constructor AffineTransformOp(AffineTransform, RenderingHints)

Constructs an AffineTransformOp given an affine transform. The interpolation type is determined from the RenderingHints 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 is specified (hints is null) the interpolation type is TYPE_NEAREST_NEIGHBOR @param xform The AffineTransform to use for the operation. @param hints The RenderingHints object used to specify the interpolation type for the operation. @see java.awt.RenderingHints#KEY_INTERPOLATION @see java.awt.RenderingHints#KEY_RENDERING
Class AffineTransformOp, BufferedImage filter(BufferedImage, BufferedImage)

Transforms the source BufferedImage and stores the results in the destination BufferedImage. If the color models for the two images do not match a color conversion into the destination color model is performed. If the destination image is null a BufferedImage is created with the source ColorModel.

The coordinates of the rectangle returned by getBounds2D(BufferedImage) are not necessarily the same as the coordinates of the BufferedImage returned by this method. If the upper-left corner coordinates of the rectangle are negative then this part of the rectangle is not drawn. If the upper-left corner coordinates of the rectangle are positive then the filtered image is drawn at that position in the destination BufferedImage.

An IllegalArgumentException may beis thrown if the source is the same as the destination. @param src The BufferedImage to transform. @param dst The BufferedImage in which to store the results of the transformation. @return The filtered BufferedImage. @throws IllegalArgumentException if src and dst are the same @throws ImagingOpException Ifif the image cannot be transformed because of a data-processing error that might be caused by an invalid image format tile format or image-processing operation or any other unsupported operation.

Class AffineTransformOp, WritableRaster filter(Raster, WritableRaster)

Transforms the source Raster and stores the results in the destination Raster. This operation performs the transform band by band.

If the destination Raster is null a new Raster is created. An IllegalArgumentException may be thrown if the source is the same as the destination or if the number of bands in the source is not equal to the number of bands in the destination.

The coordinates of the rectangle returned by getBounds2D(Raster) are not necessarily the same as the coordinates of the WritableRaster returned by this method. If the upper-left corner coordinates of rectangle are negative then this part of the rectangle is not drawn. If the coordinates of the rectangle are positive then the filtered image is drawn at that position in the destination Raster.

@param src The Raster to transform. @param dst The Raster in which to store the results of the transformation. @return The transformed Raster. @throws ImagingOpException Ifif the Rasterraster cannot be transformed because of a data-processing error that might be caused by an invalid image format tile format or image-processing operation or any other unsupported operation.

Class AffineTransformOp, Rectangle2D getBounds2D(BufferedImage)

Returns the bounding box of the transformed destination. The rectangle returned is the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0  0). @param src The BufferedImage to be transformed. @return The Rectangle2D representing the destination's bounding box.
Class AffineTransformOp, Rectangle2D getBounds2D(Raster)

Returns the bounding box of the transformed destination. The rectangle returned will be the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0  0). @param src The Raster to be transformed. @return The Rectangle2D representing the destination's bounding box.

Class AreaAveragingScaleFilter

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 ReplicateImageFilterReplicateScaleFilter @see ImageFilter @version 1.610 0902/2102/9800 @author Jim Graham
Class AreaAveragingScaleFilter, void setHints(int)

Detect if the data is being delivered with the necessary hints to allow the averaging algorithm to do its work.

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. @see ImageConsumer#setHints

Class AreaAveragingScaleFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

Combine the components for the delivered byte pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. If the correct hints were not specified in the setHints call then relay the work to our superclass which is capable of scaling pixels regardless of the delivery hints.

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. @see ReplicateScaleFilter

Class AreaAveragingScaleFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

Combine the components for the delivered int pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. If the correct hints were not specified in the setHints call then relay the work to our superclass which is capable of scaling pixels regardless of the delivery hints.

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. @see ReplicateScaleFilter


Class BandedSampleModel

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 datatypes
Class BandedSampleModel, constructor BandedSampleModel(int, int, int, int)

Constructs a BandedSampleModel with the specified parameters. The pixel stride will be one data element. The scanline stride will be the same as the width. Each band will be stored in a separate bank and all band offsets will be zero. @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. @param numBands The number of bands for the image data. @throws IllegalArgumentException if dataType is not one of the supported data types
Class 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. @param numBands The number of bands for the image data. @param scanlineStride 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 if dataType is not one of the supported data types
Class BandedSampleModel, SampleModel createCompatibleSampleModel(int, int)

Creates a new BandedSampleModel with the specified width and height. The new BandedSampleModel will have the same number of bands storage data type and bank indices as this BandedSampleModel. The band offsets will be compressed such that the offset between bands will be w*pixelStride and the minimum of all of the band offsets is zero. @param w the width of the resulting BandedSampleModel @param h the height of the resulting BandedSampleModel @return a new BandedSampleModel with the specified width and height. @throws IllegalArgumentException if w or h equals either Integer.MAX_VALUE or Integer.MIN_VALUE @throws IllegalArgumentException if dataType is not one of the supported data types
Class BandedSampleModel, DataBuffer createDataBuffer()

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 if dataType is not either DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_SHORT or DataBuffer.TYPE_INT
Class BandedSampleModel, SampleModel createSubsetSampleModel(int[])

Creates a new BandedSampleModel with a subset of the bands of this BandedSampleModel. The new BandedSampleModel can be used with any DataBuffer that the existing BandedSampleModel can be used with. The new BandedSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original BandedSampleModel/DataBuffer combination. @throws RasterFormatException if the number of bands is greater than the number of banks in this sample model. @throws IllegalArgumentException if dataType is not one of the supported data types

Class BufferedImage, int TYPE_INT_ARGB

Represents an image with 8-bit RGBA color components packed into integer pixels. The image has a DirectColorModel with alpha. The color data in this image is considered not to be premultiplied with alpha. When this type is used as the imageType argument to a BufferedImage constructor the created image created is consistent with images created in the JDK1.1 and earlier releases.

Class BufferedImageFilter

ThisThe BufferedImageFilter class subclasses an ImageFilter to provide a simple means of using a single-source/single-destination image operator ({@link BufferedImageOp}) to filter a BufferedImage in the Image Producer/Consumer/Observer paradigm. Examples of these image operators are: ConvolveOp AffineTransformOp and LookupOp. @see ImageFilter @see BufferedImage @see BufferedImageOp @version 10 Feb 1997
Class BufferedImageFilter, constructor BufferedImageFilter(BufferedImageOp)

Constructs a BufferedImageFilter with the specified single-source/single-destination operator. @param op the specified BufferedImageOp to use to filter a BufferedImage
Class BufferedImageFilter, BufferedImageOp getBufferedImageOp()

Returns the BufferedImageOp. @return the operator of this BufferedImageFilter.
Class BufferedImageFilter, void imageComplete(int)

Filters the information provided in the imageComplete method of the ImageConsumer interface.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. 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. @seeparam ImageConsumer#imageCompletestatus the status of image loading @throws ImagingOpException if there was a problem calling the filter method of the BufferedImageOp associated with this instance. @see ImageConsumer#imageComplete

Class BufferedImageFilter, void setColorModel(ColorModel)

Filters the information provided in the setColorModel method of the ImageConsumer interface.

If model is null this method clears the current ColorModel of this BufferedImageFilter.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. 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 ColorModel to which to set the ColorModel of this BufferedImageFilter @see ImageConsumer#setColorModel

Class BufferedImageFilter, void setDimensions(int, int)

Filters the information provided in the int setDimensions } method of the ImageConsumer interface.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. 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 to which to set the width of this BufferedImageFilter @param height the height to which to set the height of this BufferedImageFilter @see ImageConsumer#setDimensions

Class BufferedImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. 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. @throws IllegalArgumentException if width or height are less than zero. @see ImageConsumer#setPixels(int int int int ColorModel byte[] int int)

Class BufferedImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. 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. @throws IllegalArgumentException if width or height are less than zero. @see ImageConsumer#setPixels(int int int int ColorModel int[] int int)


Class ColorModel

The 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 a ColorModel is specified by its ColorSpace. A ColorModel 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 single byte or single int values. For purposes of the ColorModel class pixel value arguments were passed as ints. The Java(tm) Platform 1.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. Consequently ColorModel now has methods that accept pixel values represented as arrays of primitive types. The primitive type used by a particular ColorModel 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 of ColorModel 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) 2D API are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT. The transfer type for a particular ColorModel object is specified when the object is created either explicitly or by default. All subclasses of ColorModel 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 its Raster and of the Raster object's SampleModel (available from the getTransferType methods of these classes) must match that of the ColorModel. The number of elements in an array representing a pixel for the Raster and SampleModel (available from the getNumDataElements methods of these classes) must match that of the ColorModel.

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 a BufferedImage object's Raster 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. 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 the normalized form each component is a float value between 0.0 and 1.0. Normalized color component values are not premultiplied. @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

Class ColorModel, constructor ColorModel(int)

Constructs a ColorModel that translates pixels of the specified number of bits to color/alpha components. The color space is the default RGB ColorSpace which is sRGB. Pixel values are assumed to include alpha information. If color and alpha information are represented in the pixel value as separate spatial bands the color bands are assumed not to be premultiplied with the alpha value. The transparency type is java.awt.Transparency.TRANSLUCENT. The transfer type will be the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel (or DataBuffer.TYPE_UNDEFINED if bits is greater than 32). Since this constructor has no information about the number of bits per color and alpha component any subclass calling this constructor should override any method that requires this information. @param bits the number of bits of a pixel @exceptionthrows IllegalArgumentException if the number of bits in bits is less than 1
Class ColorModel, constructor ColorModel(int, int[], ColorSpace, boolean, boolean, int, int)

Constructs a ColorModel that translates pixel values to color/alpha components. Color components will be in the specified ColorSpace. 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 the ColorSpace 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. The boolean isAlphaPremultiplied specifies how to interpret pixel values in which color and alpha information are represented as separate spatial bands. If the boolean is true color samples are assumed to have been multiplied by the alpha sample. The transparency 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 an IndexColorModel with pixel_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 specified ColorSpace @param hasAlpha true if alpha information is present; false otherwise @param isAlphaPremultiplied true 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 @exceptionthrows IllegalArgumentException if the length of the bit array is less than the number of color or alpha components in this ColorModel or if the transparency is not a valid value. @see java.awt.Transparency
Class ColorModel, ColorModel coerceData(WritableRaster, boolean)

Forces the raster data to match the state specified in the isAlphaPremultiplied variable assuming the data is currently correctly described by this ColorModel. 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 will also return an instance of this ColorModel with the isAlphaPremultiplied flag set appropriately. This method will throw a UnsupportedOperationException if it is not supported by this ColorModel. Since ColorModel 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 an UnsupportedOperationException. @param raster the WritableRaster data @param isAlphaPremultiplied true if the alpha is premultiplied; false otherwise @return a ColorModel object that represents the coerced data.
Class ColorModel, SampleModel createCompatibleSampleModel(int, int)

Creates a SampleModel with the specified width and height that has a data layout compatible with this ColorModel. Since ColorModel 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 an UnsupportedOperationException. @param w the width to apply to the new SampleModel @param h the height to apply to the new SampleModel @return a SampleModel object with the specified width and height. @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel @see SampleModel
Class ColorModel, WritableRaster createCompatibleWritableRaster(int, int)

Creates a WritableRaster with the specified width and height that has a data layout (SampleModel) compatible with this ColorModel. Since ColorModel 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 an UnsupportedOperationException. @param w the width to apply to the new WritableRaster @param h the height to apply to the new WritableRaster @return a WritableRaster object with the specified width and height. @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel @see WritableRaster @see SampleModel
Class ColorModel, int getAlpha(Object)

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 type transferType passed in as an object reference. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. If this transferType is not supported a UnsupportedOperationException will be thrown. Since ColorModel is an abstract class any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it this method throws an exception if the subclass uses a transferType other than DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @param inData the specified pixel @return the alpha component of the specified pixel scaled from 0 to 255. @exceptionthrows ClassCastException if inData is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel @exceptionthrows UnsupportedOperationException if this tranferType is not supported by this ColorModel
Class ColorModel, WritableRaster getAlphaRaster(WritableRaster)

Returns a Raster representing the alpha channel of an image extracted from the input Raster provided that pixel values of this ColorModel represent color and alpha information as separate spatial bands (e.g. ComponentColorModel and DirectColorModel). This method assumes that Raster objects associated with such a ColorModel store the alpha band if present as the last band of image data. Returns null if there is no separate spatial alpha channel associated with this ColorModel. If this is an IndexColorModel which has alpha in the lookup table this method will return null since there is no spatially discrete alpha channel. This method will create a new Raster (but will share the data array). Since ColorModel is an abstract class any instance is an instance of a subclass. Subclasses must override this method to get any behavior other than returning null because the implementation in this abstract class returns null. @param raster the specified Raster @return a Raster representing the alpha channel of an image obtained from the specified Raster.
Class ColorModel, int getBlue(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value is a non pre-multiplied value. For example 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. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. If this transferType is not supported a UnsupportedOperationException will be thrown. Since ColorModel is an abstract class any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it this method throws an exception if the subclass uses a transferType other than DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the blue component of the specified pixel. @exceptionthrows ClassCastException if inData is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel @exceptionthrows UnsupportedOperationException if this tranferType is not supported by this ColorModel
Class ColorModel, int getComponentSize(int)

Returns the number of bits for the specified color/alpha component. Color components are indexed in the order specified by the ColorSpace. Typically this order reflects the name of the color space type. For example for TYPE_RGB index 0 corresponds to red index 1 to green and index 2 to blue. If this ColorModel supports alpha the alpha component corresponds to the index following the last color component. @param componentIdx the index of the color/alpha component @return the number of bits for the color/alpha component at the specified index. @throws ArrayIndexOutOfBoundsException if componentIdx is greater than the number of components or less than zero @throws NullPointerException if the number of bits array is null
Class ColorModel, int[] getComponents(Object, int[], int)

Returns an array of unnormalized color/alpha components given a pixel in this ColorModel. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If pixel is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. This method can be used to retrieve the components for a specific pixel value in any ColorModel. If the components array is null a new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset). Since ColorModel 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 an UnsupportedOperationException. @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 the components 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. @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel
Class ColorModel, int[] getComponents(int, int[], int)

Returns an array of unnormalized color/alpha components given a pixel in this ColorModel. The pixel value is specified as an int. An IllegalArgumentException will be thrown if pixel values for this ColorModel are not conveniently representable as a single int. For example this method can be used to retrieve the components for a specific pixel value in a DirectColorModel. If the components array is null a new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset). Since ColorModel 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 an UnsupportedOperationException. @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 the components 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. @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel
Class ColorModel, int getDataElement(int[], int)

Returns a pixel value represented as an int in this ColorModel given an array of unnormalized color/alpha components. This method will throw an IllegalArgumentException if pixel values for this ColorModel are not conveniently representable as a single int. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all the color and alpha components (starting at offset). Since ColorModel 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 an UnsupportedOperationException. @param components an array of unnormalized color and alpha components @param offset the index into components at which to begin retrieving the color and alpha components @return an int pixel value in this ColorModel corresponding to the specified components. @exceptionthrows IllegalArgumentException if pixel values for this ColorModel are not conveniently representable as a single int @exceptionthrows ArrayIndexOutOfBoundsException if the components array is not large enough to hold all of the color and alpha components starting at offset @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel
Class ColorModel, Object getDataElements(int, Object)

Returns a data element array representation of a pixel in this ColorModel given an integer pixel representation in the default RGB color model. This array can then be passed to the WritableRaster#setDataElements method of a WritableRaster object. If the pixel variable is null a new array will be allocated. If pixel is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. The pixel array is returned. If this transferType is not supported a UnsupportedOperationException will be thrown. Since ColorModel 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 an UnsupportedOperationException. @param rgb the integer pixel representation in the default RGB color model @param pixel the specified pixel @return an array representation of the specified pixel in this ColorModel. @exceptionthrows ClassCastException if pixel is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class ColorModel, Object getDataElements(int[], int, Object)

Returns a data element array representation of a pixel in this ColorModel given an array of unnormalized color/alpha components. This array can then be passed to the setDataElements method of a WritableRaster object. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all the color and alpha components (starting at offset). If the obj variable is null a new array will be allocated. If obj is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if obj is not large enough to hold a pixel value for this ColorModel. Since ColorModel 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 an UnsupportedOperationException. @param components an array of unnormalized color and alpha components @param offset the index into components at which to begin retrieving color and alpha components @param obj the Object representing an array of color and alpha components @return an Object representing an array of color and alpha components. @exceptionthrows ClassCastException if obj is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if obj is not large enough to hold a pixel value for this ColorModel or the components array is not large enough to hold all of the color and alpha components starting at offset @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class ColorModel, int getGreen(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value will be a non pre-multiplied value. For example if the alpha is premultiplied this method divides it out before returning the value. If the alpha value is 0 the green value is 0. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. If this transferType is not supported a UnsupportedOperationException will be thrown. Since ColorModel is an abstract class any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it this method throws an exception if the subclass uses a transferType other than DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the green component of the specified pixel. @exceptionthrows ClassCastException if inData is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel @exceptionthrows UnsupportedOperationException if this tranferType is not supported by this ColorModel
Class ColorModel, float[] getNormalizedComponents(int[], int, float[], int)

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 between 0.0 and 1.0. If the normComponents array is null a new array will be allocated. The normComponents array will be returned. Color/alpha components are stored in the normComponents array starting at normOffset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the normComponents array is not null and is not large enough to hold all the color and alpha components (starting at normOffset). An IllegalArgumentException is thrown if the components array is not large enough to hold all the color and alpha components starting at offset. @param components an array containing unnormalized components @param offset the offset into the components array at which to start retrieving unnormalized components @param normComponents an array that receives the components from components @param normOffset the index into normComponents at which to begin storing unnormalized components from components @return an array containing normalized color and alpha components. @exceptionthrows UnsupportedOperationException if the constructor of this ColorModel called the super(bits) constructor but did not override this method. See the constructor #ColorModel(int) @throws UnsupportedOperationException if this method is not supported by thisunable to determine the ColorModelnumber of bits per component
Class ColorModel, int getRed(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value is a non pre-multiplied value. For example if alpha is premultiplied this method divides it out before returning the value. If the alpha value is 0 the red value is 0. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. If this transferType is not supported a UnsupportedOperationException will be thrown. Since ColorModel is an abstract class any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it this method throws an exception if the subclass uses a transferType other than DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the red component of the specified pixel. @exceptionthrows ClassCastException if inData is not a primitive array of type transferType @exceptionthrows ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel @exceptionthrows UnsupportedOperationException if this tranferType is not supported by this ColorModel
Class ColorModel, int[] getUnnormalizedComponents(float[], int, int[], int)

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 between 0.0 and 1.0. If the components array is null a new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset). An IllegalArgumentException is thrown if the normComponents array is not large enough to hold all the color and alpha components starting at normOffset. @param normComponents an array containing normalized components @param normOffset the offset into the normComponents array at which to start retrieving normalized components @param components an array that receives the components from normComponents @param offset the index into components at which to begin storing normalized components from normComponents @return an array containing unnormalized color and alpha components. @exceptionthrows UnsupportedOperationExceptionIllegalArgumentException if thisthe methodlength of normComponents minus normOffset is not supportedless than bynumComponents @throws UnsupportedOperationException if the constructor of this ColorModel called the super(bits) constructor but did not override this method. See the constructor #ColorModel(int)
Class ColorModel, int hashCode()

Returns athe hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. The general contract of hashCode is: Whenever it is invoked on the same object more than once during an execution of a Java application the hashCode method must consistently return the same integer provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. If two objects are equal according to the equals(Object) method then calling the hashCode method on each of the two objects must produce the same integer result. It is not required that if two objects are unequal according to the java.lang.Object#equals(java.lang.Object) method then calling the hashCode method on each of the two objects must produce distinct integer results. However the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables. As much as is reasonably practical the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer but this implementation technique is not required by the JavaTM programming languageColorModel.) @return a hash code value for this object. @see java.lang.Object#equals(java.lang.Object) @see java.utilColorModel.Hashtable
Class ColorModel, boolean isCompatibleRaster(Raster)

Returns true if raster is compatible with this ColorModel and false if it is not. Since ColorModel 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 an UnsupportedOperationException. @param raster the Raster object to test for compatibility @return true if raster is compatible with this ColorModel. @exceptionthrows UnsupportedOperationException if this method has not been implemented for this ColorModel
Class ColorModel, boolean isCompatibleSampleModel(SampleModel)

Checks if the SampleModel is compatible with this ColorModel. Since ColorModel 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 an UnsupportedOperationException. @param sm the specified SampleModel @return true if the specified SampleModel is compatible with this ColorModel; false otherwise. @exceptionthrows UnsupportedOperationException if this method is not supported by this ColorModel @see SampleModel

Class ComponentColorModel, constructor ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)

Constructs a ComponentColorModel from the specified parameters. Color components will be in the specified ColorSpace. The bits array specifies the number of significant bits per color and alpha component. Its length should be the number of components in the ColorSpace if there is no alpha information in the pixel values or one more than this number if there is alpha information. An IllegalArgumentException is thrown if the length of the array does not match the number of components. hasAlpha indicates whether alpha information is present. If hasAlpha is true then the boolean isAlphaPremultiplied 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. The transparency specifies what alpha values can be represented by this color model. The acceptable transparency values are OPAQUE BITMASK or TRANSLUCENT. The transferType 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. @param colorSpace The ColorSpace associated with this color model. @param bits The number of significant bits per component. @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 the length of the length of the bits array does not match the number of components. @see ColorSpace @see java.awt.Transparency
Class ComponentColorModel, ColorModel coerceData(WritableRaster, boolean)

Forces the raster data to match the state specified in the isAlphaPremultiplied variable assuming the data is currently correctly described by this ColorModel. 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 this ColorModel with the isAlphaPremultiplied flag set appropriately. @throwsSince UnsupportedOperationExceptionColorModel If the transfercan be subclassed typesubclasses inherit the implementation of this ComponentColorModelmethod is not oneand if they ofdon't the supported transferoverride it then types:they DataBuffer.TYPE_BYTEthrow DataBuffer.TYPE_USHORTan orexception DataBufferif they use an unsupported transferType.TYPE_INT @throws NullPointerException if raster is null and data coercion is required. @throws UnsupportedOperationException Ifif the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT.
Class ComponentColorModel, int getAlpha(Object)

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 type transferType passed in as an object reference. Since ComponentColorModel 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 unsupported transferType. @param inData The pixel from which you want to get the alpha component specified by an array of data elements of type transferType. @return The alpha component for the specified pixel as an int. @throws ClassCastException If inData is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT.
Class ComponentColorModel, int getBlue(Object)

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 by an array of data elements of type transferType 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). Since ComponentColorModel 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 unsupported transferType. @param inData The pixel from which you want to get the blue color component specified by an array of data elements of type transferType. @return The blue color component for the specified pixel as an int. @throws ClassCastException If inData is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT.
Class ComponentColorModel, int[] getComponents(Object, int[], int)

Returns an array of unnormalized color/alpha components given a pixel in this ColorModel. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). Since ComponentColorModel 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 unsupported transferType. @param pixel A pixel value specified by an array of data elements of type transferType. @param components An integer array in which to store the unnormalized color/alpha components. If the components array is null a new array is allocated. @param offset An offset into the components array. @return The components array. @throws UnsupportedOperationException Ifin some cases iff the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @throws ClassCastException If pixel is not a primitive array of type transferType. @throws IllegalArgumentException If the components array is not null and is not large enough to hold all the color and alpha components (starting at offset) or if pixel is not large enough to hold a pixel value for this ColorModel.
Class ComponentColorModel, Object getDataElements(int, Object)

Returns a data element array representation of a pixel in this ColorModel given an integer pixel representation in the default RGB color model. This array can then be passed to the setDataElements method of a WritableRaster object. If the pixel parameter is null a new array is allocated. Since ComponentColorModel 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 unsupported transferType. @param rgb @param pixel The integer representation of the pixel#. @throws ClassCastException If pixel is not null and is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException If pixel is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class ComponentColorModel, Object getDataElements(int[], int, Object)

Returns a data element array representation of a pixel in this ColorModel given an array of unnormalized color/alpha components. This array can then be passed to the setDataElements method of a WritableRaster object. @param components An array of unnormalized color/alpha components. @param offset The integer offset into the components array. @param obj The object in which to store the data element array representation of the pixel. If obj variable is null a new array is allocated. If obj is not null it must be a primitive array of type transferType. An ArrayIndexOutOfBoundsException is thrown if obj is not large enough to hold a pixel value for this ColorModel. Since ComponentColorModel 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 unsupported transferType. @return The data element array representation of a pixel in this ColorModel. @throws IllegalArgumentException If the components array is not large enough to hold all the color and alpha components (starting at offset). @throws ClassCastException If obj is not null and is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException If obj is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class ComponentColorModel, int getGreen(Object)

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 by an array of data elements of type transferType 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). Since ComponentColorModel 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 unsupported transferType. @param inData The pixel from which you want to get the green color component specified by an array of data elements of type transferType. @return The green color component for the specified pixel as an int. @throws ClassCastException If inData is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT.
Class ComponentColorModel, int getRGB(Object)

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 type 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). Since ComponentColorModel 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 unsupported transferType. @param inData The pixel from which you want to get the color/alpha components specified by an array of data elements of type transferType. @return The color/alpha components for the specified pixel as an int. @throws ClassCastException If inData is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT. @see ColorModel#getRGBdefault
Class ComponentColorModel, int getRed(Object)

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 by an array of data elements of type transferType 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). Since ComponentColorModel 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 unsupported transferType. @param inData The pixel from which you want to get the red color component specified by an array of data elements of type transferType. @return The red color component for the specified pixel as an int. @throws ClassCastException If inData is not a primitive array of type transferType. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel. @throws UnsupportedOperationException If the transfer type of this ComponentColorModel is not one of the supported transfer types: DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT.

Class ComponentSampleModel

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 integral number which can be stored in 8 16 or 32 bits (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 @see java.awt.image.PixelInterleavedSampleModel @see java.awt.image.BandedSampleModel
Class ComponentSampleModel, constructor ComponentSampleModel(int, int, int, int, int, int[])

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 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. @param pixelStride The pixel stride of the region of image data described. @param scanlineStride The line stride of the region of image data described. @param bandOffsets The offsets of all bands. @throws IllegalArgumentException if w or h is not greater than 0 @throws IllegalArgumentException if pixelStride is less than 0 @throws IllegalArgumentException if scanlineStride is less than 0 @throws IllegalArgumentException if numBands is less than 1 @throws IllegalArgumentException if the product of w and h is greater than Integer.MAX_VALUE @throws IllegalArgumentException if dataType is not one of the supported data types
Class ComponentSampleModel, constructor ComponentSampleModel(int, int, int, int, int, int[], int[])

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 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. @param pixelStride The pixel stride of the region of image data described. @param scanlineStride The line stride of the region of image data described. @param bandIndices The bank indices of all bands. @param bandOffsets The band offsets of all bands. @throws IllegalArgumentException if w or h is not greater than 0 @throws IllegalArgumentException if pixelStride is less than 0 @throws IllegalArgumentException if scanlineStride is less than 0 @throws IllegalArgumentException if the length of bankIndices does not equal the length of bankOffsets @throws IllegalArgumentException if any of the bank indices of bandIndices is less than 0
Class ComponentSampleModel, SampleModel createCompatibleSampleModel(int, int)

Creates a new ComponentSampleModel with the specified width and height. The new SampleModel will have the same number of bands storage data type interleaving scheme and pixel stride as this SampleModel. @param w the width of the resulting SampleModel @param h the height of the resulting SampleModel @throws IllegalArgumentException if w or h is not greater than 0

Class CropImageFilter

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.8 0911 02/2102/9800 @author Jim Graham
Class CropImageFilter, void setDimensions(int, int)

Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.

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. @see ImageConsumer

Class CropImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

Determine whether the delivered byte pixels intersect the region to be extracted and passes through only that subset of pixels that appear in the output region.

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.

Class CropImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

Determine if the delivered int pixels intersect the region to be extracted and pass through only that subset of pixels that appear in the output region.

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.

Class CropImageFilter, void setProperties(Hashtable)

Passes along the properties from the source object after adding a property indicating the cropped region.

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.


Class DataBuffer

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 use only TYPE_BYTE TYPE_USHORT and TYPE_INT DataBuffers to store image data. @see java.awt.image.Raster @see java.awt.image.SampleModel

Class DirectColorModel

AThe DirectColorModel class is a ColorModel class that works with pixel values whichthat represent RGB color and alpha information as separate samples and whichthat 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. There must be three color samples in the pixel values and there maycan be a single alpha sample. For those methods whichthat use a primitive array pixel representation of type transferType 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.:

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 a DirectColorModel can be used in conjunction with a SinglePixelPackedSampleModel to construct a BufferedImage. Normally the masks used by the SampleModel and the ColorModel would be the same. However if they are different the color interpretation of pixel data will be done according to the masks of the ColorModel.

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 ColorModel.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_INT 

Many 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

Class DirectColorModel, constructor DirectColorModel(ColorSpace, int, int, int, int, int, boolean, int)

Constructs a DirectColorModel from the specified parameters. Color components will beare in the specified ColorSpace which must be of type ColorSpace.TYPE_RGB. The masks specify which bits in an int pixel representation contain the red green and blue color samples and the alpha sample if present. If amask is 0 pixel values do not contain alpha information soand all pixels will beare treated as opaque (alphawhich =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 an int pixel representation. If there is alpha the boolean isAlphaPremultiplied 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. The transparency value will beis 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 specified ColorSpace @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 isAlphaPremultiplied true if color samples are premultiplied by the alpha sample; false otherwise @param transferType the type of array used to represent pixel values
Class DirectColorModel, constructor DirectColorModel(int, int, int, int)

Constructs a DirectColorModel from the givenspecified masks specifyingthat indicate which bits in an int pixel representation contain the red green and blue color samples. PixelAs pixel values do not contain alpha information so all pixels will beare treated as opaque (alphawhich =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 an int pixel representation. The ColorSpace will beis the default sRGB space. The transparency value will beis Transparency.OPAQUE. The transfer type will beis the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel. @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
Class DirectColorModel, constructor DirectColorModel(int, int, int, int, int)

Constructs a DirectColorModel from the givenspecified masks specifyingthat indicate which bits in an int pixel representation contain the red green and blue color samples and the alpha sample if present. If amask is 0 pixel values do not contain alpha information soand all pixels will beare treated as opaque (alphawhich =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 an int pixel representation. Alpha if present willis not be premultiplied. The ColorSpace will beis the default sRGB space. The transparency value will beis Transparency.OPAQUE if no alpha is present or Transparency.TRANSLUCENT otherwise. The transfer type will beis the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel. @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
Class DirectColorModel, ColorModel coerceData(WritableRaster, boolean)

Forces the Rasterraster data to match the state specified in the isAlphaPremultiplied variable assuming the data is currently correctly described by this ColorModel. It may multiply or divide the color Rasterraster data by alpha or do nothing if the data is in the correct state. If the data needs to be coerced this method will also return an instance of this ColorModel with the isAlphaPremultiplied flag set appropriately. This method will throw a UnsupportedOperationException if this transferType is not supported by this ColorModel. Since ColorModel 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 unsupported transferType. @param raster the WritableRaster data @param isAlphaPremultiplied true if the alpha is premultiplied; false otherwise @return a ColorModel object that represents the coerced data. @exception UnsupportedOperationException if this transferType is not supported by this color model
Class DirectColorModel, WritableRaster createCompatibleWritableRaster(int, int)

Creates a WritableRaster with the specified width and height that has a data layout (SampleModel) compatible with this ColorModel. @param w the width to apply to the new WritableRaster @param h the height to apply to the new WritableRaster @return a WritableRaster object with the specified width and height. @throws IllegalArgumentException if w or h is less than or equal to zero @see WritableRaster @see SampleModel
Class DirectColorModel, int getAlpha(Object)

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 type transferType passed in as an object reference. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel 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 unsupported transferType. If this transferType is not supported an UnsupportedOperationException is thrown. @param inData the specified pixel @return the alpha component of the specified pixel scaled from 0 to 255. @exception ClassCastException if inData is not a primitive array of type transferType @exception ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this ColorModel @exception UnsupportedOperationException if this tranferType is not supported by this ColorModel
Class DirectColorModel, int getAlpha(int)

Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified as an int. @param pixel the specified pixel @return the value of the alpha component of pixel from 0 to 255.
Class DirectColorModel, int getAlphaMask()

Returns the mask indicating which bits in an int pixel representation contain the alpha component. @return the mask which indicates which bits of the int pixel representation contain the alpha sample.
Class DirectColorModel, int getBlue(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value will beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the blue value will beis 0). If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel 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 unsupported transferType. An UnsupportedOperationException is thrown if this transferType is not supported by this ColorModel. @param inData the array containing the pixel value @return the value of the blue component of the specified pixel. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this color model @throws ClassCastException if inData is not a primitive array of type transferType @throws UnsupportedOperationException if this transferType is not supported by this color model
Class DirectColorModel, int getBlue(int)

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 beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the blue value willis 0. @param pixel the specified pixel @return the blue color component for the specified pixel befrom 0) to 255 in the sRGB ColorSpace.
Class DirectColorModel, int getBlueMask()

Returns the mask indicating which bits in an int pixel representation contain the blue color component. @return the mask which indicates which bits of the int pixel representation contain the blue color sample.
Class DirectColorModel, int[] getComponents(Object, int[], int)

Returns an array of unnormalized color/alpha components given a pixel in this ColorModel. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If pixel is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. If the components array is null a new array will beis allocated. The components array will beis returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset). Since DirectColorModel 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 unsupported transferType. @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 the components array at which to start storing the color and alpha components @exception ClassCastException if pixel is not a primitive array of type transferType @exception ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel or if components is not null and is not large enough to hold all the color and alpha components starting at offset @exception UnsupportedOperationException if this transferType is not supported by this color model
Class DirectColorModel, int[] getComponents(int, int[], int)

Returns an array of unnormalized color/alpha components given a pixel in this ColorModel. The pixel value is specified as an int. If the components array is null a new array will beis allocated. The components array will beis returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset. @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 the components 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).
Class DirectColorModel, int getDataElement(int[], int)

Returns a pixel value represented as an int in this ColorModel given an array of unnormalized color/alpha components. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all the color and alpha components (starting at offset). @param components an array of unnormalized color and alpha components @param offset the index into components at which to begin retrieving the color and alpha components @return an int pixel value in this ColorModel corresponding to the specified components. @exception ArrayIndexOutOfBoundsException if the components array is not large enough to hold all of the color and alpha components starting at offset
Class DirectColorModel, Object getDataElements(int, Object)

Returns a data element array representation of a pixel in this ColorModel given an integer pixel representation in the default RGB color model. This array can then be passed to the setDataElements method of a WritableRaster object. If the pixel variable is null a new array will beis allocated. If pixel is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. The pixel array willis returned. Since DirectColorModel can be returnedsubclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported transferType. @param rgb the integer pixel representation in the default RGB color model @param pixel the specified pixel @return an array representation of the specified pixel in this ColorModel @exception ClassCastException if pixel is not a primitive array of type transferType @exception ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel @exception UnsupportedOperationException if this transferType is not supported by this ColorModel @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class DirectColorModel, Object getDataElements(int[], int, Object)

Returns a data element array representation of a pixel in this ColorModel given an array of unnormalized color/alpha components. This array can then be passed to the setDataElements method of a WritableRaster object. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all the color and alpha components (starting at offset). If the obj variable is null a new array will beis allocated. If obj is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if obj is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel 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 unsupported transferType. @param components an array of unnormalized color and alpha components @param offset the index into components at which to begin retrieving color and alpha components @param obj the Object representing an array of color and alpha components @return an Object representing an array of color and alpha components. @exception ClassCastException if obj is not a primitive array of type transferType @exception ArrayIndexOutOfBoundsException if obj is not large enough to hold a pixel value for this ColorModel or the components array is not large enough to hold all of the color and alpha components starting at offset @exception UnsupportedOperationException if this transferType is not supported by this color model @see WritableRaster#setDataElements @see SampleModel#setDataElements
Class DirectColorModel, int getGreen(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value will beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the green value will beis 0). If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel 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 unsupported transferType. An UnsupportedOperationException is thrown if this transferType is not supported by this ColorModel. @param inData the array containing the pixel value @return the value of the green component of the specified pixel. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this color model @throws ClassCastException if inData is not a primitive array of type transferType @throws UnsupportedOperationException if this transferType is not supported by this color model
Class DirectColorModel, int getGreen(int)

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 beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the green value willis 0. @param pixel the specified pixel @return the green color component for the specified pixel befrom 0) to 255 in the sRGB ColorSpace.
Class DirectColorModel, int getGreenMask()

Returns the mask indicating which bits in an int pixel representation contain the green color component. @return the mask which indicates which bits of the int pixel representation contain the green color sample.
Class DirectColorModel, int getRGB(Object)

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 type transferType passed in as an object reference. If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. The returned value will beis in a non pre-multiplied format i.e. Thus if the alpha is premultiplied this method will dividedivides it out of the color components. (ifIf the alpha value is 0 for example the color values willis 0. Since DirectColorModel can be 0)subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported transferType. @param inData the specified pixel @return the color and alpha components of the specified pixel. @exception UnsupportedOperationException if this transferType is not supported by this ColorModel @see ColorModel#getRGBdefault
Class DirectColorModel, int getRGB(int)

Returns the color/alpha components of the pixel in the default RGB color model format. A color conversion is done if necessary. The pixel value is specified as an int. The returned value will beis in a non pre-multiplied format i.e. Thus if the alpha is premultiplied this method will dividedivides it out of the color components. (ifIf the alpha value is 0 for example the color values will beare each 0). @param pixel the specified pixel @return the RGB value of the color/alpha components of the specified pixel. @see ColorModel#getRGBdefault
Class DirectColorModel, int getRed(Object)

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 by an array of data elements of type transferType passed in as an object reference. The returned value will beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the red value will beis 0). If inData is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel 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 unsupported transferType. An UnsupportedOperationException is thrown if this transferType is not supported by this ColorModel. @param inData the array containing the pixel value @return the value of the red component of the specified pixel. @throws ArrayIndexOutOfBoundsException if inData is not large enough to hold a pixel value for this color model @throws ClassCastException if inData is not a primitive array of type transferType @throws UnsupportedOperationException if this transferType is not supported by this color model
Class DirectColorModel, int getRed(int)

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 beis a non pre-multiplied value i.e. Thus if the alpha is premultiplied this method will dividedivides it out before returning the value. (ifIf the alpha value is 0 for example the red value willis 0. @param pixel the specified pixel @return the red color component for the specified pixel befrom 0) to 255 in the sRGB ColorSpace.
Class DirectColorModel, int getRedMask()

Returns the mask indicating which bits in an int pixel representation contain the red color component. @return the mask which indicates which bits of the int pixel representation contain the red color sample.
Class DirectColorModel, boolean isCompatibleRaster(Raster)

Returns true if raster is compatible with this ColorModel and false if it is not. @param raster the Raster object to test for compatibility @return true if raster is compatible with this ColorModel; false otherwise.

Class FilteredImageSource

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:
 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.20 0922 02/2102/9800 @author Jim Graham

Class 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.15 0917 02/2102/9800 @author Jim Graham

Class ImageFilter

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.20 0923 02/2102/9800 @author Jim Graham
Class ImageFilter, ImageFilter getFilterInstance(ImageConsumer)

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.

Class ImageFilter, void imageComplete(int)

Filters the information provided in the imageComplete method of the ImageConsumer interface.

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. @see ImageConsumer#imageComplete

Class ImageFilter, void setColorModel(ColorModel)

Filter the information provided in the setColorModel method of the ImageConsumer interface.

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. @see ImageConsumer#setColorModel

Class ImageFilter, void setDimensions(int, int)

Filters the information provided in the setDimensions method of the ImageConsumer interface.

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. @see ImageConsumer#setDimensions

Class ImageFilter, void setHints(int)

Filters the information provided in the setHints method of the ImageConsumer interface.

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. @see ImageConsumer#setHints

Class ImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.

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. @see ImageConsumer#setPixels

Class ImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.

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. @see ImageConsumer#setPixels

Class ImageFilter, void setProperties(Hashtable)

Passes the properties from the source object along after adding a property indicating the stream of filters it has been run through.

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.


Class ImageObserver

An asynchronous update interface for receiving notifications about Image information as the Image is constructed. @version 1.21 0924 02/2102/9800 @author Jim Graham
Class ImageObserver, boolean imageUpdate(Image, int, int, int, int, int)

This method is called when information about an image which was previously requested using an asynchronous interface becomes available. Asynchronous interfaces are method calls such as getWidth(ImageObserver) and drawImage(img x y ImageObserver) which take an ImageObserver object as an argument. Those methods register the caller as interested either in information about the overall image itself (in the case of getWidth(ImageObserver)) or about an output version of an image (in the case of the drawImage(img x y [w h ] ImageObserver) call).

This method should return true if further updates are needed or false if the required information has been acquired. The image which was being tracked is passed in using the img argument. Various constants are combined to form the infoflags argument which indicates what information about the image is now available. The interpretation of the x y width and height arguments depends on the contents of the infoflags argument.

The infoflags argument should be the bitwise inclusive OR of the following flags: WIDTH HEIGHT PROPERTIES SOMEBITS FRAMEBITS ALLBITS ERROR ABORT. @param img the image being observed. @param infoflags the bitwise inclusive OR of the following flags: WIDTH HEIGHT PROPERTIES SOMEBITS FRAMEBITS ALLBITS ERROR ABORT. @param x the x coordinate. @param y the y coordinate. @param width the width. @param height the height. @return false if the infoflags indicate that the image is completely loaded; true otherwise. @see #WIDTH @see #HEIGHT @see #PROPERTIES @see #SOMEBITS @see #FRAMEBITS @see #ALLBITS @see #ERROR @see #ABORT @see Image#getWidth @see Image#getHeight @see java.awt.Graphics#drawImage


Class ImageProducer

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.14 0916 02/2102/9800 @author Jim Graham

Class IndexColorModel

AThe IndexColorModel class is a ColorModel class that works with pixel values consisting of a single sample which is an index into a fixed colormap in the default sRGB ColorSpace. The colormap specifies red green blue and optional alpha components corresponding to each index. All components are represented in the colormap as 8-bit unsigned integral values. If alpha is not present an opaque alpha component (alpha = 1.0) will beis assumed for each entry. An optional transparent pixel value can be supplied whichthat indicates a completely transparent pixel regardless of any alpha component recorded for that pixel value. Note that alpha values in IndexColorModelsIndexColorModel objects are never premultiplied. This color model is similar to an X11 PseudoColor visual.

The index represented by a pixel value is stored in the least significant n bits of the pixel representations passed to the methods of this class where n is the pixel size specified to the constructor for a particular IndexColorModel object and n must be between 1 and 16. Higher order bits in pixel representations are assumed to be zero. For those methods whichthat use a primitive array pixel representation of type transferType the array length is always one. The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INTUSHORT. 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 whichthat use this representation willdo not throw an IllegalArgumentException due to an invalid pixel value.

Many of the methods in this class are final. The reason for this is that 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 reaons but you cannot override or modify the behaviour of those methods. @see ColorModel @see ColorSpace @see DataBuffer @version 10 Feb 1997

Class IndexColorModel, constructor IndexColorModel(int, int, byte[], byte[], byte[])

Constructs an IndexColorModel from the givenspecified arrays of red green and blue components. Pixels described by this color model will all have alpha components of 255 unnormalized (1.0  normalized) i.e.which means they are fully opaque. All of the arrays specifying the color components must have at least the specified number of entries. The ColorSpace willis be the default sRGB space. The transparency value will beis Transparency.OPAQUE. The transfer type willis be the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param r Thethe array of red color components. @param g Thethe array of green color components. @param b Thethe array of blue color components. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, constructor IndexColorModel(int, int, byte[], byte[], byte[], byte[])

Constructs an IndexColorModel from the given arrays of red green blue and alpha components. All of the arrays specifying the components must have at least the specified number of entries. The ColorSpace willis be the default sRGB space. The transparency value will beis Transparency.TRANSLUCENT. The transfer type willis be the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param r Thethe array of red color components. @param g Thethe array of green color components. @param b Thethe array of blue color components. @param a Thethe array of alpha value components. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, constructor IndexColorModel(int, int, byte[], byte[], byte[], int)

Constructs an IndexColorModel from the given arrays of red green and blue components. Pixels described by this color model will all have alpha components of 255 unnormalized (1.0  normalized) i.e.which means they are fully opaque except for the indicated transparent pixel. All of the arrays specifying the color components must have at least the specified number of entries. The ColorSpace will beis the default sRGB space. The transparency value willis be Transparency.BITMASK. The transfer type will beis the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param r Thethe array of red color components. @param g Thethe array of green color components. @param b Thethe array of blue color components. @param trans Thethe index of the transparent pixel. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, constructor IndexColorModel(int, int, byte[], int, boolean)

Constructs an IndexColorModel from a single array of interleaved red green blue and optional alpha components. The array must have enough values in it to fill all of the needed component arrays of the specified size. The ColorSpace will beis the default sRGB space. The transparency value will beis Transparency.TRANSLUCENT if hasAlpha is true Transparency.OPAQUE otherwise. The transfer type will beis the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INTUSHORT that can hold a single pixel. sRGB ColorSpace. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param cmap Thethe array of color components. @param start Thethe starting offset of the first color component. @param hasalpha Indicatesindicates whether alpha values are contained in the cmap array. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, constructor IndexColorModel(int, int, byte[], int, boolean, int)

Constructs an IndexColorModel from a single array of interleaved red green blue and optional alpha components. The specified transparent index represents a pixel that will beis 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 will beis the default sRGB space. The transparency value will beis Transparency.TRANSLUCENT if hasAlpha is true; otherwise it will beis Transparency.BITMASK if trans is a valid index into the colormap (between 0 and size - 1) or Transparency.OPAQUE if trans is not a valid index. The transfer type will beis the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param cmap Thethe array of color components. @param start Thethe starting offset of the first color component. @param hasalpha Indicatesindicates whether alpha values are contained in the cmap array. @param trans Thethe index of the fully transparent pixel. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, constructor IndexColorModel(int, int, int[], int, boolean, int, int)

Constructs an 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 will beis 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 will beis the default sRGB space. The transparency value will beis Transparency.TRANSLUCENT if hasAlpha is true; otherwise it will beis Transparency.BITMASK if trans is a valid index into the colormap (between 0 and size - 1) or Transparency.OPAQUE if trans is not a valid index. The transfer type will be the smallest of DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT that can hold a single pixel. @param bits Thethe number of bits each pixel occupies. @param size Thethe size of the color component arrays. @param cmap Thethe array of color components. @param start Thethe starting offset of the first color component. @param hasalpha Indicatesindicates whether alpha values are contained in the cmap array. @param trans Thethe index of the fully transparent pixel @param transferType the data type of the array used to represent pixel values. The data type must be either DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT. @throws IllegalArgumentException if bits is less than 1 or greater than 16 @throws IllegalArgumentException if size is less than 1
Class IndexColorModel, BufferedImage convertToIntDiscrete(Raster, boolean)

Returns a new BufferedImage of TYPE_INT_ARGB or TYPE_INT_RGB whichthat has a Raster with pixel data computed by expanding the indices in the source Raster using the color/alpha component arrays of this ColorModel. If forceARGB is true a TYPE_INT_ARGB image is returned regardless of whether or not this ColorModel has an alpha component array or a transparent pixel. @param raster the specified Raster @param forceARGB if true the returned BufferedImage is TYPE_INT_ARGB; otherwise it is TYPE_INT_RGB @return a BufferedImage created with the specified Raster
Class IndexColorModel, SampleModel createCompatibleSampleModel(int, int)

Creates a SampleModel with the specified width and height that has a data layout compatible with this ColorModel. @param w the width to apply to the new SampleModel @param h the height to apply to the new SampleModel @return a SampleModel object with the specified width and height. @throws IllegalArgumentException if w or h is not greater than 0 @see SampleModel
Class IndexColorModel, WritableRaster createCompatibleWritableRaster(int, int)

Creates a WritableRaster with the specified width and height that has a data layout (SampleModel) compatible with this ColorModel. This method only works for color models with 16 or fewer bits per pixel.

Since IndexColorModel can be subclassed any subclass that supports greater than 16 bits per pixel must override this method. @param w the width to apply to the new WritableRaster @param h the height to apply to the new WritableRaster @return a WritableRaster object with the specified width and height. @throws UnsupportedOperationException if the number of pixel bits in this ColorModela pixel is greater than 16. @see WritableRaster @see SampleModel

Class IndexColorModel, int getAlpha(int)

Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified as an int. @param pixel the specified pixel @return the value of the alpha component for the specified pixel
Class IndexColorModel, void getAlphas(byte[])

Copies the array of alpha transparency components into the givenspecified array. Only the initial entries of the array as specified by getMapSize() will beare written. @param a the specified array into which the elements of the array of alpha components are copied
Class IndexColorModel, int getBlue(int)

Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. The pixel value is specified as an int. The returned value will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the blue color component for the specified pixel
Class IndexColorModel, void getBlues(byte[])

Copies the array of blue color components into the givenspecified array. Only the initial entries of the array as specified by getMapSize() will beare written. @param b the specified array into which the elements of the array of blue color components are copied
Class IndexColorModel, int[] getComponentSize()

Returns an array of the number of bits perfor each color/alpha component. The array contains the color components in the order red green blue followed by the alpha component if present. @return an array containing the number of bits of each color and alpha component of this IndexColorModel
Class IndexColorModel, int[] getComponents(Object, int[], int)

Returns an array of unnormalized color/alpha components givenfor a specified pixel in this ColorModel. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If pixel is not a primitive array of type transferType a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. If the components array is null a new array will beis allocated. The components array will beis returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is also thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset.

Since IndexColorModel 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 unsupported transferType. @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 the components 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 ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel or if the components array is not null and is not large enough to hold all the color and alpha components starting at offset @throws ClassCastException if pixel is not a primitive array of type transferType @throws UnsupportedOperationException if transferType is not one of the supported transer types

Class IndexColorModel, int[] getComponents(int, int[], int)

Returns an array of unnormalized color/alpha components givenfor a specified pixel in this ColorModel. The pixel value is specified as an int. If the components array is null a new array will beis allocated. The components array will beis returned. Color/alpha components are stored in the components array starting at offset (even if the array is allocated by this method). An ArrayIndexOutOfBoundsException is thrown if the components array is not null and is not large enough to hold all the color and alpha components (starting at offset. @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 the components 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).
Class IndexColorModel, int getDataElement(int[], int)

Returns a pixel value represented as an int in this ColorModel given an array of unnormalized color/alpha components. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all of the color and alpha components (starting at offset. Since ColorModel 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 unsupported transferType. @param components an array of unnormalized color and alpha components @param offset) the index into components at which to begin retrieving the color and alpha components @return an int pixel value in this ColorModel corresponding to the specified components. @throws ArrayIndexOutOfBoundsException if the components array is not large enough to hold all of the color and alpha components starting at offset @throws UnsupportedOperationException if transferType is invalid
Class IndexColorModel, Object getDataElements(int, Object)

Returns a data element array representation of a pixel in this ColorModel given an integer pixel representation in the default RGB color model. This array can then be passed to the in java.lang.Object) setDataElements} method of a WritableRaster object. If the pixel variable is null a new array will beis allocated. If pixel is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel. The pixel array willis returned.

Since IndexColorModel can be returnedsubclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported transferType. @param rgb the integer pixel representation in the default RGB color model @param pixel the specified pixel @return an array representation of the specified pixel in this IndexColorModel. @throws ClassCastException if pixel is not a primitive array of type transferType @throws ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel @throws UnsupportedOperationException if transferType is invalid @see WritableRaster#setDataElements @see SampleModel#setDataElements

Class IndexColorModel, Object getDataElements(int[], int, Object)

Returns a data element array representation of a pixel in this ColorModel given an array of unnormalized color/alpha components. This array can then be passed to the setDataElements method of a WritableRaster object. An ArrayIndexOutOfBoundsException is thrown if the components array is not large enough to hold all of the color and alpha components (starting at offset). If the pixel variable is null a new array will beis allocated. If pixel is not null it must be a primitive array of type transferType; otherwise a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to hold a pixel value for this ColorModel.

Since IndexColorModel 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 unsupported transferType @param components an array of unnormalized color and alpha components @param offset the index into components at which to begin retrieving color and alpha components @param pixel the Object representing an array of color and alpha components @return an Object representing an array of color and alpha components. @throws ClassCastException if pixel is not a primitive array of type transferType @throws ArrayIndexOutOfBoundsException if pixel is not large enough to hold a pixel value for this ColorModel or the components array is not large enough to hold all of the color and alpha components starting at offset @throws UnsupportedOperationException if transferType is not one of the supported transer types @see WritableRaster#setDataElements @see SampleModel#setDataElements

Class IndexColorModel, int getGreen(int)

Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. The pixel value is specified as an int. The returned value will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the green color component for the specified pixel
Class IndexColorModel, void getGreens(byte[])

Copies the array of green color components into the givenspecified array. Only the initial entries of the array as specified by getMapSize() are written. @param g the specified array into which the elements of the array of green color components are copied
Class IndexColorModel, int getMapSize()

Returns the size of the color/alpha component arrays in this IndexColorModel. @return the size of the color and alpha component arrays.
Class IndexColorModel, int getRGB(int)

Returns the color/alpha components of the pixel in the default RGB color model format. The pixel value is specified as an int. The returned value will beis in a non pre-multiplied format. @param pixel the specified pixel @return the color and alpha components of the specified pixel @see ColorModel#getRGBdefault
Class IndexColorModel, void getRGBs(int[])

Converts data for each index from the color and alpha component arrays to an int in the default RGB ColorModel format and copies the resulting 32-bit ARGB values into the givenspecified array. Only the initial entries of the array as specified by getMapSize() will beare written. @param rgb the specified array into which the converted ARGB values from this array of color and alpha components are copied.
Class IndexColorModel, int getRed(int)

Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGB ColorSpace sRGB. The pixel value is specified as an int. The returned value will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the red color component for the specified pixel
Class IndexColorModel, void getReds(byte[])

Copies the array of red color components into the givenspecified array. Only the initial entries of the array as specified by getMapSize() are written. @param r the specified array into which the elements of the array of red color components are copied
Class IndexColorModel, int getTransparency()

Returns the transparency. Returns either OPAQUE BITMASK or TRANSLUCENT @return the transparency of this IndexColorModel @see Transparency#OPAQUE @see Transparency#BITMASK @see Transparency#TRANSLUCENT
Class IndexColorModel, int getTransparentPixel()

Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel. @return the index of this IndexColorModel object's transparent pixel or -1 if there is no such pixel.
Class IndexColorModel, boolean isCompatibleRaster(Raster)

Returns true if raster is compatible with this ColorModel andor false if it is not compatible with this ColorModel. @param raster the Raster object to test for compatibility @return true if raster is compatible with this ColorModel; false otherwise.
Class IndexColorModel, boolean isCompatibleSampleModel(SampleModel)

Checks if the specified SampleModel is compatible with this ColorModel. If sm is null this method returns false. @param sm the specified SampleModel or null @return true if the specified SampleModel is compatible with this ColorModel; false otherwise. @see SampleModel
Class IndexColorModel, String toString()

PrintsReturns the String representation of the contents of this ColorModelobject. @return a String representing the contents of this ColorModel object.

Class MemoryImageSource

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:
 int w = 100; int h = 100; int pix[] = new int[w * h]; int index = 0; for (int y = 0; y  The 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.21 0923 02/2102/9800 @author Jim Graham @author Animation capabilities inspired by the MemoryAnimationSource class written by Garth Dickie

Class MultiPixelPackedSampleModel, constructor MultiPixelPackedSampleModel(int, int, int, int)

Constructs a MultiPixelPackedSampleModel with the specified data type width height and number of bits per pixel. @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 @param numberOfBits the number of bits per pixel @throws IllegalArgumentException if dataType is not either DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Class MultiPixelPackedSampleModel, constructor MultiPixelPackedSampleModel(int, int, int, int, int, int)

Constructs a MultiPixelPackedSampleModel with specified data type width height number of bits per pixel scanline stride and data bit offset. @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 @param numberOfBits the number of bits per pixel @param scanlineStride the line stride of the image data @param dataBitOffset the data bit offset for the region of image data described @exception RasterFormatException if the number of bits per pixel is not a power of 2 or if a power of 2 number of pixels do not fit in one data element. @throws IllegalArgumentException if w or h is not greater than 0 @throws IllegalArgumentException if dataType is not either DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Class MultiPixelPackedSampleModel, SampleModel createCompatibleSampleModel(int, int)

Creates a new MultiPixelPackedSampleModel with the specified width and height. The new MultiPixelPackedSampleModel has the same storage data type and number of bits per pixel as this MultiPixelPackedSampleModel. @param w the specified width @param h the specified height @return a SampleModel with the specified width and height and with the same storage data type and number of bits per pixel as this MultiPixelPackedSampleModel. @throws IllegalArgumentException if w or h is not greater than 0
Class MultiPixelPackedSampleModel, SampleModel createSubsetSampleModel(int[])

Creates a new MultiPixelPackedSampleModel with a subset of the bands of this MultiPixelPackedSampleModel. Since a MultiPixelPackedSampleModel only has one band the bands argument must have a length of one and indicate the zeroth band. @param bands the specified bands @return a new SampleModel with a subset of bands of this MultiPixelPackedSampleModel. @exception RasterFormatException if the number of bands requested is not one. @throws IllegalArgumentException if w or h is not greater than 0

Class PackedColorModel

AnThe PackedColorModel class is an abstract ColorModel class that works with pixel values which represent color and alpha information as separate samples and which pack all samples for a single pixel into a single int short or byte quantity. This class can be used with an arbitrary ColorSpace. The number of color samples in the pixel values must be the same as the number of color components in the ColorSpace. There maycan be a single alpha sample. ForThe array length is always 1 for those methods whichthat use a primitive array pixel representation of type transferType. the array length is alwaysThe transfer types supported are oneDataBuffer.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.:

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 PackedColorModel is typically used with image data whichthat uses masks to define packed samples. For example a PackedColorModel can be used in conjunction with a SinglePixelPackedSampleModel to construct a BufferedImage. Normally the masks used by the SampleModel and the ColorModel would be the same. However if they are different the color interpretation of pixel data will beis done according to the masks of the ColorModel.

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 whichthat use this representation willdo not throw an IllegalArgumentException due to an invalid pixel value.

A subclass of PackedColorModel is DirectColorModel which is similar to an X11 TrueColor visual. @see DirectColorModel @see SinglePixelPackedSampleModel @see BufferedImage @version 10 Feb 1997

Class PackedColorModel, constructor PackedColorModel(ColorSpace, int, int, int, int, int, boolean, int, int)

Constructs a PackedColorModel from the givenspecified masks specifyingwhich indicate which bits in an int pixel representation contain the alpha red green and blue color samples. Color components will beare in the specified ColorSpace which must be of type ColorSpace.TYPE_RGB. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. If amask is 0 there is no alpha. If there is alpha the boolean isAlphaPremultiplied 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. The transparency trans 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. @param space the specified ColorSpace @param bits the number of bits in the pixel values @param rmask specifies the mask representing the bits of the pixel values that represent the red color component @param gmask specifies the mask representing the bits of the pixel values that represent the green color component @param bmask specifies the mask representing the bits of the pixel values that represent the blue color component @param amask specifies the mask representing the bits of the pixel values that represent the alpha component @param isAlphaPremultiplied true if color samples are premultiplied by the alpha sample; false otherwise @param trans specifies the alpha value that can be represented by this color model @param transferType the type of array used to represent pixel values @throws IllegalArgumentException if space is not a TYPE_RGB space @see ColorSpace
Class PackedColorModel, constructor PackedColorModel(ColorSpace, int, int[], int, boolean, int, int)

Constructs a PackedColorModel from a color mask array which specifies which bits in an int pixel representation contain each of the color samples and an alpha mask. Color components will beare in the specified ColorSpace. The length of colorMaskArray should be the number of components in the ColorSpace. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. If the alphaMask is 0 there is no alpha. If there is alpha the boolean isAlphaPremultiplied 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. The transparency trans 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. @param space the specified ColorSpace @param bits the number of bits in the pixel values @param colorMaskArray array that specifies the masks representing the bits of the pixel values that represent the color components @param alphaMask specifies the mask representing the bits of the pixel values that represent the alpha component @param isAlphaPremultiplied true if color samples are premultiplied by the alpha sample; false otherwise @param trans specifies the alpha value that can be represented by this color model @param transferType the type of array used to represent pixel values @throws IllegalArgumentException if bits is less than 1 or greater than 32
Class PackedColorModel, SampleModel createCompatibleSampleModel(int, int)

Creates a SampleModel with the specified width and height that has a data layout compatible with this ColorModel. @param w the width (in pixels) of the region of the image data described @param h the height (in pixels) of the region of the image data described @return the newly created SampleModel. @throws IllegalArgumentException if w or h is not greater than 0 @see SampleModel
Class PackedColorModel, WritableRaster getAlphaRaster(WritableRaster)

Returns a RasterWritableRaster representing the alpha channel of an image extracted from the input RasterWritableRaster. This method assumes that RastersWritableRaster objects associated with this ColorModel store the alpha band if present as the last band of image data. Returns null if there is no separate spatial alpha channel associated with this ColorModel. This method will createcreates a new RasterWritableRaster (but will shareshares the data array). @param raster a WritableRaster containing an image @return a WritableRaster that represents the alpha channel of the image contained in raster.
Class PackedColorModel, int getMask(int)

Returns the mask indicating which bits in an inta pixel representation contain the specified color/alpha sample. For color samples the index corresponds to the placement of color sample names in the color space. Thus an index equal to 0 for a CMYK ColorSpace would correspond to Cyan and an index equal to 1 would correspond to Magenta. If there is alpha the alpha index would be:
 alphaIndex = numComponents() - 1; 
@param index the specified color or alpha sample @return the mask which indicates which bits of the int pixel representation contain the color or alpha sample specified by index. @throws ArrayIndexOutOfBoundsException if index is greater than the number of components minus 1 in this PackedColorModel or if index is less than zero
Class PackedColorModel, int[] getMasks()

Returns a mask array indicating which bits in ana pixel contain the color and alpha samples. @return the mask array which indicates which bits of the int pixel representation contain the color andor alpha samples.
Class PackedColorModel, boolean isCompatibleSampleModel(SampleModel)

Checks if the specified SampleModel is compatible with this ColorModel. If sm is null this method returns false. @param sm the specified SampleModel or null @return true if the specified SampleModel is compatible with this ColorModel; false otherwise. @see SampleModel

Class PixelGrabber

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:
 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.13 0619 02/2902/9800 @author Jim Graham
Class PixelGrabber, constructor PixelGrabber(Image, int, int, int, int, boolean)

Create a PixelGrabber object to grab the (x y w h) rectangular section of pixels from the specified image. The pixels are accumulated in the original ColorModel if the same ColorModel is used for every call to setPixels otherwise the pixels are accumulated in the default RGB ColorModel. If the forceRGB parameter is true then the pixels will be accumulated in the default RGB ColorModel anywyaanyway. A buffer is allocated by the PixelGrabber to hold the pixels in either case. If (w <0) or (h <0) then they will default to the remaining width and height of the source data when that information is delivered. @param img the image to retrieve the image data from @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 forceRGB true if the pixels should always be converted to the default RGB ColorModel
Class PixelGrabber, boolean grabPixels(long)

Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed. This method behaves in the following ways depending on the value of ms: @param ms the number of milliseconds to wait for the image pixels to arrive before timing out @return true if the pixels were successfully grabbed false on abort error or timeout @exception InterruptedException Another thread has interrupted this thread.
Class PixelGrabber, int status()

DEPRECATED:Returns Replaced bythe status of the pixels. The ImageObserver flags representing the available pixel information are returned. This method and getStatus have the same implementation but getStatus is the preferred method because it conforms to the convention of naming information-retrieval methods with the form "getXXX". @return the bitwise OR of all relevant ImageObserver flags @see ImageObserver @see #getStatus().

Class PixelInterleavedSampleModel

This class represents image data which is stored in a pixel 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 pixel interleaved image data than is provided by ComponentSampleModel. This class stores sample data for all bands in a single 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. 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 datatypes.
Class PixelInterleavedSampleModel, constructor PixelInterleavedSampleModel(int, int, int, int, int, int[])

Constructs a PixelInterleavedSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. @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. @param pixelStride The pixel stride of the image data. @param scanlineStride The line stride of the image data. @param bandOffsets The offsets of all bands. @throws IllegalArgumentException if w or h is not greater than 0 @throws IllegalArgumentException if any offset between bands is greater than the scanline stride @throws IllegalArgumentException if the product of pixelStride and w is greater than scanlineStride @throws IllegalArgumentException if pixelStride is less than any offset between bands @throws IllegalArgumentException if dataType is not one of the supported data types
Class PixelInterleavedSampleModel, SampleModel createCompatibleSampleModel(int, int)

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 resulting SampleModel @param h the height of the resulting SampleModel @throws IllegalArgumentException if w or h is not greater than 0

Class RGBImageFilter

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 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.14 0919 02/2102/9800 @author Jim Graham
Class RGBImageFilter, void setColorModel(ColorModel)

If the ColorModel is an IndexColorModel and the subclass has set the canFilterIndexColorModel flag to true we substitute a filtered version of the color model here and wherever that original ColorModel object appears in the setPixels methods. Otherwise overrides the default ColorModel used by the ImageProducer and specifies the default RGB ColorModel instead.

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. @see ImageConsumer @see ColorModel#getRGBdefault

Class RGBImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

If the ColorModel object is the same one that has already been converted then simply passes the pixels through with the converted ColorModel. Otherwise converts the buffer of byte pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one.

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. @see ColorModel#getRGBdefault @see #filterRGBPixels

Class RGBImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

If the ColorModel object is the same one that has already been converted then simply passes the pixels through with the converted ColorModel otherwise converts the buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one. Converts a buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method.

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. @see ColorModel#getRGBdefault @see #filterRGBPixels


Class Raster, WritableRaster createBandedRaster(DataBuffer, int, int, int, int[], int[], Point)

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. @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Class Raster, WritableRaster createBandedRaster(int, int, int, int, Point)

Creates a Raster based on a BandedSampleModel with the specified data type width height and number of bands.

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. @throws ArrayIndexOutOfBoundsException if bands is less than 1

Class Raster, WritableRaster createBandedRaster(int, int, int, int, int[], int[], Point)

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.

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. @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT @throws ArrayIndexOutOfBoundsException if bankIndices or bandOffsets is null

Class Raster, WritableRaster createInterleavedRaster(DataBuffer, int, int, int, int, int[], Point)

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.

Note that interleaved DataBuffer.TYPE_INT Rasters are not supported. To create a 1-band Raster of type DataBuffer.TYPE_INT use Raster.createPackedRaster(). @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT @throws RasterFormatException if dataBuffer has more than one bank.

Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, Point)

Creates a Raster based on a PixelInterleavedSampleModel with the specified data type width height and number of bands.

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 type DataBuffer.TYPE_INT use Raster.createPackedRaster().

The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INTUSHORT.

Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, int, int[], Point)

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.

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 type DataBuffer.TYPE_INT use Raster.createPackedRaster().

The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT. and@throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_INTBYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

Class Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, Point)

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. @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT @throws RasterFormatException if dataBuffer has more than one bank.
Class Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, int[], Point)

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. @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT @throws RasterFormatException if dataBuffer has more than one bank.
Class Raster, WritableRaster createPackedRaster(int, int, int, int, int, Point)

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.

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. @throws IllegalArgumentException if the product of bitsPerBand and bands is greater than the number of bits held by dataType @throws IllegalArgumentException if bitsPerBand or bands is not greater than zero @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

Class Raster, WritableRaster createPackedRaster(int, int, int, int[], Point)

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.

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. @throws IllegalArgumentException if dataType is not one of the supported data types which are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

Class Raster, Raster createRaster(SampleModel, DataBuffer, Point)

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. @throws RasterFormatException if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel.
Class Raster, WritableRaster createWritableRaster(SampleModel, DataBuffer, Point)

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.

The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @throws RasterFormatException if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel.

Class Raster, WritableRaster createWritableRaster(SampleModel, Point)

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.

The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT.

Class Raster, Object getDataElements(int, int, Object)

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 or DataBuffer.TYPE_INT. 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. 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 x The X coordinate of the pixel location. @param y The Y coordinate 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.

Class ReplicateScaleFilter

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.7 0412 02/2602/9900 @author Jim Graham
Class ReplicateScaleFilter, constructor ReplicateScaleFilter(int, int)

Constructs a ReplicateScaleFilter that scales the pixels from its source Image as specified by the width and height parameters. @param width the target width to scale the image @param height the target height to scale the image @throws IllegalArgumentException if width equals zero or height equals zero
Class ReplicateScaleFilter, void setDimensions(int, int)

Override the dimensions of the source image and pass the dimensions of the new scaled size to the ImageConsumer.

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. @see ImageConsumer

Class ReplicateScaleFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)

Choose which rows and columns of the delivered byte pixels are needed for the destination scaled image and pass through just those rows and columns that are needed replicated as necessary.

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.

Class ReplicateScaleFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)

Choose which rows and columns of the delivered int pixels are needed for the destination scaled image and pass through just those rows and columns that are needed replicated as necessary.

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.

Class ReplicateScaleFilter, void setProperties(Hashtable)

Passes along the properties from the source object after adding a property indicating the scale applied.

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.


Class SampleModel

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. In the Java 2D(tm) API all built-in image processing and display operators process samples which represent unsigned integral values.

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


Class SinglePixelPackedSampleModel

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

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

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

Constructs a SinglePixelPackedSampleModel with bitMasks.length bands and a scanline stride equal to scanlineStride data array elements. Each sample is stored in a data array element in the position of its corresponding bit mask. Each bit mask must be contiguous and masks must not overlap. @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. @param scanlineStride The line stride of the image data. @param bitMasks The bit masks for all bands. @throws IllegalArgumentException if w or h is not greater than 0 @throws IllegalArgumentException if any mask in bitMask is not contiguous @throws IllegalArgumentException if dataType is not either DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Class SinglePixelPackedSampleModel, constructor SinglePixelPackedSampleModel(int, int, int, int[])

Constructs a SinglePixelPackedSampleModel with bitMasks.length bands. Each sample is stored in a data array element in the position of its corresponding bit mask. Each bit mask must be contiguous and masks must not overlap. @param dataType The data type for storing samples. @param w The width (in pixels) of the region of the image data described. @param h The height (in pixels) of the region of the image data described. @param bitMasks The bit masks for all bands. @throws IllegalArgumentException if dataType is not either DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Class SinglePixelPackedSampleModel, SampleModel createCompatibleSampleModel(int, int)

This creates a 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 resulting SampleModel @param h the height of the resulting SampleModel @throws IllegalArgumentException if w or h is not greater than 0

Class WritableRaster, void setDataElements(int, int, Object)

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 or DataBuffer.TYPE_INT. 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. 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.