|
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, int getBlue(Object)intpixel representation contain the alpha component. @return the mask which indicates which bits of theintpixel representation contain the alpha sample.
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getBlue(int)ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. The returned valuewill beis a non pre-multiplied valuei.e.Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the blue valuewill beis 0). 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. AnUnsupportedOperationExceptionis thrown if thistransferTypeis not supported by thisColorModel. @param inData the array containing the pixel value @return the value of the blue component of the specified pixel. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for this color model @throws ClassCastException ifinDatais not a primitive array of typetransferType@throws UnsupportedOperationException if thistransferTypeis not supported by this color model
Returns the blue color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getBlueMask()ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified as anint. The returned valuewill beis a non pre-multiplied valuei.e. Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the blue valuewillis 0. @param pixel the specified pixel @return the blue color component for the specified pixelbefrom 0)to 255 in the sRGBColorSpace.
Returns the mask indicating which bits in anClass DirectColorModel, int[] getComponents(Object, int[], int)intpixel representation contain the blue color component. @return the mask which indicates which bits of theintpixel representation contain the blue color sample.
Returns an array of unnormalized color/alpha components given a pixel in thisClass DirectColorModel, int[] getComponents(int, int[], int)ColorModel. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. Ifpixelis not a primitive array of typetransferTypeaClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifpixelis not large enough to hold a pixel value for thisColorModel. If thecomponentsarray isnulla new arraywill beis allocated. Thecomponentsarraywill beis 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. Since)DirectColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param pixel the specified pixel @param components the array to receive the color and alpha components of the specified pixel @param offset the offset into thecomponentsarray at which to start storing the color and alpha components @exception ClassCastException ifpixelis not a primitive array of typetransferType@exception ArrayIndexOutOfBoundsException ifpixelis not large enough to hold a pixel value for thisColorModelor ifcomponentsis notnulland is not large enough to hold all the color and alpha components starting atoffset@exception UnsupportedOperationException if thistransferTypeis not supported by this color model
Returns an array of unnormalized color/alpha components given a pixel in thisClass DirectColorModel, int getDataElement(int[], int)ColorModel. The pixel value is specified as anint. If thecomponentsarray isnulla new arraywill beis allocated. Thecomponentsarraywill beis 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. @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).
Returns a pixel value represented as anClass DirectColorModel, Object getDataElements(int, Object)intin thisColorModelgiven an array of unnormalized color/alpha components. AnArrayIndexOutOfBoundsExceptionis thrown if thecomponentsarray is not large enough to hold all the color and alpha components(starting atoffset. @param components an array of unnormalized color and alpha components @param offset the index into)componentsat which to begin retrieving the color and alpha components @return anintpixel value in thisColorModelcorresponding to the specified components. @exceptionArrayIndexOutOfBoundsExceptionif thecomponentsarray is not large enough to hold all of the color and alpha components starting atoffset
Returns a data element array representation of a pixel in thisClass DirectColorModel, 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 the pixel variable isnulla new arraywill beis 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 arraywillis returned. SinceDirectColorModelcan bereturnedsubclassed 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 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@exception ClassCastException ifpixelis not a primitive array of typetransferType@exception ArrayIndexOutOfBoundsException ifpixelis not large enough to hold a pixel value for thisColorModel@exception UnsupportedOperationException if thistransferTypeis not supported by thisColorModel@see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns a data element array representation of a pixel in thisClass DirectColorModel, 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 at offset). If theobjvariable isnulla new arraywill beis allocated. Ifobjis notnullit must be a primitive array of typetransferType; otherwise aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifobjis 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. @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. @exceptionClassCastExceptionifobjis not a primitive array of typetransferType@exceptionArrayIndexOutOfBoundsExceptionifobjis 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@exception UnsupportedOperationException if thistransferTypeis not supported by this color model @see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getGreen(int)ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. The returned valuewill beis a non pre-multiplied valuei.e.Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the green valuewill beis 0). 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. AnUnsupportedOperationExceptionis thrown if thistransferTypeis not supported by thisColorModel. @param inData the array containing the pixel value @return the value of the green component of the specified pixel. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for this color model @throws ClassCastException ifinDatais not a primitive array of typetransferType@throws UnsupportedOperationException if thistransferTypeis not supported by this color model
Returns the green color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getGreenMask()ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified as anint. The returned valuewill beis a non pre-multiplied valuei.e. Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the green valuewillis 0. @param pixel the specified pixel @return the green color component for the specified pixelbefrom 0)to 255 in the sRGBColorSpace.
Returns the mask indicating which bits in anClass DirectColorModel, int getRGB(Object)intpixel representation contain the green color component. @return the mask which indicates which bits of theintpixel representation contain the green color sample.
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 DirectColorModel, int getRGB(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. The returned valuewill beis in a non pre-multiplied formati.e.Thus if the alpha is premultiplied this methodwill dividedivides it out of the color components.(ifIf the alpha value is 0 for example the color valueswillis 0. SinceDirectColorModelcan be0)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 specified pixel @return the color and alpha components of the specified pixel. @exception UnsupportedOperationException if thistransferTypeis not supported by thisColorModel@see ColorModel#getRGBdefault
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 anClass DirectColorModel, int getRed(Object)int. The returned valuewill beis in a non pre-multiplied formati.e.Thus if the alpha is premultiplied this methodwill dividedivides it out of the color components.(ifIf the alpha value is 0 for example the color valueswill beare each 0). @param pixel the specified pixel @return the RGB value of the color/alpha components of the specified pixel. @see ColorModel#getRGBdefault
Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getRed(int)ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. The returned valuewill beis a non pre-multiplied valuei.e.Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the red valuewill beis 0). 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. AnUnsupportedOperationExceptionis thrown if thistransferTypeis not supported by thisColorModel. @param inData the array containing the pixel value @return the value of the red component of the specified pixel. @throws ArrayIndexOutOfBoundsException ifinDatais not large enough to hold a pixel value for this color model @throws ClassCastException ifinDatais not a primitive array of typetransferType@throws UnsupportedOperationException if thistransferTypeis not supported by this color model
Returns the red color component for the specified pixel scaled from 0 to 255 in the default RGBClass DirectColorModel, int getRedMask()ColorSpacesRGB. A color conversion is done if necessary. The pixel value is specified as anint. The returned valuewill beis a non pre-multiplied valuei.e. Thus if the alpha is premultiplied this methodwill dividedivides it out before returning the value.(ifIf the alpha value is 0 for example the red valuewillis 0. @param pixel the specified pixel @return the red color component for the specified pixelbefrom 0)to 255 in the sRGBColorSpace.
Returns the mask indicating which bits in anClass DirectColorModel, boolean isCompatibleRaster(Raster)intpixel representation contain the red color component. @return the mask which indicates which bits of theintpixel representation contain the red color sample.
Returnstrueifrasteris compatible with thisColorModelandfalseif it is not. @param raster the Raster object to test for compatibility @returntrueifrasteris compatible with thisColorModel;falseotherwise.
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
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
This class implements a filter for the set of interface methods that are used to deliver data from an ImageProducer to an ImageConsumer. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is a base class that provides the calls needed to implement a "Null filter" which has no effect on the data being passed through. Filters should subclass this class and override the methods which deal with the data that needs to be filtered and modify it as necessary. @see FilteredImageSource @see ImageConsumer @version 1.Class ImageFilter, ImageFilter getFilterInstance(ImageConsumer)20 0923 02/2102/9800 @author Jim Graham
Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer. The default implementation just clones this object.Class ImageFilter, void imageComplete(int)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.
Filters the information provided in the imageComplete method of the ImageConsumer interface.Class ImageFilter, void setColorModel(ColorModel)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
Filter the information provided in the setColorModel method of the ImageConsumer interface.Class ImageFilter, void setDimensions(int, int)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
Filters the information provided in the setDimensions method of the ImageConsumer interface.Class ImageFilter, void setHints(int)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
Filters the information provided in the setHints method of the ImageConsumer interface.Class ImageFilter, void setPixels(int, int, int, int, ColorModel, byte[], int, int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being 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
Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.Class ImageFilter, void setPixels(int, int, int, int, ColorModel, int[], int, int)Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being 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
Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.Class ImageFilter, void setProperties(Hashtable)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
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.
An asynchronous update interface for receiving notifications about Image information as the Image is constructed. @version 1.Class ImageObserver, boolean imageUpdate(Image, int, int, int, int, int)21 0924 02/2102/9800 @author Jim Graham
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
infoflagsargument should be the bitwise inclusive OR of the following flags:WIDTHHEIGHTPROPERTIESSOMEBITSFRAMEBITSALLBITSERRORABORT. @param img the image being observed. @param infoflags the bitwise inclusive OR of the following flags:WIDTHHEIGHTPROPERTIESSOMEBITSFRAMEBITSALLBITSERRORABORT. @param x the x coordinate. @param y the y coordinate. @param width the width. @param height the height. @returnfalseif the infoflags indicate that the image is completely loaded;trueotherwise. @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
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, constructor IndexColorModel(int, int, byte[], byte[], byte[])ATheIndexColorModelclass is aColorModel 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 suppliedwhichthat indicates a completely transparent pixel regardless of any alpha component recorded for that pixel value. Note that alpha values inIndexColorModelsIndexColorModelobjects 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
IndexColorModelobject and n must be between 1 and 16. Higher order bits in pixel representations are assumed to be zero. For those methodswhichthat use a primitive array pixel representation of typetransferTypethe array length is always one. The transfer types supported are DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTand 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 methodswhichthat use this representationwilldo not throw anIllegalArgumentExceptiondue 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
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, byte[], byte[], byte[], byte[])IndexColorModelfrom thegivenspecified arrays of red green and blue components. Pixels described by this color modelwillall have alpha components of 255 unnormalized (1.0normalized)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. TheColorSpacewillisbethe default sRGB space. The transparency valuewill beis Transparency.OPAQUE. The transfer typewillisbethe smallest of DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTor DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param rThethe array of red color components.@param gThethe array of green color components.@param bThethe array of blue color components.@throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, byte[], byte[], byte[], int)IndexColorModelfrom 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 ColorSpacewillisbethe default sRGB space. The transparency valuewill beis Transparency.TRANSLUCENT. The transfer typewillisbethe smallest of DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTor DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param rThethe array of red color components.@param gThethe array of green color components.@param bThethe array of blue color components.@param aThethe array of alpha value components.@throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, byte[], int, boolean)IndexColorModelfrom the given arrays of red green and blue components. Pixels described by this color modelwillall have alpha components of 255 unnormalized (1.0normalized)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 ColorSpacewill beis the default sRGB space. The transparency valuewillisbeTransparency.BITMASK. The transfer typewill beis the smallest of DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTor DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param rThethe array of red color components.@param gThethe array of green color components.@param bThethe array of blue color components.@param transThethe index of the transparent pixel.@throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, byte[], int, boolean, int)IndexColorModelfrom 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 ColorSpacewill beis the default sRGB space. The transparency valuewill beis Transparency.TRANSLUCENT ifhasAlphaistrueTransparency.OPAQUE otherwise. The transfer typewill beis the smallest of DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTor DataBuffer.TYPE_INTUSHORT that can hold a single pixel.sRGB ColorSpace.@param bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param cmapThethe array of color components.@param startThethe starting offset of the first color component.@param hasalphaIndicatesindicates whether alpha values are contained in thecmaparray.@throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Constructs anClass IndexColorModel, constructor IndexColorModel(int, int, int[], int, boolean, int, int)IndexColorModelfrom a single array of interleaved red green blue and optional alpha components. The specified transparent index represents a pixel thatwill 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 ColorSpacewill beis the default sRGB space. The transparency valuewill beis Transparency.TRANSLUCENT ifhasAlphaistrue; otherwise itwill beis Transparency.BITMASK iftransis a valid index into the colormap (between 0 and size - 1) or Transparency.OPAQUE iftransis not a valid index. The transfer typewill beis the smallest of DataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTor DataBuffer.TYPE_INTUSHORT that can hold a single pixel. @param bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param cmapThethe array of color components.@param startThethe starting offset of the first color component.@param hasalphaIndicatesindicates whether alpha values are contained in thecmaparray.@param transThethe index of the fully transparent pixel.@throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Constructs anClass IndexColorModel, BufferedImage convertToIntDiscrete(Raster, boolean)IndexColorModelfrom 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 thatwill 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 ColorSpacewill beis the default sRGB space. The transparency valuewill beis Transparency.TRANSLUCENT ifhasAlphaistrue; otherwise itwill beis Transparency.BITMASK iftransis a valid index into the colormap (between 0 and size - 1) or Transparency.OPAQUE iftransis 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 bitsThethe number of bits each pixel occupies.@param sizeThethe size of the color component arrays.@param cmapThethe array of color components.@param startThethe starting offset of the first color component.@param hasalphaIndicatesindicates whether alpha values are contained in thecmaparray.@param transThethe index of the fully transparent pixel @param transferType the data type of the array used to represent pixel values. The data type must be eitherDataBuffer.TYPE_BYTEorDataBuffer.TYPE_USHORT. @throws IllegalArgumentException ifbitsis less than 1 or greater than 16 @throws IllegalArgumentException ifsizeis less than 1
Returns a newClass IndexColorModel, SampleModel createCompatibleSampleModel(int, int)BufferedImageof TYPE_INT_ARGB or TYPE_INT_RGBwhichthat has aRasterwith pixel data computed by expanding the indices in the sourceRasterusing the color/alpha component arrays of thisColorModel. IfforceARGBistruea TYPE_INT_ARGB image is returned regardless of whether or not thisColorModelhas an alpha component array or a transparent pixel. @param raster the specifiedRaster@param forceARGB iftruethe returnedBufferedImageis TYPE_INT_ARGB; otherwise it is TYPE_INT_RGB @return aBufferedImagecreated with the specifiedRaster
Creates aClass IndexColorModel, WritableRaster createCompatibleWritableRaster(int, int)SampleModelwith the specified width and height that has a data layout compatible with thisColorModel. @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. @throws IllegalArgumentException ifworhis not greater than 0 @see SampleModel
Creates aClass IndexColorModel, int getAlpha(int)WritableRasterwith the specified width and height that has a data layout (SampleModel) compatible with thisColorModel. This method only works for color models with 16 or fewer bits per pixel.Since
@throws UnsupportedOperationException if the number ofIndexColorModelcan be subclassed any subclass that supports greater than 16 bits per pixel must override this method. @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.pixelbits inthis ColorModela pixel is greater than 16.@see WritableRaster @see SampleModel
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 pixelClass IndexColorModel, void getAlphas(byte[])
Copies the array of alpha transparency components into theClass IndexColorModel, int getBlue(int)givenspecified array. Only the initial entries of the array as specified bygetMapSize() willbeare written. @param a the specified array into which the elements of the array of alpha components are copied
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 valueClass IndexColorModel, void getBlues(byte[])will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the blue color component for the specified pixel
Copies the array of blue color components into theClass IndexColorModel, int[] getComponentSize()givenspecified array. Only the initial entries of the array as specified bygetMapSize() willbeare written. @param b the specified array into which the elements of the array of blue color components are copied
Returns an array of the number of bitsClass IndexColorModel, int[] getComponents(Object, int[], int)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 thisIndexColorModel
Returns an array of unnormalized color/alpha componentsClass IndexColorModel, int[] getComponents(int, int[], int)givenfor a specified pixel in thisColorModel. The pixel value is specified by an array of data elements of typetransferTypepassed in as an object reference. Ifpixelis not a primitive array of typetransferTypeaClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown ifpixelis not large enough to hold a pixel value for thisColorModel. If thecomponentsarray isnulla new arraywill beis allocated. Thecomponentsarraywill beis returned. Color/alpha components are stored in thecomponentsarray starting atoffset(even if the array is allocated by this method). AnArrayIndexOutOfBoundsExceptionis also thrown if thecomponentsarray is notnulland is not large enough to hold all the color and alpha components(starting atoffset.Since
starting at the specified offsetIndexColorModelcan be subclassed subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupportedtransferType. @param pixel the specified pixel @param components 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). @throws ArrayIndexOutOfBoundsException ifpixelis not large enough to hold a pixel value for thisColorModelor if thecomponentsarray is notnulland is not large enough to hold all the color and alpha components starting atoffset@throws ClassCastException ifpixelis not a primitive array of typetransferType@throws UnsupportedOperationException iftransferTypeis not one of the supported transer types
Returns an array of unnormalized color/alpha componentsClass IndexColorModel, int getDataElement(int[], int)givenfor a specified pixel in thisColorModel. The pixel value is specified as an int. If the components array isnulla new arraywill beis allocated. The components arraywill beis 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 atoffset. @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).
Returns a pixel value represented as an int in thisClass IndexColorModel, Object getDataElements(int, Object)ColorModelgiven an array of unnormalized color/alpha components. AnArrayIndexOutOfBoundsExceptionis thrown if thecomponentsarray is not large enough to hold all of the color and alpha components(starting atoffset. 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 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. @throws ArrayIndexOutOfBoundsException if thecomponentsarray is not large enough to hold all of the color and alpha components starting atoffset@throws UnsupportedOperationException iftransferTypeis invalid
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 isClass IndexColorModel, Object getDataElements(int[], int, Object)nulla new arraywill beis 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 arraywillis returned.Since
beIndexColorModelcanreturnedsubclassed 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 the integer pixel representation in the default RGB color model @param pixel the specified pixel @return an array representation of the specified pixel in thisIndexColorModel. @throws ClassCastException ifpixelis not a primitive array of typetransferType@throws ArrayIndexOutOfBoundsException ifpixelis not large enough to hold a pixel value for thisColorModel@throws UnsupportedOperationException iftransferTypeis invalid @see WritableRaster#setDataElements @see SampleModel#setDataElements
Returns a data element array representation of a pixel in thisClass IndexColorModel, int getGreen(int)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 of the color and alpha components(starting atoffset. If the pixel variable is)nulla new arraywill beis allocated. Ifpixelis notnullit must be a primitive array of typetransferType; otherwise aClassCastExceptionis thrown. AnArrayIndexOutOfBoundsExceptionis thrown if pixel is not large enough to hold a pixel value for thisColorModel.Since
. @throws ClassCastException ifIndexColorModelcan 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 components an array of unnormalized color and alpha components @param offset the index intocomponentsat which to begin retrieving color and alpha components @param pixel theObjectrepresenting an array of color and alpha components @return anObjectrepresenting an array of color and alpha componentspixelis not a primitive array of typetransferType@throws ArrayIndexOutOfBoundsException ifpixelis 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@throws UnsupportedOperationException iftransferTypeis not one of the supported transer types @see WritableRaster#setDataElements @see SampleModel#setDataElements
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 valueClass IndexColorModel, void getGreens(byte[])will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the green color component for the specified pixel
Copies the array of green color components into theClass IndexColorModel, int getMapSize()givenspecified array. Only the initial entries of the array as specified bygetMapSizeare written. @param g the specified array into which the elements of the array of green color components are copied()
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 valueClass IndexColorModel, void getRGBs(int[])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
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 theClass IndexColorModel, int getRed(int)givenspecified array. Only the initial entries of the array as specified bygetMapSize() willbeare written. @param rgb the specified array into which the converted ARGB values from this array of color and alpha components are copied.
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 valueClass IndexColorModel, void getReds(byte[])will beis a non pre-multiplied value. @param pixel the specified pixel @return the value of the red color component for the specified pixel
Copies the array of red color components into theClass IndexColorModel, int getTransparency()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
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 thisClass IndexColorModel, boolean isCompatibleRaster(Raster)IndexColorModelor -1 if there is no transparent pixel. @return the index of thisIndexColorModelobject's transparent pixel or -1 if there is no such pixel.
ReturnsClass IndexColorModel, boolean isCompatibleSampleModel(SampleModel)trueifrasteris compatible with thisColorModelandorfalseif it is not compatible with thisColorModel. @param raster the Raster object to test for compatibility @returntrueifrasteris compatible with thisColorModel;falseotherwise.
Checks if the specifiedClass IndexColorModel, String toString()SampleModelis compatible with thisColorModel. Ifsmisnullthis method returnsfalse. @param sm the specifiedSampleModelornull@returntrueif the specifiedSampleModel is compatible with thisColorModel;falseotherwise. @see SampleModel
PrintsReturns theStringrepresentation of the contents of thisColorModelobject. @return aStringrepresenting the contents of thisColorModelobject.
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; yThe MemoryImageSource is also capable of managing a memory image which varies over time to allow animation or custom rendering. Here is an example showing how to set up the animation source and signal changes in the data (adapted from the MemoryAnimationSourceDemo by Garth Dickie): int pixels[]; MemoryImageSource source; public void init() { int width = 50; int height = 50; int size = width * height; pixels = new int[size]; int value = getBackground().getRGB(); for (int i = 0; i@see ImageProducer @version 1. 21 0923 02/2102/9800 @author Jim Graham @author Animation capabilities inspired by the MemoryAnimationSource class written by Garth Dickie
Constructs aClass MultiPixelPackedSampleModel, constructor MultiPixelPackedSampleModel(int, int, int, int, int, int)MultiPixelPackedSampleModelwith 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 ifdataTypeis not eitherDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT
Constructs aClass MultiPixelPackedSampleModel, SampleModel createCompatibleSampleModel(int, int)MultiPixelPackedSampleModelwith 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 ifworhis not greater than 0 @throws IllegalArgumentException ifdataTypeis not eitherDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT
Creates a newClass MultiPixelPackedSampleModel, SampleModel createSubsetSampleModel(int[])MultiPixelPackedSampleModelwith the specified width and height. The newMultiPixelPackedSampleModelhas the same storage data type and number of bits per pixel as thisMultiPixelPackedSampleModel. @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 thisMultiPixelPackedSampleModel. @throws IllegalArgumentException ifworhis not greater than 0
Creates a newMultiPixelPackedSampleModelwith a subset of the bands of thisMultiPixelPackedSampleModel. Since aMultiPixelPackedSampleModelonly has one band the bands argument must have a length of one and indicate the zeroth band. @param bands the specified bands @return a newSampleModelwith a subset of bands of thisMultiPixelPackedSampleModel. @exception RasterFormatException if the number of bands requested is not one. @throws IllegalArgumentException ifworhis not greater than 0
Class PackedColorModel, constructor PackedColorModel(ColorSpace, int, int, int, int, int, boolean, int, int)AnThePackedColorModelclass 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 theColorSpace. Theremaycan be a single alpha sample.ForThe array length is always 1 for those methodswhichthat use a primitive array pixel representation of typetransferType.the array length is alwaysThe transfer types supported areoneDataBuffer.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 getNumComponents
()} -1.The first getNumColorComponents()indices refer to color samples.If an alpha sample is present it corresponds the last index. The order of the color indices is specified by the ColorSpace. Typically this reflects the name of the color space typee.g.(for example TYPE_RGB) index 0 corresponds to red index 1 to green and index 2 to blue.The transfer types supported are DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT and DataBuffer.TYPE_INT.The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. A
PackedColorModelis typically used with image datawhichthat uses masks to define packed samples. For example aPackedColorModelcan be used in conjunction with a SinglePixelPackedSampleModel to 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 datawill beis done according to the masks of theColorModel.A single
intpixel representation is valid for all objects of this class since it is always possible to represent pixel values used with this class in a singleint. Therefore methodswhichthat use this representationwilldo not throw anIllegalArgumentExceptiondue to an invalid pixel value.A subclass of
PackedColorModelis DirectColorModel which is similar to an X11 TrueColor visual. @see DirectColorModel @see SinglePixelPackedSampleModel @see BufferedImage @version 10 Feb 1997
Constructs aClass PackedColorModel, constructor PackedColorModel(ColorSpace, int, int[], int, boolean, int, int)PackedColorModelfrom thegivenspecified masksspecifyingwhich indicate which bits in anintpixel representation contain the alpha red green and blue color samples. Color componentswill beare in the specifiedColorSpacewhich 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 anintpixel representation. Ifamaskis 0 there is no alpha. 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 transparencytransspecifies 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 specifiedColorSpace@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 isAlphaPremultipliedtrueif color samples are premultiplied by the alpha sample;falseotherwise @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 ifspaceis not a TYPE_RGB space @see ColorSpace
Constructs aClass PackedColorModel, SampleModel createCompatibleSampleModel(int, int)PackedColorModelfrom a color mask array which specifies which bits in anintpixel representation contain each of the color samples and an alpha mask. Color componentswill beare in the specifiedColorSpace. The length ofcolorMaskArrayshould be the number of components in theColorSpace. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of anintpixel representation. If thealphaMaskis 0 there is no alpha. 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 transparencytransspecifies 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 specifiedColorSpace@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 isAlphaPremultipliedtrueif color samples are premultiplied by the alpha sample;falseotherwise @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 ifbitsis less than 1 or greater than 32
Creates aClass PackedColorModel, WritableRaster getAlphaRaster(WritableRaster)SampleModelwith the specified width and height that has a data layout compatible with thisColorModel. @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 createdSampleModel. @throws IllegalArgumentException ifworhis not greater than 0 @see SampleModel
Returns aClass PackedColorModel, int getMask(int)RasterWritableRaster representing the alpha channel of an image extracted from the inputRasterWritableRaster. This method assumes thatRastersWritableRasterobjects associated with thisColorModelstore the alpha band if present as the last band of image data. Returnsnullif there is no separate spatial alpha channel associated with thisColorModel. This methodwill createcreates a newRasterWritableRaster(butwill shareshares the data array). @param raster aWritableRastercontaining an image @return aWritableRasterthat represents the alpha channel of the image contained inraster.
Returns the mask indicating which bits inClass PackedColorModel, int[] getMasks()an inta pixelrepresentationcontain the specified color/alpha sample. For color samplestheindexcorresponds to the placement of color sample names in the color space. Thus anindex equal to 0 for a CMYK ColorSpace would correspond to Cyan and anindex equal to 1 would correspond to Magenta. If there is alpha the alphaindexwould be:alphaIndex = numComponents() - 1;@param index the specified color or alpha sample @return the mask which indicates which bits of theintpixel representation contain the color or alpha sample specified byindex. @throws ArrayIndexOutOfBoundsException ifindexis greater than the number of components minus 1 in thisPackedColorModelor ifindexis less than zero
Returns a mask array indicating which bits inClass PackedColorModel, boolean isCompatibleSampleModel(SampleModel)ana pixel contain the color and alpha samples. @return the mask array which indicates which bits of theint pixel representation contain the colorandor alpha samples.
Checks if the specifiedSampleModelis compatible with thisColorModel. Ifsmisnullthis method returnsfalse. @param sm the specifiedSampleModelornull@returntrueif the specifiedSampleModel is compatible with thisColorModel;falseotherwise. @see SampleModel
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 ColorModelClass PixelGrabber, boolean grabPixels(long)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
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 ofClass PixelGrabber, int status()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.
- If
ms== 0 waits until all pixels are delivered- If
ms> 0 waits until all pixels are delivered as timeout expires.- If
ms<0 returnstrueif all pixels are grabbedfalseotherwise and does not wait.
DEPRECATED:ReturnsReplaced bythe status of the pixels. The ImageObserver flags representing the available pixel information are returned. This method and getStatus have the same implementation butgetStatusis 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().
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 ifClass PixelInterleavedSampleModel, SampleModel createCompatibleSampleModel(int, int)worhis not greater than 0 @throws IllegalArgumentException if any offset between bands is greater than the scanline stride @throws IllegalArgumentException if the product ofpixelStrideandwis greater thanscanlineStride@throws IllegalArgumentException ifpixelStrideis less than any offset between bands @throws IllegalArgumentException ifdataTypeis not one of the supported data types
Creates a new PixelInterleavedSampleModel with the specified width and height. The new PixelInterleavedSampleModel will have the same number of bands storage data type and pixel stride as this PixelInterleavedSampleModel. The band offsets may be compressed such that the minimum of all of the band offsets is zero. @param w the width of the resultingSampleModel@param h the height of the resultingSampleModel@throws IllegalArgumentException ifworhis not greater than 0
This class provides an easy way to create an ImageFilter which modifies the pixels of an image in the default RGB ColorModel. It is meant to be used in conjunction with a FilteredImageSource object to produce filtered versions of existing images. It is an abstract class that provides the calls needed to channel all of the pixel data through a single method which converts pixels one at a time in the default RGB ColorModel regardless of the ColorModel being used by the ImageProducer. The only method which needs to be defined to create a useable image filter is the filterRGB method. Here is an example of a definition of a filter which swaps the red and blue components of an image:Class RGBImageFilter, void setColorModel(ColorModel)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
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.Class RGBImageFilter, 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 @see ColorModel#getRGBdefault
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.Class RGBImageFilter, 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 ColorModel#getRGBdefault @see #filterRGBPixels
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
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 ColorModel#getRGBdefault @see #filterRGBPixels
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 ifClass Raster, WritableRaster createBandedRaster(int, int, int, int, Point)dataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT
Creates a Raster based on a BandedSampleModel with the specified data type width height and number of bands.Class Raster, WritableRaster createBandedRaster(int, int, int, int, int[], int[], Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @throws ArrayIndexOutOfBoundsException if
bandsis less than 1
Creates a Raster based on a BandedSampleModel with the specified data type width height scanline stride bank indices and band offsets. The number of bands is inferred from bankIndices.length and bandOffsets.length which must be the same.Class Raster, WritableRaster createInterleavedRaster(DataBuffer, int, int, int, int, int[], Point)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
dataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT@throws ArrayIndexOutOfBoundsException ifbankIndicesorbandOffsetsisnull
Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer width height scanline stride pixel stride and band offsets. The number of bands is inferred from bandOffsets.length. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used.Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, Point)Note that interleaved
DataBuffer.TYPE_INTRasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INTuse Raster.createPackedRaster(). @throws IllegalArgumentException ifdataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORT@throws RasterFormatException ifdataBufferhas more than one bank.
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type width height and number of bands.Class Raster, WritableRaster createInterleavedRaster(int, int, int, int, int, int[], Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
Note that interleaved
DataBuffer.TYPE_INTRasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INTuse Raster.createPackedRaster().The only dataTypes supported currently are TYPE_BYTE
TYPE_USHORTand TYPE_INTUSHORT.
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type width height scanline stride pixel stride and band offsets. The number of bands is inferred from bandOffsets.length.Class Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
Note that interleaved
DataBuffer.TYPE_INTRasters are not supported. To create a 1-band Raster of typeDataBuffer.TYPE_INTuse Raster.createPackedRaster().The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT.
and@throws IllegalArgumentException ifdataTypeis not one of the supported data types which areDataBuffer.TYPE_INTBYTEDataBuffer.TYPE_USHORT orDataBuffer.TYPE_INT
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 ifClass Raster, WritableRaster createPackedRaster(DataBuffer, int, int, int, int[], Point)dataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT@throws RasterFormatException ifdataBufferhas more than one bank.
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 ifClass Raster, WritableRaster createPackedRaster(int, int, int, int, int, Point)dataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT@throws RasterFormatException ifdataBufferhas more than one bank.
Creates a Raster based on a packed SampleModel with the specified data type width height number of bands and bits per band. If the number of bands is one the SampleModel will be a MultiPixelPackedSampleModel.Class Raster, WritableRaster createPackedRaster(int, int, int, int[], Point)If the number of bands is more than one the SampleModel will be a SinglePixelPackedSampleModel with each band having bitsPerBand bits. In either case the requirements on dataType and bitsPerBand imposed by the corresponding SampleModel must be met.
The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @throws IllegalArgumentException if the product of
bitsPerBandandbandsis greater than the number of bits held bydataType@throws IllegalArgumentException ifbitsPerBandorbandsis not greater than zero @throws IllegalArgumentException ifdataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT
Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type width height and band masks. The number of bands is inferred from bandMasks.length.Class Raster, Raster createRaster(SampleModel, DataBuffer, Point)The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @throws IllegalArgumentException if
dataTypeis not one of the supported data types which areDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_INT
Creates a Raster with the specified SampleModel and DataBuffer. The upper left corner of the Raster is given by the location argument. If location is null (0 0) will be used. @throws RasterFormatException ifClass Raster, WritableRaster createWritableRaster(SampleModel, DataBuffer, Point)dataBufferhas more than one bank and thesampleModelis PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel.
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.Class Raster, WritableRaster createWritableRaster(SampleModel, Point)The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT. @throws RasterFormatException if
dataBufferhas more than one bank and thesampleModelis PixelInterleavedSampleModel SinglePixelPackedSampleModel or MultiPixelPackedSampleModel.
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.Class Raster, Object getDataElements(int, int, Object)The only dataTypes supported currently are TYPE_BYTE TYPE_USHORT and TYPE_INT.
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.
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.Class ReplicateScaleFilter, constructor ReplicateScaleFilter(int, int)7 0412 02/2602/9900 @author Jim Graham
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 ifClass ReplicateScaleFilter, void setDimensions(int, int)widthequals zero orheightequals zero
Override the dimensions of the source image and pass the dimensions of the new scaled size to the ImageConsumer.Class ReplicateScaleFilter, 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
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.Class ReplicateScaleFilter, 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.
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.Class ReplicateScaleFilter, 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 scale applied.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 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
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.Class SinglePixelPackedSampleModel, constructor SinglePixelPackedSampleModel(int, int, int, int, int[])The following code illustrates extracting the bits of the sample representing band
bfor pixelx yfrom DataBufferdata:int sample = data.getElem(y * scanlineStride + x); sample = (sample & bitMasks[b]) >>> bitOffsets[b];
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 ifClass SinglePixelPackedSampleModel, constructor SinglePixelPackedSampleModel(int, int, int, int[])worhis not greater than 0 @throws IllegalArgumentException if any mask inbitMaskis not contiguous @throws IllegalArgumentException ifdataTypeis not eitherDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_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 ifClass SinglePixelPackedSampleModel, SampleModel createCompatibleSampleModel(int, int)dataTypeis not eitherDataBuffer.TYPE_BYTEDataBuffer.TYPE_USHORTorDataBuffer.TYPE_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 resultingSampleModel@param h the height of the resultingSampleModel@throws IllegalArgumentException ifworhis not greater than 0
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.