|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagejava.awt.imageas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Constructs anClass AffineTransformOp, BufferedImage filter(BufferedImage, BufferedImage)AffineTransformOpgiven an affine transform. The interpolation type is determined from theRenderingHintsobject. 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 areisspecified (hintsis null) the interpolation type is TYPE_NEAREST_NEIGHBOR @param xform TheAffineTransformto use for the operation. @param hints TheRenderingHintsobject used to specify the interpolation type for the operation. @see java.awt.RenderingHints#KEY_INTERPOLATION @see java.awt.RenderingHints#KEY_RENDERING
Transforms the sourceClass AffineTransformOp, WritableRaster filter(Raster, WritableRaster)BufferedImageand stores the results in the destinationBufferedImage. 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 aBufferedImageis created with the sourceColorModel.The coordinates of the rectangle returned by
getBounds2D(BufferedImage)are not necessarily the same as the coordinates of theBufferedImagereturned 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 destinationBufferedImage.An
IllegalArgumentExceptionmay beis thrown if the source is the same as the destination. @param src TheBufferedImageto transform. @param dst TheBufferedImagein which to store the results of the transformation. @return The filteredBufferedImage. @throws IllegalArgumentException ifsrcanddstare the same @throws ImagingOpExceptionIfif 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.
Transforms the sourceClass AffineTransformOp, Rectangle2D getBounds2D(BufferedImage)Rasterand stores the results in the destinationRaster. This operation performs the transform band by band.If the destination
Rasteris null a newRasteris created. AnIllegalArgumentExceptionmay 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 theWritableRasterreturned 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 destinationRaster.@param src The
Rasterto transform. @param dst TheRasterin which to store the results of the transformation. @return The transformedRaster. @throws ImagingOpExceptionIfif theRasterraster 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.
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 TheClass AffineTransformOp, Rectangle2D getBounds2D(Raster)BufferedImageto be transformed. @return TheRectangle2Drepresenting the destination's bounding box.
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 TheRasterto be transformed. @return TheRectangle2Drepresenting the destination's bounding box.
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 @seeClass AreaAveragingScaleFilter, void setHints(int)ReplicateImageFilterReplicateScaleFilter @see ImageFilter @version 1.6100902/2102/9800 @author Jim Graham
Detect if the data is being delivered with the necessary hints to allow the averaging algorithm to do its work.Class AreaAveragingScaleFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)Note: This method is intended to be called by the
ImageProducerof theImagewhose 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
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.Class AreaAveragingScaleFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)Note: This method is intended to be called by the
ImageProducerof theImagewhose 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
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
ImageProducerof theImagewhose 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
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 datatypesClass 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 resultingClass BandedSampleModel, DataBuffer createDataBuffer()BandedSampleModel@param h the height of the resultingBandedSampleModel@return a newBandedSampleModelwith the specified width and height. @throws IllegalArgumentException ifworhequals eitherInteger.MAX_VALUEorInteger.MIN_VALUE@throws IllegalArgumentException ifdataTypeis not one of the supported data types
Creates a DataBuffer that corresponds to this BandedSampleModel The DataBuffer's data type number of banks and size will be consistent with this BandedSampleModel. @throws IllegalArgumentException ifClass BandedSampleModel, SampleModel createSubsetSampleModel(int[])dataTypeis not eitherDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_SHORTorDataBuffer.TYPE_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
Represents an image with 8-bit RGBA color components packed into integer pixels. The image has aDirectColorModelwith alpha. The color data in this image is considered not to be premultiplied with alpha. When this type is used as theimageTypeargument to aBufferedImageconstructor the created imagecreatedis consistent with images created in the JDK1.1 and earlier releases.
Class BufferedImageFilter, constructor BufferedImageFilter(BufferedImageOp)ThisTheBufferedImageFilterclass subclasses anImageFilterto provide a simple means of using a single-source/single-destination image operator ({@link BufferedImageOp}) to filter aBufferedImagein 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
Constructs aClass BufferedImageFilter, BufferedImageOp getBufferedImageOp()BufferedImageFilterwith the specified single-source/single-destination operator. @param op the specifiedBufferedImageOpto use to filter aBufferedImage
Returns theClass BufferedImageFilter, void imageComplete(int)BufferedImageOp. @return the operator of thisBufferedImageFilter.
Filters the information provided in theClass BufferedImageFilter, void setColorModel(ColorModel)imageCompletemethod of theImageConsumerinterface.Note: This method is intended to be called by the
ImageProducerof theImagewhose 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. @seeparamImageConsumer#imageCompletestatus the status of image loading @throws ImagingOpException if there was a problem calling the filter method of theBufferedImageOpassociated with this instance. @see ImageConsumer#imageComplete
Filters the information provided in the setColorModel method of theClass BufferedImageFilter, void setDimensions(int, int)ImageConsumerinterface.If
modelisnullthis method clears the currentColorModelof thisBufferedImageFilter.Note: This method is intended to be called by the
ImageProducerof theImagewhose 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 theColorModelof thisBufferedImageFilter@see ImageConsumer#setColorModel
Filters the information provided in the int setDimensions } method of the ImageConsumer interface.Class BufferedImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)Note: This method is intended to be called by the ImageProducer of the
Imagewhose 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 thisBufferedImageFilter@see ImageConsumer#setDimensions
Filters the information provided in theClass BufferedImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)setPixelsmethod of theImageConsumerinterface which takes an array of bytes.Note: This method is intended to be called by the
ImageProducerof theImagewhose 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)
Filters the information provided in thesetPixelsmethod of theImageConsumerinterface which takes an array of integers.Note: This method is intended to be called by the
ImageProducerof theImagewhose 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)
TheClass ColorModel, constructor ColorModel(int)ColorModelabstract 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 aColorModelis specified by itsColorSpace. AColorModelused with pixel data that does not include alpha information treats all pixels as opaque which is an alpha value of 1.0.This
ColorModelclass 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 singlebyteor singleintvalues. For purposes of theColorModelclass 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. ConsequentlyColorModelnow has methods that accept pixel values represented as arrays of primitive types. The primitive type used by a particularColorModelobject is called its transfer type.
ColorModelobjects 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 ofColorModelmust 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)
2DAPI are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT. The transfer type for a particularColorModelobject is specified when the object is created either explicitly or by default. All subclasses ofColorModelmust specify what the possible transfer types are and how the number of elements in the primitive arrays representing pixels is determined.For
BufferedImagesthe transfer type of itsRasterand of theRasterobject'sSampleModel(available from thegetTransferTypemethods of these classes) must match that of theColorModel. The number of elements in an array representing a pixel for theRasterandSampleModel(available from thegetNumDataElementsmethods of these classes) must match that of theColorModel.The algorithm used to convert from pixel values to color and alpha components varies by subclass. For example there is not necessarily a one-to-one correspondence between samples obtained from the
SampleModelof aBufferedImageobject'sRasterand 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
ColorModelclass 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 particularColorModelrepresent color samples premultiplied by the alpha sample unnormalized color component values are also premultiplied. In the normalized form each component is afloatvalue 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
Constructs aClass ColorModel, constructor ColorModel(int, int[], ColorSpace, boolean, boolean, int, int)ColorModelthat translates pixels of the specified number of bits to color/alpha components. The color space is the default RGBColorSpacewhich 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 inbitsis less than 1
Constructs aClass ColorModel, ColorModel coerceData(WritableRaster, boolean)ColorModelthat translates pixel values to color/alpha components. Color components will be in the specifiedColorSpace.pixel_bitsis 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 theColorSpaceif there is no alpha information in the pixel values or one more than this number if there is alpha information.hasAlphaindicates whether or not alpha information is present. ThebooleanisAlphaPremultipliedspecifies how to interpret pixel values in which color and alpha information are represented as separate spatial bands. If thebooleanistruecolor samples are assumed to have been multiplied by the alpha sample. Thetransparencyspecifies 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 anIndexColorModelwithpixel_bitsequal to 16 the bits array might have four elements with each element set to 8. @param pixel_bits the number of bits in the pixel values @param bits array that specifies the number of significant bits per color and alpha component @param cspace the specifiedColorSpace@param hasAlphatrueif alpha information is present;falseotherwise @param isAlphaPremultipliedtrueif color samples are assumed to be premultiplied by the alpha samples;falseotherwise @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 thisColorModelor if the transparency is not a valid value. @see java.awt.Transparency
Forces the raster data to match the state specified in theClass ColorModel, SampleModel createCompatibleSampleModel(int, int)isAlphaPremultipliedvariable assuming the data is currently correctly described by thisColorModel. It may multiply or divide the color raster data by alpha or do nothing if the data is in the correct state. If the data needs to be coerced this method will also return an instance of thisColorModelwith theisAlphaPremultipliedflag set appropriately. This method will throw aUnsupportedOperationExceptionif it is not supported by thisColorModel. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param raster theWritableRasterdata @param isAlphaPremultipliedtrueif the alpha is premultiplied;falseotherwise @return aColorModelobject that represents the coerced data.
Creates aClass ColorModel, WritableRaster createCompatibleWritableRaster(int, int)SampleModelwith the specified width and height that has a data layout compatible with thisColorModel. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param w the width to apply to the newSampleModel@param h the height to apply to the newSampleModel@return aSampleModelobject with the specified width and height. @exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel@see SampleModel
Creates aClass ColorModel, int getAlpha(Object)WritableRasterwith the specified width and height that has a data layout (SampleModel) compatible with thisColorModel. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param w the width to apply to the newWritableRaster@param h the height to apply to the newWritableRaster@return aWritableRasterobject with the specified width and height. @exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel@see WritableRaster @see SampleModel
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 aClass ColorModel, WritableRaster getAlphaRaster(WritableRaster)ClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifinDatais not large enough to hold a pixel value for thisColorModel. If thistransferTypeis not supported aUnsupportedOperationExceptionwill be thrown. SinceColorModelis 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 atransferTypeother thanDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @param inData the specified pixel @return the alpha component of the specified pixel scaled from 0 to 255. @exceptionthrows ClassCastException ifinDatais not a primitive array of typetransferType@exceptionthrows ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel@exceptionthrows UnsupportedOperationException if thistranferTypeis not supported by thisColorModel
Returns aClass ColorModel, int getBlue(Object)Rasterrepresenting the alpha channel of an image extracted from the inputRasterprovided that pixel values of thisColorModelrepresent color and alpha information as separate spatial bands (e.g. ComponentColorModel andDirectColorModel). This method assumes thatRasterobjects associated with such aColorModelstore the alpha band if present as the last band of image data. Returnsnullif there is no separate spatial alpha channel associated with thisColorModel. If this is anIndexColorModelwhich has alpha in the lookup table this method will returnnullsince there is no spatially discrete alpha channel. This method will create a newRaster(but will share the data array). SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method to get any behavior other than returningnullbecause the implementation in this abstract class returnsnull. @param raster the specifiedRaster@return aRasterrepresenting the alpha channel of an image obtained from the specifiedRaster.
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGBClass ColorModel, int getComponentSize(int)ColorSpacesRGB. 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. IfinDatais not a primitive array of type transferType aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifinDatais not large enough to hold a pixel value for thisColorModel. If thistransferTypeis not supported aUnsupportedOperationExceptionwill be thrown. SinceColorModelis 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 atransferTypeother thanDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the blue component of the specified pixel. @exceptionthrows ClassCastException ifinDatais not a primitive array of typetransferType@exceptionthrows ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel@exceptionthrows UnsupportedOperationException if thistranferTypeis not supported by thisColorModel
Returns the number of bits for the specified color/alpha component. Color components are indexed in the order specified by theClass ColorModel, int[] getComponents(Object, int[], int)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 thisColorModelsupports 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 ifcomponentIdxis greater than the number of components or less than zero @throws NullPointerException if the number of bits array isnull
Returns an array of unnormalized color/alpha components given a pixel in thisClass ColorModel, int[] getComponents(int, int[], int)ColorModel. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. Ifpixelis not a primitive array of type transferType aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifpixelis not large enough to hold a pixel value for thisColorModel. This method can be used to retrieve the components for a specific pixel value in anyColorModel. If the components array isnulla new array will be allocated. The components array will be returned. Color/alpha components are stored in thecomponentsarray starting atoffset(even if the array is allocated by this method). AnArrayIndexOutOfBoundsExceptionis thrown if the components array is notnulland is not large enough to hold all the color and alpha components (starting atoffset). SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param pixel the specified pixel @param components an array that receives the color and alpha components of the specified pixel @param offset the index into thecomponentsarray 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 thisColorModel
Returns an array of unnormalized color/alpha components given a pixel in thisClass ColorModel, int getDataElement(int[], int)ColorModel. The pixel value is specified as anint. AnIllegalArgumentExceptionwill be thrown if pixel values for thisColorModelare not conveniently representable as a singleint. For example this method can be used to retrieve the components for a specific pixel value in aDirectColorModel. If the components array isnulla new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting atoffset(even if the array is allocated by this method). AnArrayIndexOutOfBoundsExceptionis thrown if the components array is notnulland is not large enough to hold all the color and alpha components (starting at offset). SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param pixel the specified pixel @param components the array to receive the color and alpha components of the specified pixel @param offset the offset into thecomponentsarray 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 thisColorModel
Returns a pixel value represented as anClass ColorModel, Object getDataElements(int, Object)intin thisColorModelgiven an array of unnormalized color/alpha components. This method will throw anIllegalArgumentExceptionif pixel values for thisColorModelare not conveniently representable as a singleint. AnArrayIndexOutOfBoundsExceptionis thrown if thecomponentsarray is not large enough to hold all the color and alpha components (starting atoffset). SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param components an array of unnormalized color and alpha components @param offset the index intocomponentsat which to begin retrieving the color and alpha components @return anintpixel value in thisColorModelcorresponding to the specified components. @exceptionthrows IllegalArgumentException if pixel values for thisColorModelare not conveniently representable as a singleint@exceptionthrows ArrayIndexOutOfBoundsException if thecomponentsarray is not large enough to hold all of the color and alpha components starting atoffset@exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel
Returns a data element array representation of a pixel in thisClass ColorModel, Object getDataElements(int[], int, Object)ColorModelgiven 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 isnulla new array will be allocated. Ifpixelis notnullit must be a primitive array of typetransferType; otherwise aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifpixelis not large enough to hold a pixel value for thisColorModel. The pixel array is returned. If thistransferTypeis not supported aUnsupportedOperationExceptionwill be thrown. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param 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 thisColorModel. @exceptionthrows ClassCastException ifpixelis not a primitive array of typetransferType@exceptionthrows ArrayIndexOutOfBoundsException ifpixelis not large enough to hold a pixel value for thisColorModel@exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel@see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns a data element array representation of a pixel in thisClass ColorModel, int getGreen(Object)ColorModelgiven an array of unnormalized color/alpha components. This array can then be passed to thesetDataElementsmethod of aWritableRasterobject. AnArrayIndexOutOfBoundsExceptionis thrown if thecomponentsarray is not large enough to hold all the color and alpha components (starting atoffset). If theobjvariable isnulla new array will be allocated. Ifobjis notnullit must be a primitive array of type transferType; otherwise aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifobjis not large enough to hold a pixel value for thisColorModel. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param components an array of unnormalized color and alpha components @param offset the index intocomponentsat which to begin retrieving color and alpha components @param obj theObjectrepresenting an array of color and alpha components @return anObjectrepresenting an array of color and alpha components. @exceptionthrows ClassCastException ifobjis not a primitive array of typetransferType@exceptionthrows ArrayIndexOutOfBoundsException ifobjis not large enough to hold a pixel value for thisColorModelor thecomponentsarray is not large enough to hold all of the color and alpha components starting atoffset@exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel@see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGBClass ColorModel, float[] getNormalizedComponents(int[], int, float[], int)ColorSpacesRGB. 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. IfinDatais not a primitive array of type transferType aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifinDatais not large enough to hold a pixel value for thisColorModel. If thistransferTypeis not supported aUnsupportedOperationExceptionwill be thrown. SinceColorModelis 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 atransferTypeother thanDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the green component of the specified pixel. @exceptionthrowsClassCastExceptionifinDatais not a primitive array of typetransferType@exceptionthrowsArrayIndexOutOfBoundsExceptionifinDatais not large enough to hold a pixel value for thisColorModel@exceptionthrowsUnsupportedOperationExceptionif thistranferTypeis not supported by thisColorModel
Returns an array of all of the color/alpha components in normalized form given an unnormalized component array. Unnormalized components are unsigned integral values between 0 and 2n - 1 where n is the number of bits for a particular component. Normalized components are float values between 0.0 and 1.0. If theClass ColorModel, int getRed(Object)normComponentsarray isnulla new array will be allocated. ThenormComponentsarray will be returned. Color/alpha components are stored in thenormComponentsarray starting atnormOffset(even if the array is allocated by this method). AnArrayIndexOutOfBoundsExceptionis thrown if thenormComponentsarray is notnulland is not large enough to hold all the color and alpha components (starting atnormOffset). AnIllegalArgumentExceptionis thrown if thecomponentsarray is not large enough to hold all the color and alpha components starting atoffset. @param components an array containing unnormalized components @param offset the offset into thecomponentsarray at which to start retrieving unnormalized components @param normComponents an array that receives the components fromcomponents@param normOffset the index intonormComponentsat which to begin storing unnormalized components fromcomponents@return an array containing normalized color and alpha components. @exceptionthrows UnsupportedOperationException if the constructor of thisColorModelcalled thesuper(bits)constructor but did not override this method. See the constructor #ColorModel(int) @throws UnsupportedOperationException if this method isnot supported by thisunable to determine theColorModelnumber of bits per component
Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGBClass ColorModel, int[] getUnnormalizedComponents(float[], int, int[], int)ColorSpacesRGB. 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. IfinDatais not a primitive array of type transferType aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifinDatais not large enough to hold a pixel value for thisColorModel. If thistransferTypeis not supported aUnsupportedOperationExceptionwill be thrown. SinceColorModelis 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 atransferTypeother thanDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @param inData an array of pixel values @return the value of the red component of the specified pixel. @exceptionthrows ClassCastException ifinDatais not a primitive array of typetransferType@exceptionthrows ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel@exceptionthrows UnsupportedOperationException if thistranferTypeis not supported by thisColorModel
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 theClass ColorModel, int hashCode()componentsarray isnulla new array will be allocated. Thecomponentsarray will be returned. Color/alpha components are stored in thecomponentsarray starting atoffset(even if the array is allocated by this method). AnArrayIndexOutOfBoundsExceptionis thrown if thecomponentsarray is notnulland is not large enough to hold all the color and alpha components (starting atoffset). AnIllegalArgumentExceptionis thrown if thenormComponentsarray is not large enough to hold all the color and alpha components starting atnormOffset. @param normComponents an array containing normalized components @param normOffset the offset into thenormComponentsarray at which to start retrieving normalized components @param components an array that receives the components fromnormComponents@param offset the index intocomponentsat which to begin storing normalized components fromnormComponents@return an array containing unnormalized color and alpha components. @exceptionthrowsUnsupportedOperationExceptionIllegalArgumentException ifthisthemethodlength ofnormComponentsminusnormOffsetisnot supportedless thanbynumComponents@throws UnsupportedOperationException if the constructor of thisColorModelcalled thesuper(bits)constructor but did not override this method. See the constructor #ColorModel(int)
ReturnsClass ColorModel, boolean isCompatibleRaster(Raster)athe hash codevalue 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 integersfordistinct objects. (This is typically implemented by converting the internal address of the object into an integer butthisimplementation technique is not required by the JavaTM programming languageColorModel.)@return a hash codevaluefor thisobject. @see java.lang.Object#equals(java.lang.Object) @see java.utilColorModel.Hashtable
ReturnsClass ColorModel, boolean isCompatibleSampleModel(SampleModel)trueifrasteris compatible with thisColorModelandfalseif it is not. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param raster the Raster object to test for compatibility @returntrueifrasteris compatible with thisColorModel. @exceptionthrows UnsupportedOperationException if this method has not been implemented for thisColorModel
Checks if theSampleModelis compatible with thisColorModel. SinceColorModelis an abstract class any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws anUnsupportedOperationException. @param sm the specifiedSampleModel@returntrueif the specifiedSampleModelis compatible with thisColorModel;falseotherwise. @exceptionthrows UnsupportedOperationException if this method is not supported by thisColorModel@see SampleModel
Constructs aClass ComponentColorModel, ColorModel coerceData(WritableRaster, boolean)ComponentColorModelfrom the specified parameters. Color components will be in the specifiedColorSpace. Thebitsarray specifies the number of significant bits per color and alpha component. Its length should be the number of components in theColorSpaceif there is no alpha information in the pixel values or one more than this number if there is alpha information. AnIllegalArgumentExceptionis thrown if the length of the array does not match the number of components.hasAlphaindicates whether alpha information is present. IfhasAlphais true then the booleanisAlphaPremultipliedspecifies 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. Thetransparencyspecifies what alpha values can be represented by this color model. The acceptabletransparencyvalues areOPAQUEBITMASKorTRANSLUCENT. ThetransferTypeis the type of primitive array used to represent pixel values. Note that thebitsarray contains the number of significant bits per color/alpha component after the translation from pixel values. @param colorSpace TheColorSpaceassociated 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 thelength of thebitsarray does not match the number of components. @see ColorSpace @see java.awt.Transparency
Forces the raster data to match the state specified in theClass ComponentColorModel, int getAlpha(Object)isAlphaPremultipliedvariable assuming the data is currently correctly described by thisColorModel. It may multiply or divide the color raster data by alpha or do nothing if the data is in the correct state. If the data needs to be coerced this method also returns an instance of thisColorModelwith theisAlphaPremultipliedflag set appropriately.@throwsSinceUnsupportedOperationExceptionColorModelIf the transfercan be subclassedtypesubclasses inherit the implementation of thisComponentColorModelmethodis not oneand if theyofdon'tthe supported transferoverride it thentypes:theyDataBuffer.TYPE_BYTEthrowDataBuffer.TYPE_USHORTanorexceptionDataBufferif they use an unsupportedtransferType.TYPE_INT@throws NullPointerException ifrasterisnulland data coercion is required. @throws UnsupportedOperationExceptionIfif the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT.
Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified by an array of data elements of typeClass ComponentColorModel, int getBlue(Object)transferTypepassed in as an object reference. SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param inData The pixel from which you want to get the alpha component specified by an array of data elements of typetransferType. @return The alpha component for the specified pixel as an int. @throws ClassCastException IfinDatais not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT.
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGBClass ComponentColorModel, int[] getComponents(Object, int[], int)ColorSpacesRGB. A color conversion is done if necessary. Thepixelvalue is specified by an array of data elements of typetransferTypepassed 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). SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param inData The pixel from which you want to get the blue color component specified by an array of data elements of typetransferType. @return The blue color component for the specified pixel as an int. @throws ClassCastException IfinDatais not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT.
Returns an array of unnormalized color/alpha components given a pixel in thisClass ComponentColorModel, Object getDataElements(int, Object)ColorModel. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. Color/alpha components are stored in thecomponentsarray starting atoffset(even if the array is allocated by this method). SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then this method might throw an exception if they use an unsupportedtransferType. @param pixel A pixel value specified by an array of data elements of typetransferType. @param components An integer array in which to store the unnormalized color/alpha components. If thecomponentsarray is null a new array is allocated. @param offset An offset into thecomponentsarray. @return Thecomponentsarray. @throws UnsupportedOperationExceptionIfin some cases iff the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @throws ClassCastException Ifpixelis not a primitive array of typetransferType. @throws IllegalArgumentException If thecomponentsarray is not null and is not large enough to hold all the color and alpha components (starting at offset) or ifpixelis not large enough to hold a pixel value for this ColorModel.
Returns a data element array representation of a pixel in thisClass ComponentColorModel, Object getDataElements(int[], int, Object)ColorModelgiven an integer pixel representation in the default RGB color model. This array can then be passed to thesetDataElementsmethod of aWritableRasterobject. If thepixelparameter is null a new array is allocated. SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param rgb @param pixel The integer representation of the pixel#. @throws ClassCastException Ifpixelis not null and is not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException Ifpixelis not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns a data element array representation of a pixel in thisClass ComponentColorModel, int getGreen(Object)ColorModelgiven an array of unnormalized color/alpha components. This array can then be passed to thesetDataElementsmethod of aWritableRasterobject. @param components An array of unnormalized color/alpha components. @param offset The integer offset into thecomponentsarray. @param obj The object in which to store the data element array representation of the pixel. Ifobjvariable is null a new array is allocated. Ifobjis not null it must be a primitive array of typetransferType. AnArrayIndexOutOfBoundsExceptionis thrown ifobjis not large enough to hold a pixel value for thisColorModel. SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @return The data element array representation of a pixel in thisColorModel. @throws IllegalArgumentException If the components array is not large enough to hold all the color and alpha components (starting at offset). @throws ClassCastException Ifobjis not null and is not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException Ifobjis not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGBClass ComponentColorModel, int getRGB(Object)ColorSpacesRGB. A color conversion is done if necessary. Thepixelvalue is specified by an array of data elements of typetransferTypepassed 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). SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param inData The pixel from which you want to get the green color component specified by an array of data elements of typetransferType. @return The green color component for the specified pixel as an int. @throws ClassCastException IfinDatais not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT.
Returns the color/alpha components for the specified pixel in the default RGB color model format. A color conversion is done if necessary. The pixel value is specified by an array of data elements of typeClass ComponentColorModel, int getRed(Object)transferTypepassed 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). SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param inData The pixel from which you want to get the color/alpha components specified by an array of data elements of typetransferType. @return The color/alpha components for the specified pixel as an int. @throws ClassCastException IfinDatais not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT. @see ColorModel#getRGBdefault
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. Thepixelvalue is specified by an array of data elements of typetransferTypepassed 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). SinceComponentColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param inData The pixel from which you want to get the red color component specified by an array of data elements of typetransferType. @return The red color component for the specified pixel as an int. @throws ClassCastException IfinDatais not a primitive array of typetransferType. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for thisColorModel. @throws UnsupportedOperationException If the transfer type of thisComponentColorModelis not one of the supported transfer types:DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT.
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.BandedSampleModelClass 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 ifClass ComponentSampleModel, constructor ComponentSampleModel(int, int, int, int, int, int[], int[])worhis not greater than 0 @throws IllegalArgumentException ifpixelStrideis less than 0 @throws IllegalArgumentException ifscanlineStrideis less than 0 @throws IllegalArgumentException ifnumBandsis less than 1 @throws IllegalArgumentException if the product ofwandhis greater thanInteger.MAX_VALUE@throws IllegalArgumentException ifdataTypeis not one of the supported data types
Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. Different bands may be stored in different banks of the DataBuffer. @param 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 ifClass ComponentSampleModel, SampleModel createCompatibleSampleModel(int, int)worhis not greater than 0 @throws IllegalArgumentException ifpixelStrideis less than 0 @throws IllegalArgumentException ifscanlineStrideis less than 0 @throws IllegalArgumentException if the length ofbankIndicesdoes not equal the length ofbankOffsets@throws IllegalArgumentException if any of the bank indices ofbandIndicesis less than 0
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 resultingSampleModel@param h the height of the resultingSampleModel@throws IllegalArgumentException ifworhis not greater than 0
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.Class CropImageFilter, void setDimensions(int, int)8 0911 02/2102/9800 @author Jim Graham
Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer.Class CropImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)Note: This method is intended to be called by the
ImageProducerof theImagewhose 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
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.Class CropImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)Note: This method is intended to be called by the
ImageProducerof theImagewhose 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.
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.Class CropImageFilter, void setProperties(Hashtable)Note: This method is intended to be called by the
ImageProducerof theImagewhose 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.
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
ImageProducerof theImagewhose 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.
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, constructor DirectColorModel(ColorSpace, int, int, int, int, int, boolean, int)ATheDirectColorModelclass is aColorModelclass that works with pixel valueswhichthat represent RGB color and alpha information as separate samples andwhichthat 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 theremaycan be a single alpha sample. For those methodswhichthat use a primitive array pixel representation of typetransferTypethe array length is always one. The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT. Color and alpha samples are stored in the single element of the array in bits indicated by bit masks. Each bit mask must be contiguous and masks must not overlap. The same masks apply to the single int pixel representation used by other methods. The correspondence of masks and color/alpha samples is as follows.:Masks are identified by indices running from 0 through 2 if no alpha is present or 3 if an alpha is present.
The first three indices refer to color samples; index 0 corresponds to red index 1 to green and index 2 to blue. Index 3 corresponds to the alpha sample if present. The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT.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
DirectColorModelis typically used with image data which uses masks to define packed samples. For example aDirectColorModelcan be used in conjunction with aSinglePixelPackedSampleModelto construct a BufferedImage.Normally the masks used by the SampleModel and theColorModelwould be the same. However if they are different the color interpretation of pixel data will be done according to the masks of theColorModel.A single int pixel representation is valid for all objects of this class since it is always possible to represent pixel values used with this class in a single int. Therefore methods which use this representation will not throw an
IllegalArgumentExceptiondue 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 aDirectColorModelwith the following parameters:Number of bits: 32 Red mask: 0x00ff0000 Green mask: 0x0000ff00 Blue mask: 0x000000ff Alpha mask: 0xff000000 Color space: sRGB isAlphaPremultiplied: False Transparency: Transparency.TRANSLUCENT transferType: DataBuffer.TYPE_INTMany of the methods in this class are final. This is because the underlying native graphics code makes assumptions about the layout and operation of this class and those assumptions are reflected in the implementations of the methods here that are marked final. You can subclass this class for other reasons but you cannot override or modify the behavior of those methods. @see ColorModel @see ColorSpace @see SinglePixelPackedSampleModel @see BufferedImage @see ColorModel#getRGBdefault @version 10 Feb 1997
Constructs aClass DirectColorModel, constructor DirectColorModel(int, int, int, int)DirectColorModelfrom the specified parameters. Color componentswill beare in the specifiedColorSpacewhich must be of type ColorSpace.TYPE_RGB. The masks specify which bits in anintpixel representation contain the red green and blue color samples and the alpha sample if present. Ifamaskis 0 pixel values do not contain alpha informationsoand all pixelswill 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 anintpixel representation. If there is alpha thebooleanisAlphaPremultipliedspecifies how to interpret color and alpha samples in pixel values. If thebooleanistruecolor samples are assumed to have been multiplied by the alpha sample. The transparency valuewill 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 specifiedColorSpace@param bits the number of bits in the pixel values; for example the sum of the number of bits in the masks. @param rmask specifies a mask indicating which bits in an integer pixel contain the red component @param gmask specifies a mask indicating which bits in an integer pixel contain the green component @param bmask specifies a mask indicating which bits in an integer pixel contain the blue component @param amask specifies a mask indicating which bits in an integer pixel contain the alpha component @param isAlphaPremultipliedtrueif color samples are premultiplied by the alpha sample;falseotherwise @param transferType the type of array used to represent pixel values
Constructs aClass DirectColorModel, constructor DirectColorModel(int, int, int, int, int)DirectColorModelfrom thegivenspecified masksspecifyingthat indicate which bits in anintpixel representation contain the red green and blue color samples.PixelAs pixel values do not contain alpha informationsoall pixelswill 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 anintpixel representation. TheColorSpacewillbeis the default sRGB space. The transparency valuewill beis Transparency.OPAQUE. The transfer typewill 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
Constructs aClass DirectColorModel, ColorModel coerceData(WritableRaster, boolean)DirectColorModelfrom thegivenspecified masksspecifyingthat indicate which bits in anintpixel representation contain the red green and blue color samples and the alpha sample if present. Ifamaskis 0 pixel values do not contain alpha informationsoand all pixelswill 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 anintpixel representation. Alpha if presentwillis notbepremultiplied. TheColorSpacewillbeis the default sRGB space. The transparency valuewill beis Transparency.OPAQUE if no alpha is present or Transparency.TRANSLUCENT otherwise. The transfer typewill 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
Forces theClass DirectColorModel, WritableRaster createCompatibleWritableRaster(int, int)Rasterraster data to match the state specified in theisAlphaPremultipliedvariable assuming the data is currently correctly described by thisColorModel. It may multiply or divide the colorRasterraster 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 thisColorModelwith theisAlphaPremultipliedflag set appropriately. This method will throw aUnsupportedOperationExceptionif this transferType is not supported by thisColorModel. SinceColorModelcan 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 theWritableRasterdata @param isAlphaPremultipliedtrueif the alpha is premultiplied;falseotherwise @return aColorModelobject that represents the coerced data. @exception UnsupportedOperationException if thistransferTypeis not supported by this color model
Creates aClass DirectColorModel, int getAlpha(Object)WritableRasterwith the specified width and height that has a data layout (SampleModel) compatible with thisColorModel. @param w the width to apply to the newWritableRaster@param h the height to apply to the newWritableRaster@return aWritableRasterobject with the specified width and height. @throws IllegalArgumentException ifworhis less than or equal to zero @see WritableRaster @see SampleModel
Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified by an array of data elements of typeClass DirectColorModel, int getAlpha(int)transferTypepassed in as an object reference. IfinDatais not a primitive array of typetransferTypeaClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifinDatais not large enough to hold a pixel value for thisColorModel. SinceDirectColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. If thistransferTypeis not supported anUnsupportedOperationExceptionis thrown. @param inData the specified pixel @return the alpha component of the specified pixel scaled from 0 to 255. @exceptionClassCastExceptionifinDatais not a primitive array of typetransferType@exceptionArrayIndexOutOfBoundsExceptionifinDatais not large enough to hold a pixel value for thisColorModel@exceptionUnsupportedOperationExceptionif thistranferTypeis not supported by thisColorModel
Returns the alpha component for the specified pixel scaled from 0 to 255. The pixel value is specified as anClass DirectColorModel, int getAlphaMask()int. @param pixel the specified pixel @return the value of the alpha component ofpixelfrom 0 to 255.
Returns the mask indicating which bits in anClass DirectColorModel, inintpixel representation contain the alpha component. @return the mask which indicates which bits of theintpixel representation contain the alpha sample.