The java.awt.image package contains classes and interfaces for manipulating images. Note that the java.awt.Image class itself is not part of this package. In Java 1.0 and Java 1.1, the image processing model was optimized for streaming image data loaded over a network and processed on the fly. It involved the ImageProducer, ImageConsumer, and ImageObserver interfaces and the ImageFilter class. This image-processing model is complex and difficult to use. Much of it has been superseded in Java 1.2.
In Java 2D, the image-processing model has been extended (and simplified) to accommodate image data that is stored and manipulated in memory. The key pieces of this new image-processing model are the BufferedImage class, which represents an image in memory, and the BufferedImageOp interface, which represents an image-processing operation. Every BufferedImage contains a Raster object that hold the pixels of the image and a ColorModel object that can interpret those pixel values as Color objects. A Raster object, in turn, contains a DataBuffer that holds the raw image data and a SampleModel object that knows how to extract pixel values from that raw data.
Figure 18-1 shows the class hierarchy of this package. See Chapter 4, "Graphics with AWT and Java 2D", for a discussion of images and image processing.
AffineTransformOp | Java 1.2 | |
|
||
java.awt.image |
This class is a BufferedImageOp and a RasterOp that performs an arbitrary java.awt.geom.AffineTransform on a BufferedImage or Raster. To create an AffineTransformOp, you must specify the desired AffineTransform and the interpolation mode to use when interpolation is necessary to determine the pixel or color values of the destination. TYPE_NEAREST_NEIGHBOR is the quicker form of interpolation, but TYPE_BILINEAR produces better results. You may also specify the type of interpolation to use by specifying a java.awt.RenderingHints object that contains an interpolation hint.
To use an AffineTransformOp, simply pass a BufferedImage or Raster to the filter() method. Note that for this operation the destination image or raster cannot be the same as the source image or raster. See BufferedImageOp for further details.
public class AffineTransformOp implements BufferedImageOp, RasterOp { | ||
// | Public Constructors | |
public AffineTransformOp (java.awt.geom.AffineTransform xform, RenderingHints hints); | ||
public AffineTransformOp (java.awt.geom.AffineTransform xform, int interpolationType); | ||
// | Public Constants | |
public static final int TYPE_BILINEAR ; | =2 | |
public static final int TYPE_NEAREST_NEIGHBOR ; | =1 | |
// | Public Instance Methods | |
public final int getInterpolationType (); | ||
public final java.awt.geom.AffineTransform getTransform (); | ||
// | Methods Implementing BufferedImageOp | |
public BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public final BufferedImage filter (BufferedImage src, BufferedImage dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public final WritableRaster filter (Raster src, WritableRaster dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
} |
Hierarchy: Object-->AffineTransformOp(BufferedImageOp,RasterOp)
AreaAveragingScaleFilter | Java 1.1 | |
|
||
java.awt.image | cloneable PJ1.1 |
This class implements an ImageFilter that scales an image to a specified pixel size. It uses a scaling algorithm that averages adjacent pixel values when shrinking an image, which produces relatively smooth scaled images. Its superclass, ReplicateScaleFilter, implements a faster, less smooth scaling algorithm. The easiest way to use this filter is to call the getScaledInstance() method of java.awt.Image, specifying an appropriate hint constant.
The methods of this class are ImageConsumer methods intended for communication between the image filter and the FilteredImageSource that uses it. Applications do not usually call these methods directly.
public class AreaAveragingScaleFilter extends ReplicateScaleFilter { | ||
// | Public Constructors | |
public AreaAveragingScaleFilter (int width, int height); | ||
// | Public Methods Overriding ReplicateScaleFilter | |
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
// | Public Methods Overriding ImageFilter | |
public void setHints (int hints); | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)-->ReplicateScaleFilter-->AreaAveragingScaleFilter
BandCombineOp | Java 1.2 | |
|
||
java.awt.image |
This RasterOp allows the bands of image data in a Raster to be arbitrarily combined using a matrix. For example, you can use a BandCombineOp to convert three bands of color image data to a single band of grayscale image data. The number of columns of the matrix should be equal to the number of bands in the source raster or the number of bands plus one, if you are adding constant values as part of the combination. The number of rows in the matrix should be equal to the number of bands in the destination Raster.
As an example, consider the following matrix with four columns and
three rows, used to convert a Raster with three
bands to another three-banded raster:
This matrix is used to convert the source bands s1,
s2, and s3 into
destination bands d1, d2, and
d3, using the following formulas:
d1 = s1*m11 + s2*m21 + s3*m31 + c1; d2 = s1*m12 + s2*m22 + s3*m32 + c2; d3 = s1*m13 + s2*m23 + s3*m33 + c3;
If the constants c1, c2, and c3 are all 0, they can be omitted from the vector.
After creating a BandCombineOp for a specified vector, you perform the operation by passing a source and optional destination Raster to the filter() method. Because this operation processes each pixel independently, you can specify the same Raster object as both source and destination. BandCombineOp does not implement BufferedImageOp and cannot be used to process BufferedImage objects. See RasterOp for further details.
public class BandCombineOp implements RasterOp { | ||
// | Public Constructors | |
public BandCombineOp (float[ ][ ] matrix, RenderingHints hints); | ||
// | Public Instance Methods | |
public final float[ ][ ] getMatrix (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public WritableRaster filter (Raster src, WritableRaster dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
} |
Hierarchy: Object-->BandCombineOp(RasterOp)
BandedSampleModel | Java 1.2 | |
|
||
java.awt.image |
This SampleModel represents image data stored so that each color component is in a separate data element of a DataBuffer and each band of color components is in a separate bank of the DataBuffer. For example, it can be used to represent RGB colors stored in three separate banks of short values. Most applications never need to use this class. See SampleModel for further information.
public final class BandedSampleModel extends ComponentSampleModel { | ||
// | Public Constructors | |
public BandedSampleModel (int dataType, int w, int h, int numBands); | ||
public BandedSampleModel (int dataType, int w, int h, int scanlineStride, int[ ] bankIndices, int[ ] bandOffsets); | ||
// | Public Methods Overriding ComponentSampleModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public DataBuffer createDataBuffer (); | ||
public SampleModel createSubsetSampleModel (int[ ] bands); | ||
public Object getDataElements (int x, int y, Object obj, DataBuffer data); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public int[ ] getPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public int getSample (int x, int y, int b, DataBuffer data); | ||
public int[ ] getSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
public void setDataElements (int x, int y, Object obj, DataBuffer data); | ||
public void setPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public void setSample (int x, int y, int b, int s, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
} |
Hierarchy: Object-->SampleModel-->ComponentSampleModel-->BandedSampleModel
BufferedImage | Java 1.2 | |
|
||
java.awt.image |
This is the central class in the simplified, immediate-mode imaging API introduced in Java 1.2 as part of Java 2D. A BufferedImage represents an image as a rectangular array of pixels in a Raster object and a ColorModel object that is capable of interpreting the pixel values of the Raster. BufferedImage extends java.awt.Image and can therefore be used anywhere that an Image can. However, a BufferedImage always holds its image data in memory, so there is no need for the complicated ImageObserver interface to handle asynchronous notifications as image data loads over a network.
If you know the data format of the image you need, you can create a BufferedImage by calling the BufferedImage() constructor. For example, to create an off-screen image with an alpha channel for use in complex color compositing operations, you can call BufferedImage() with the desired image size and an image type of TYPE_INT_ARGB. If you want to create an off-screen image and you do not need an alpha channel, it is easier to simply call the createImage() method of a java.awt.Component. Although this method is declared to return an Image, in Java 1.2 it is guaranteed to return a BufferedImage. The advantage to using this method is that it creates a BufferedImage with a type that is the same as (or can be efficiently converted to) the type used on your screen. If you do not have a Component handy, you can achieve the same effect by calling the createCompatibleImage() method of the java.awt.GraphicsConfiguration object that represents your screen configuration.
Once you have created a BufferedImage, you can call createGraphics() to obtain a Graphics2D object that you can use to draw into the image. You can draw a BufferedImage onto the screen or into any other image, using any of the drawImage() methods of Graphics or Graphics2D. You can perform image processing on a BufferedImage by passing it to the filter() method of any BufferedImageOp object. Finally, you can query and set individual pixels (or blocks of pixels) in a BufferedImage with getRGB() and setRGB(). These methods use the default ARGB color model: each pixel contains 8 bits of alpha, red, green, and blue data.
BufferedImage implements WritableRenderedImage, which in turn implements RenderedImage. These interfaces are used primarily by the forthcoming Java Advanced Imaging (JAI) API (javax.jai.*). Their methods allow an image to be divided up into multiple rectangular tiles. The BufferedImage class defines each image as a single tile, so most of these methods have trivial implementations. Most applications can simply ignore the RenderedImage and WritableRenderedImage methods of this class.
public class BufferedImage extends Image implements WritableRenderedImage { | ||
// | Public Constructors | |
public BufferedImage (int width, int height, int imageType); | ||
public BufferedImage (ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, java.util.Hashtable properties); | ||
public BufferedImage (int width, int height, int imageType, IndexColorModel cm); | ||
// | Public Constants | |
public static final int TYPE_3BYTE_BGR ; | =5 | |
public static final int TYPE_4BYTE_ABGR ; | =6 | |
public static final int TYPE_4BYTE_ABGR_PRE ; | =7 | |
public static final int TYPE_BYTE_BINARY ; | =12 | |
public static final int TYPE_BYTE_GRAY ; | =10 | |
public static final int TYPE_BYTE_INDEXED ; | =13 | |
public static final int TYPE_CUSTOM ; | =0 | |
public static final int TYPE_INT_ARGB ; | =2 | |
public static final int TYPE_INT_ARGB_PRE ; | =3 | |
public static final int TYPE_INT_BGR ; | =4 | |
public static final int TYPE_INT_RGB ; | =1 | |
public static final int TYPE_USHORT_555_RGB ; | =9 | |
public static final int TYPE_USHORT_565_RGB ; | =8 | |
public static final int TYPE_USHORT_GRAY ; | =11 | |
// | Property Accessor Methods (by property name) | |
public boolean isAlphaPremultiplied (); | ||
public WritableRaster getAlphaRaster (); | ||
public ColorModel getColorModel (); | Implements:RenderedImage | |
public Raster getData (); | Implements:RenderedImage | |
public Raster getData (Rectangle rect); | Implements:RenderedImage | |
public void setData (Raster r); | Implements:WritableRenderedImage | |
public Graphics getGraphics (); | Overrides:Image | |
public int getHeight (); | Implements:RenderedImage | |
public int getHeight (ImageObserver observer); | Overrides:Image | |
public int getMinTileX (); | Implements:RenderedImage constant | |
public int getMinTileY (); | Implements:RenderedImage constant | |
public int getMinX (); | Implements:RenderedImage | |
public int getMinY (); | Implements:RenderedImage | |
public int getNumXTiles (); | Implements:RenderedImage constant | |
public int getNumYTiles (); | Implements:RenderedImage constant | |
public String[ ] getPropertyNames (); | Implements:RenderedImage constant | |
public WritableRaster getRaster (); | ||
public SampleModel getSampleModel (); | Implements:RenderedImage | |
public ImageProducer getSource (); | Overrides:Image | |
public java.util.Vector getSources (); | Implements:RenderedImage constant | |
public int getTileGridXOffset (); | Implements:RenderedImage | |
public int getTileGridYOffset (); | Implements:RenderedImage | |
public int getTileHeight (); | Implements:RenderedImage | |
public int getTileWidth (); | Implements:RenderedImage | |
public int getType (); | ||
public int getWidth (); | Implements:RenderedImage | |
public int getWidth (ImageObserver observer); | Overrides:Image | |
public Point[ ] getWritableTileIndices (); | Implements:WritableRenderedImage | |
// | Public Instance Methods | |
public void coerceData (boolean isAlphaPremultiplied); | ||
public Graphics2D createGraphics (); | ||
public int getRGB (int x, int y); | ||
public int[ ] getRGB (int startX, int startY, int w, int h, int[ ] rgbArray, int offset, int scansize); | ||
public BufferedImage getSubimage (int x, int y, int w, int h); | ||
public void setRGB (int x, int y, int rgb); | synchronized | |
public void setRGB (int startX, int startY, int w, int h, int[ ] rgbArray, int offset, int scansize); | ||
// | Other Methods Implementing RenderedImage | |
public WritableRaster copyData (WritableRaster outRaster); | ||
public Object getProperty (String name); | ||
public Raster getTile (int tileX, int tileY); | ||
// | Methods Implementing WritableRenderedImage | |
public void addTileObserver (TileObserver to); | empty | |
public WritableRaster getWritableTile (int tileX, int tileY); | ||
public Point[ ] getWritableTileIndices (); | ||
public boolean hasTileWriters (); | constant | |
public boolean isTileWritable (int tileX, int tileY); | ||
public void releaseWritableTile (int tileX, int tileY); | empty | |
public void removeTileObserver (TileObserver to); | empty | |
public void setData (Raster r); | ||
// | Public Methods Overriding Image | |
public void flush (); | empty | |
public Object getProperty (String name, ImageObserver observer); | ||
// | Public Methods Overriding Object | |
public String toString (); | ||
} |
Hierarchy: Object-->Image-->BufferedImage(WritableRenderedImage(RenderedImage))
Passed To: Too many methods to list.
Returned By: Too many methods to list.
BufferedImageFilter | Java 1.2 | |
|
||
java.awt.image | cloneable |
This class allows a Java 1.2 BufferedImageOp image-processing operation to be used as an ImageFilter in the Java 1.0 and Java 1.1 image processing model. Create a BufferedImageFilter by passing a BufferedImageOp to the constructor. Then use the resulting BufferedImageFilter with a FilteredImageSource exactly as you would use RGBImageFilter, CropImageFilter, or any other Java 1.0 or Java 1.1 image filter.
public class BufferedImageFilter extends ImageFilter implements Cloneable { | ||
// | Public Constructors | |
public BufferedImageFilter (BufferedImageOp op); | ||
// | Public Instance Methods | |
public BufferedImageOp getBufferedImageOp (); | ||
// | Public Methods Overriding ImageFilter | |
public void imageComplete (int status); | ||
public void setColorModel (ColorModel model); | ||
public void setDimensions (int width, int height); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)-->BufferedImageFilter(Cloneable)
BufferedImageOp | Java 1.2 | |
|
||
java.awt.image |
This interface describes an image-processing operation that can be performed on any BufferedImage. Java 2D includes a number of versatile implementations of this interface that most applications can rely for all their image-processing needs.
To use a BufferedImageOp, call its filter() method. This method processes a specified source image and stores the results in a specified destination image. If no destination image is specified, the method creates and returns an appropriate one. You can pass a source image to getBounds2D() to get the bounding box of the destination image that would be produced if that source image were to be passed to filter(). Given a point in a (hypothetical) source image, getPoint2D() returns the corresponding point in the destination image. If a destination Point2D object is provided, it is used to return the destination point; otherwise a Point2D object is allocated for this purpose. getRenderingHints() returns the rendering hints associated with this implementation of BufferedImageOp, or null if it has no rendering hints. Finally, createCompatibleDestImage() is an internal method that implementations must define but that applications never need to call.
public abstract interface BufferedImageOp { | ||
// | Public Instance Methods | |
public abstract BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public abstract BufferedImage filter (BufferedImage src, BufferedImage dest); | ||
public abstract java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public abstract java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public abstract RenderingHints getRenderingHints (); | ||
} |
Implementations: AffineTransformOp, ColorConvertOp, ConvolveOp, LookupOp, RescaleOp
Passed To: Graphics2D.drawImage(), BufferedImageFilter.BufferedImageFilter()
Returned By: BufferedImageFilter.getBufferedImageOp()
ByteLookupTable | Java 1.2 | |
|
||
java.awt.image |
This concrete subclass of LookupTable contains one or more byte arrays that serve as lookup tables for a LookupOp image-processing operation. Applications never need to use a ByteLookupTable directly; they need to create one only to pass to the LookupOp() constructor. Create a ByteLookupTable by passing the byte array or arrays to the ByteLookupTable() constructor, along with an offset that is subtracted from each source color component before the lookup is performed. See also LookupTable.
public class ByteLookupTable extends LookupTable { | ||
// | Public Constructors | |
public ByteLookupTable (int offset, byte[ ][ ] data); | ||
public ByteLookupTable (int offset, byte[ ] data); | ||
// | Public Instance Methods | |
public final byte[ ][ ] getTable (); | ||
public byte[ ] lookupPixel (byte[ ] src, byte[ ] dst); | ||
// | Public Methods Overriding LookupTable | |
public int[ ] lookupPixel (int[ ] src, int[ ] dst); | ||
} |
Hierarchy: Object-->LookupTable-->ByteLookupTable
ColorConvertOp | Java 1.2 | |
|
||
java.awt.image |
This class is a BufferedImageOp and a RasterOp that converts the colors of a BufferedImage or a Raster from one color space to another color space. If the filter() method is called with two distinct source and destination BufferedImage objects specified, it converts the colors from the java.awt.color.ColorSpace of the source image to the ColorSpace of the destination image. If no destination image is passed to filter(), the destination ColorSpace must have been specified when the ColorConvertOp() constructor was called. Finally, if this ColorConvertOp is to be used to filter Raster object, both the source and destination color spaces must be specified, either in the form of ColorSpace objects or as an array of two java.awt.color.ICC_PROFILE objects.
In addition to optionally specifying the source and destination color spaces when you invoke the ColorConvertOp() constructor, you may also specify a RenderingHints object. If the hints object is non-null, the ColorConvertOp may use the color rendering and dithering hints it contains.
To use a ColorConvertOp, simply pass a source and optional destination image or raster to the filter() method. Because the ColorConvertOp works on each pixel of the image or raster independently, you may specify the same object for both source and destination. In this case, the image or raster is modified in place. See BufferedImageOp for further details.
public class ColorConvertOp implements BufferedImageOp, RasterOp { | ||
// | Public Constructors | |
public ColorConvertOp (RenderingHints hints); | ||
public ColorConvertOp (java.awt.color.ICC_Profile[ ] profiles, RenderingHints hints); | ||
public ColorConvertOp (java.awt.color.ColorSpace cspace, RenderingHints hints); | ||
public ColorConvertOp (java.awt.color.ColorSpace srcCspace, java.awt.color.ColorSpace dstCspace, RenderingHints hints); | ||
// | Public Instance Methods | |
public final java.awt.color.ICC_Profile[ ] getICC_Profiles (); | ||
// | Methods Implementing BufferedImageOp | |
public BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public final BufferedImage filter (BufferedImage src, BufferedImage dest); | ||
public final java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public final WritableRaster filter (Raster src, WritableRaster dest); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
} |
Hierarchy: Object-->ColorConvertOp(BufferedImageOp,RasterOp)
ColorModel | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This abstract class defines a scheme for representing colors as pixels. The primary job of a ColorModel object is to extract individual color components from pixel values. Most applications do not need to work with ColorModel objects directly; those that do usually need only to instantiate an appropriate ColorModel subclass for use by some other method or constructor.
In Java 1.0 and 1.1, this is a fairly simple class: pixel values are supplied as int values, and the getRed(), getGreen(), getBlue(), and getAlpha() methods return the red, green, blue, and alpha components of the pixel. The getRGB() method converts a pixel to the pixel format used by the default ARGB color model. This color model is returned by the static getRGBDefault() method; it packs 8-bit color and alpha components into a 32-bit int in 0xAARRGGBB format.
With the introduction of Java 2D in Java 1.2, this class has become more complicated. Now the ColorModel is not tied to the default RGB java.awt.color.ColorSpace and provides methods for extracting color components from any color space. The getComponents() method and its variants return an array of color components for a given pixel value. If the ColorModel is defined in terms of the CMYK color space, for example, these components are not red, green, and blue, but cyan, magenta, yellow, and black. Note, however, that because every ColorSpace can convert colors to the default RGB color space, the getRed(), getGreen(), getBlue(), and getRGB() methods still work, regardless of color space.
Another generalization to the ColorModel class in Java 1.2 is that pixel values are no longer assumed to fit in int values. Each method that extracts color components from pixels comes in two forms. In the first, the pixel value is specified as an int. In the second form, it is specified as a Object. This object is an array of primitive values. The type of these values is known as the transfer type of the color model and is specified by one of the constants DataBuffer.TYPE_BYTE, Databuffer.TYPE_USHORT, or DataBuffer.TYPE_INT. In simple cases, the elements of the transfer type arrays contain color components, and the ColorModel object provides a trivial mapping between pixel values and color component values.
Other ColorModel additions in Java 1.2 include the implementation of the Transparency interface and its getTransparency() method. This method returns a Transparency constant that specifies the level of transparency supported by the ColorModel. For ColorModel objects that support transparency, the isAlphaPremultiplied() method specifies whether the color components have been premultiplied by the alpha component. (Premultiplication makes alpha compositing operations more efficient.) Also, the getNormalizedComponents() and getUnnormalizedComponents() convert back and forth between normalized and unnormalized color component values. A normalized component is a float value between 0.0 and 1.0 that has not been premultiplied by an alpha value. An unnormalized component is an integral value with a range that depends on the number of bits used by the color model, possibly premultiplied by the alpha value.
There are a number of ColorModel subclasses, suitable for distinctly different types of color models. See also ComponentColorModel, DirectColorModel, IndexColorModel, and PackedColorModel.
public abstract class ColorModel implements Transparency { | ||
// | Public Constructors | |
public ColorModel (int bits); | ||
// | Protected Constructors | |
1.2 | protected ColorModel (int pixel_bits, int[ ] bits, java.awt.color.ColorSpace cspace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType); | |
// | Public Class Methods | |
public static ColorModel getRGBdefault (); | ||
// | Property Accessor Methods (by property name) | |
1.2 | public final boolean isAlphaPremultiplied (); | |
1.2 | public final java.awt.color.ColorSpace getColorSpace (); | |
1.2 | public int[ ] getComponentSize (); | |
1.2 | public int getComponentSize (int componentIdx); | |
1.2 | public int getNumColorComponents (); | |
1.2 | public int getNumComponents (); | |
public int getPixelSize (); | ||
1.2 | public int getTransparency (); | Implements:Transparency |
// | Public Instance Methods | |
1.2 | public ColorModel coerceData (WritableRaster raster, boolean isAlphaPremultiplied); | |
1.2 | public SampleModel createCompatibleSampleModel (int w, int h); | |
1.2 | public WritableRaster createCompatibleWritableRaster (int w, int h); | |
1.2 | public int getAlpha (Object inData); | |
public abstract int getAlpha (int pixel); | ||
1.2 | public WritableRaster getAlphaRaster (WritableRaster raster); | constant |
1.2 | public int getBlue (Object inData); | |
public abstract int getBlue (int pixel); | ||
1.2 | public int[ ] getComponents (int pixel, int[ ] components, int offset); | |
1.2 | public int[ ] getComponents (Object pixel, int[ ] components, int offset); | |
1.2 | public int getDataElement (int[ ] components, int offset); | |
1.2 | public Object getDataElements (int rgb, Object pixel); | |
1.2 | public Object getDataElements (int[ ] components, int offset, Object obj); | |
1.2 | public int getGreen (Object inData); | |
public abstract int getGreen (int pixel); | ||
1.2 | public float[ ] getNormalizedComponents (int[ ] components, int offset, float[ ] normComponents, int normOffset); | |
public abstract int getRed (int pixel); | ||
1.2 | public int getRed (Object inData); | |
public int getRGB (int pixel); | ||
1.2 | public int getRGB (Object inData); | |
1.2 | public int[ ] getUnnormalizedComponents (float[ ] normComponents, int normOffset, int[ ] components, int offset); | |
1.2 | public final boolean hasAlpha (); | |
1.2 | public boolean isCompatibleRaster (Raster raster); | |
1.2 | public boolean isCompatibleSampleModel (SampleModel sm); | |
// | Methods Implementing Transparency | |
1.2 | public int getTransparency (); | |
// | Public Methods Overriding Object | |
1.2 | public boolean equals (Object obj); | |
public void finalize (); | empty | |
1.2 | public String toString (); | |
// | Protected Instance Fields | |
protected int pixel_bits ; | ||
1.2 | protected int transferType ; | |
} |
Hierarchy: Object-->ColorModel(Transparency)
Subclasses: ComponentColorModel, IndexColorModel, PackedColorModel
Passed To: Too many methods to list.
Returned By: Component.getColorModel(), GraphicsConfiguration.getColorModel(), PaintContext.getColorModel(), Toolkit.getColorModel(), BufferedImage.getColorModel(), ColorModel.{coerceData(), getRGBdefault()}, ComponentColorModel.coerceData(), DirectColorModel.coerceData(), PixelGrabber.getColorModel(), RenderedImage.getColorModel(), java.awt.peer.ComponentPeer.getColorModel()
Type Of: RGBImageFilter.{newmodel, origmodel}
ComponentColorModel | Java 1.2 | |
|
||
java.awt.image |
This ColorModel is used with image data in which the color and transparency components of pixels are stored separately, instead of being combined together into a single int value. This class works only with pixel values specified as an array of primitive values of the specified transfer type. The number of elements in these pixel arrays must match the number of color and transparency components in the specified color space. This class performs the trivial mapping between the array elements of the pixel value and the color components of the color it represents. The methods of this class that are passed int pixel values can throw IllegalArgumentException. Only applications that are doing custom image processing need to use this, or any, ColorModel.
public class ComponentColorModel extends ColorModel { | ||
// | Public Constructors | |
public ComponentColorModel (java.awt.color.ColorSpace colorSpace, int[ ] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType); | ||
// | Public Methods Overriding ColorModel | |
public ColorModel coerceData (WritableRaster raster, boolean isAlphaPremultiplied); | ||
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public WritableRaster createCompatibleWritableRaster (int w, int h); | ||
public boolean equals (Object obj); | ||
public int getAlpha (Object inData); | ||
public int getAlpha (int pixel); | ||
public WritableRaster getAlphaRaster (WritableRaster raster); | ||
public int getBlue (Object inData); | ||
public int getBlue (int pixel); | ||
public int[ ] getComponents (Object pixel, int[ ] components, int offset); | ||
public int[ ] getComponents (int pixel, int[ ] components, int offset); | ||
public int getDataElement (int[ ] components, int offset); | ||
public Object getDataElements (int rgb, Object pixel); | ||
public Object getDataElements (int[ ] components, int offset, Object obj); | ||
public int getGreen (Object inData); | ||
public int getGreen (int pixel); | ||
public int getRed (int pixel); | ||
public int getRed (Object inData); | ||
public int getRGB (int pixel); | ||
public int getRGB (Object inData); | ||
public boolean isCompatibleRaster (Raster raster); | ||
public boolean isCompatibleSampleModel (SampleModel sm); | ||
} |
Hierarchy: Object-->ColorModel(Transparency)-->ComponentColorModel
ComponentSampleModel | Java 1.2 | |
|
||
java.awt.image |
This SampleModel represents image data stored so that each component of each pixel is stored in a separate element of the DataBuffer. The arguments to the ComponentSampleModel allow great flexibility in this model. For example, it can represent RGB values interleaved into a single bank of bytes or ARGB values stored in four separate banks of bytes. Additionally, it can handle offsets at the end of scanlines and an offset at the beginning of each bank.
Java 2D defines two subclasses of ComponentSampleModel that are more efficient for particular types of image data. When each band of pixel components is stored in a separate bank of the DataBuffer, it is easier and more efficient to use the BandedSampleModel subclass. When the components of a pixel are stored in adjacent data elements of a single bank of the DataBuffer, it is easier and more efficient to use PixelInterleavedSampleModel.
Most applications never need to use this class or its subclasses. See SampleModel for further information.
public class ComponentSampleModel extends SampleModel { | ||
// | Public Constructors | |
public ComponentSampleModel (int dataType, int w, int h, int pixelStride, int scanlineStride, int[ ] bandOffsets); | ||
public ComponentSampleModel (int dataType, int w, int h, int pixelStride, int scanlineStride, int[ ] bankIndices, int[ ] bandOffsets); | ||
// | Property Accessor Methods (by property name) | |
public final int[ ] getBandOffsets (); | ||
public final int[ ] getBankIndices (); | ||
public final int getNumDataElements (); | Overrides:SampleModel | |
public final int getPixelStride (); | ||
public final int[ ] getSampleSize (); | Overrides:SampleModel | |
public final int getSampleSize (int band); | Overrides:SampleModel | |
public final int getScanlineStride (); | ||
// | Public Instance Methods | |
public int getOffset (int x, int y); | ||
public int getOffset (int x, int y, int b); | ||
// | Public Methods Overriding SampleModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public DataBuffer createDataBuffer (); | ||
public SampleModel createSubsetSampleModel (int[ ] bands); | ||
public Object getDataElements (int x, int y, Object obj, DataBuffer data); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public int[ ] getPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public int getSample (int x, int y, int b, DataBuffer data); | ||
public int[ ] getSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
public void setDataElements (int x, int y, Object obj, DataBuffer data); | ||
public void setPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public void setSample (int x, int y, int b, int s, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
// | Protected Instance Fields | |
protected int[ ] bandOffsets ; | ||
protected int[ ] bankIndices ; | ||
protected int numBands ; | ||
protected int numBanks ; | ||
protected int pixelStride ; | ||
protected int scanlineStride ; | ||
} |
Hierarchy: Object-->SampleModel-->ComponentSampleModel
Subclasses: BandedSampleModel, PixelInterleavedSampleModel
ConvolveOp | Java 1.2 | |
|
||
java.awt.image |
This class is a BufferedImageOp and a RasterOp that performs an arbitrary convolution on an image. Convolution is a versatile image-processing operation that can be used, for example, to blur or sharpen an image or perform edge detection on an image. The convolution to be performed is specified by a matrix of floating-point numbers, in the form of a Kernel object. Because convolution looks at the neighbors of each pixel in an image, special care must be taken when operating on the pixels at the edges of the image. By default, a ConvolveOp uses imaginary color components of all zeros when it reaches the edges of an image. You can pass EDGE_NO_OP to the constructor to specify that the edges of the image should simply be left unprocessed. Finally, you can pass a RenderingHints object to the ConvolveOp() constructor. If this argument is not null, the ConvolveOp may use its color and dithering hints.
To use a ConvolveOp, simply pass a source and optional destination image or raster to its filter() method. Note that you cannot specify the same object as both source and destination. See BufferedImageOp for further details.
public class ConvolveOp implements BufferedImageOp, RasterOp { | ||
// | Public Constructors | |
public ConvolveOp (Kernel kernel); | ||
public ConvolveOp (Kernel kernel, int edgeCondition, RenderingHints hints); | ||
// | Public Constants | |
public static final int EDGE_NO_OP ; | =1 | |
public static final int EDGE_ZERO_FILL ; | =0 | |
// | Public Instance Methods | |
public int getEdgeCondition (); | ||
public final Kernel getKernel (); | ||
// | Methods Implementing BufferedImageOp | |
public BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public final BufferedImage filter (BufferedImage src, BufferedImage dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public final WritableRaster filter (Raster src, WritableRaster dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
} |
Hierarchy: Object-->ConvolveOp(BufferedImageOp,RasterOp)
CropImageFilter | Java 1.0 | |
|
||
java.awt.image | cloneable PJ1.1 |
This class implements an ImageFilter that crops an image to a specified rectangle. The methods defined by this class are used for communication between the filter and its FilteredImageSource and should never be called directly.
public class CropImageFilter extends ImageFilter { | ||
// | Public Constructors | |
public CropImageFilter (int x, int y, int w, int h); | ||
// | Public Methods Overriding ImageFilter | |
public void setDimensions (int w, int h); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
public void setProperties (java.util.Hashtable props); | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)-->CropImageFilter
DataBuffer | Java 1.2 | |
|
||
java.awt.image |
This abstract class stores image data at the lowest level. A DataBuffer stores one or more arrays, or banks, of data of a specified size and a given type. The Raster class uses a DataBuffer to store image data and a SampleModel to interpret the storage format of that data. Most applications never need to use DataBuffer objects directly.
Specific concrete subclasses of DataBuffer are implemented for specific types of data. See also DataBufferByte, DataBufferShort, DataBufferUShort, and DataBufferInt.
public abstract class DataBuffer { | ||
// | Protected Constructors | |
protected DataBuffer (int dataType, int size); | ||
protected DataBuffer (int dataType, int size, int numBanks); | ||
protected DataBuffer (int dataType, int size, int numBanks, int[ ] offsets); | ||
protected DataBuffer (int dataType, int size, int numBanks, int offset); | ||
// | Public Constants | |
public static final int TYPE_BYTE ; | =0 | |
public static final int TYPE_DOUBLE ; | =5 | |
public static final int TYPE_FLOAT ; | =4 | |
public static final int TYPE_INT ; | =3 | |
public static final int TYPE_SHORT ; | =2 | |
public static final int TYPE_UNDEFINED ; | =32 | |
public static final int TYPE_USHORT ; | =1 | |
// | Public Class Methods | |
public static int getDataTypeSize (int type); | ||
// | Property Accessor Methods (by property name) | |
public int getDataType (); | ||
public int getNumBanks (); | ||
public int getOffset (); | ||
public int[ ] getOffsets (); | ||
public int getSize (); | ||
// | Public Instance Methods | |
public int getElem (int i); | ||
public abstract int getElem (int bank, int i); | ||
public double getElemDouble (int i); | ||
public double getElemDouble (int bank, int i); | ||
public float getElemFloat (int i); | ||
public float getElemFloat (int bank, int i); | ||
public void setElem (int i, int val); | ||
public abstract void setElem (int bank, int i, int val); | ||
public void setElemDouble (int i, double val); | ||
public void setElemDouble (int bank, int i, double val); | ||
public void setElemFloat (int i, float val); | ||
public void setElemFloat (int bank, int i, float val); | ||
// | Protected Instance Fields | |
protected int banks ; | ||
protected int dataType ; | ||
protected int offset ; | ||
protected int[ ] offsets ; | ||
protected int size ; | ||
} |
Subclasses: DataBufferByte, DataBufferInt, DataBufferShort, DataBufferUShort
Passed To: Too many methods to list.
Returned By: BandedSampleModel.createDataBuffer(), ComponentSampleModel.createDataBuffer(), MultiPixelPackedSampleModel.createDataBuffer(), Raster.getDataBuffer(), SampleModel.createDataBuffer(), SinglePixelPackedSampleModel.createDataBuffer()
Type Of: Raster.dataBuffer
DataBufferByte | Java 1.2 | |
|
||
java.awt.image |
This class stores image data in one or more byte arrays. The arrays, or banks, of data can be passed directly to the DataBufferByte() constructor, or they can be created by the constructor. You may specify an offset into each array at which the data begins. getElem() and setElem() allow you to get and set the values of a particular element of a particular bank. Most applications never use this class directly.
public final class DataBufferByte extends DataBuffer { | ||
// | Public Constructors | |
public DataBufferByte (int size); | ||
public DataBufferByte (byte[ ][ ] dataArray, int size); | ||
public DataBufferByte (byte[ ] dataArray, int size); | ||
public DataBufferByte (int size, int numBanks); | ||
public DataBufferByte (byte[ ][ ] dataArray, int size, int[ ] offsets); | ||
public DataBufferByte (byte[ ] dataArray, int size, int offset); | ||
// | Public Instance Methods | |
public byte[ ][ ] getBankData (); | ||
public byte[ ] getData (); | ||
public byte[ ] getData (int bank); | ||
// | Public Methods Overriding DataBuffer | |
public int getElem (int i); | ||
public int getElem (int bank, int i); | ||
public void setElem (int i, int val); | ||
public void setElem (int bank, int i, int val); | ||
} |
Hierarchy: Object-->DataBuffer-->DataBufferByte
DataBufferInt | Java 1.2 | |
|
||
java.awt.image |
This class stores image data in one or more int arrays. The arrays, or banks, of data can be passed directly to the DataBufferInt() constructor, or they can be created by the constructor. You may specify an offset into each array at which the data begins. getElem() and setElem() allow you to get and set the values of a particular element of a particular bank. Most applications never use this class directly.
public final class DataBufferInt extends DataBuffer { | ||
// | Public Constructors | |
public DataBufferInt (int size); | ||
public DataBufferInt (int[ ][ ] dataArray, int size); | ||
public DataBufferInt (int[ ] dataArray, int size); | ||
public DataBufferInt (int size, int numBanks); | ||
public DataBufferInt (int[ ][ ] dataArray, int size, int[ ] offsets); | ||
public DataBufferInt (int[ ] dataArray, int size, int offset); | ||
// | Public Instance Methods | |
public int[ ][ ] getBankData (); | ||
public int[ ] getData (); | ||
public int[ ] getData (int bank); | ||
// | Public Methods Overriding DataBuffer | |
public int getElem (int i); | ||
public int getElem (int bank, int i); | ||
public void setElem (int i, int val); | ||
public void setElem (int bank, int i, int val); | ||
} |
Hierarchy: Object-->DataBuffer-->DataBufferInt
DataBufferShort | Java 1.2 | |
|
||
java.awt.image |
This class stores image data in one or more short arrays. The arrays, or banks, of data can be passed directly to the DataBufferShort() constructor, or they can be created by the constructor. You may specify an offset into each array at which the data begins. getElem() and setElem() allow you to get and set the values of a particular element of a particular bank. Most applications never use this class directly.
public final class DataBufferShort extends DataBuffer { | ||
// | Public Constructors | |
public DataBufferShort (int size); | ||
public DataBufferShort (short[ ][ ] dataArray, int size); | ||
public DataBufferShort (short[ ] dataArray, int size); | ||
public DataBufferShort (int size, int numBanks); | ||
public DataBufferShort (short[ ][ ] dataArray, int size, int[ ] offsets); | ||
public DataBufferShort (short[ ] dataArray, int size, int offset); | ||
// | Public Instance Methods | |
public short[ ][ ] getBankData (); | ||
public short[ ] getData (); | ||
public short[ ] getData (int bank); | ||
// | Public Methods Overriding DataBuffer | |
public int getElem (int i); | ||
public int getElem (int bank, int i); | ||
public void setElem (int i, int val); | ||
public void setElem (int bank, int i, int val); | ||
} |
Hierarchy: Object-->DataBuffer-->DataBufferShort
DataBufferUShort | Java 1.2 | |
|
||
java.awt.image |
This class stores unsigned image data in one or more short arrays. The arrays, or banks, of data can be passed directly to the DataBufferUShort() constructor, or they can be created by the constructor. You may specify an offset into each array at which the data begins. getElem() and setElem() allow you to get and set the values of a particular element of a particular bank. Most applications never use this class directly.
public final class DataBufferUShort extends DataBuffer { | ||
// | Public Constructors | |
public DataBufferUShort (int size); | ||
public DataBufferUShort (short[ ][ ] dataArray, int size); | ||
public DataBufferUShort (short[ ] dataArray, int size); | ||
public DataBufferUShort (int size, int numBanks); | ||
public DataBufferUShort (short[ ][ ] dataArray, int size, int[ ] offsets); | ||
public DataBufferUShort (short[ ] dataArray, int size, int offset); | ||
// | Public Instance Methods | |
public short[ ][ ] getBankData (); | ||
public short[ ] getData (); | ||
public short[ ] getData (int bank); | ||
// | Public Methods Overriding DataBuffer | |
public int getElem (int i); | ||
public int getElem (int bank, int i); | ||
public void setElem (int i, int val); | ||
public void setElem (int bank, int i, int val); | ||
} |
Hierarchy: Object-->DataBuffer-->DataBufferUShort
DirectColorModel | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This ColorModel works only with RGB color spaces. It extracts red, green, blue, and, optionally, alpha values directly from the bits of the pixel, using bitmasks to specify which bits correspond to which color components. The default RGB color model is a DirectColorModel. Only applications that are doing custom image processing need to use this, or any, ColorModel.
Prior to Java 1.2, this class extended ColorModel directly. In Java 1.2, it extends PackedColorModel, which itself extends ColorModel. The Java 1.2 methods of this class that accept pixel values as an array of a primitive transfer type expect that array argument to have a length of 1.
public class DirectColorModel extends PackedColorModel { | ||
// | Public Constructors | |
public DirectColorModel (int bits, int rmask, int gmask, int bmask); | ||
public DirectColorModel (int bits, int rmask, int gmask, int bmask, int amask); | ||
1.2 | public DirectColorModel (java.awt.color.ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int transferType); | |
// | Property Accessor Methods (by property name) | |
public final int getAlphaMask (); | ||
public final int getBlueMask (); | ||
public final int getGreenMask (); | ||
public final int getRedMask (); | ||
// | Public Methods Overriding ColorModel | |
1.2 | public final ColorModel coerceData (WritableRaster raster, boolean isAlphaPremultiplied); | |
1.2 | public final WritableRaster createCompatibleWritableRaster (int w, int h); | |
1.2 | public int getAlpha (Object inData); | |
public final int getAlpha (int pixel); | ||
1.2 | public int getBlue (Object inData); | |
public final int getBlue (int pixel); | ||
1.2 | public final int[ ] getComponents (Object pixel, int[ ] components, int offset); | |
1.2 | public final int[ ] getComponents (int pixel, int[ ] components, int offset); | |
1.2 | public int getDataElement (int[ ] components, int offset); | |
1.2 | public Object getDataElements (int rgb, Object pixel); | |
1.2 | public Object getDataElements (int[ ] components, int offset, Object obj); | |
1.2 | public int getGreen (Object inData); | |
public final int getGreen (int pixel); | ||
1.2 | public int getRed (Object inData); | |
public final int getRed (int pixel); | ||
public final int getRGB (int pixel); | ||
1.2 | public int getRGB (Object inData); | |
1.2 | public boolean isCompatibleRaster (Raster raster); | |
1.2 | public String toString (); | |
} |
Hierarchy: Object-->ColorModel(Transparency)-->PackedColorModel-->DirectColorModel
FilteredImageSource | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This class is an ImageProducer that produces image data filtered from some other ImageProducer. A FilteredImageSource is created with a specified ImageProducer and a specified ImageFilter. For example, an applet might use the following code to download and crop an image:
Image full_image = getImage(getDocumentBase(), "images/1.gif"); ImageFilter cropper = new CropImageFilter(10, 10, 100, 100); ImageProducer prod = new FilteredImageSource(full_image.getSource(), cropper); Image cropped_image = createImage(prod);
The methods of this class are the standard ImageProducer methods that you can invoke to add and remove ImageConsumer objects.
public class FilteredImageSource implements ImageProducer { | ||
// | Public Constructors | |
public FilteredImageSource (ImageProducer orig, ImageFilter imgf); | ||
// | Methods Implementing ImageProducer | |
public void addConsumer (ImageConsumer ic); | synchronized | |
public boolean isConsumer (ImageConsumer ic); | synchronized | |
public void removeConsumer (ImageConsumer ic); | synchronized | |
public void requestTopDownLeftRightResend (ImageConsumer ic); | ||
public void startProduction (ImageConsumer ic); | ||
} |
Hierarchy: Object-->FilteredImageSource(ImageProducer)
ImageConsumer | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This interface defines the methods necessary for a class that consumes image data to communicate with a class that produces image data. The methods defined by this interface should never be called by a program directly; instead, they are invoked by an ImageProducer to pass the image data and other information about the image to the ImageConsumer. The constants defined by this interface are values passed to the setHints() and imageComplete() methods. Unless you want to do low-level manipulation of image data, you never need to use or implement an ImageConsumer.
public abstract interface ImageConsumer { | ||
// | Public Constants | |
public static final int COMPLETESCANLINES ; | =4 | |
public static final int IMAGEABORTED ; | =4 | |
public static final int IMAGEERROR ; | =1 | |
public static final int RANDOMPIXELORDER ; | =1 | |
public static final int SINGLEFRAME ; | =16 | |
public static final int SINGLEFRAMEDONE ; | =2 | |
public static final int SINGLEPASS ; | =8 | |
public static final int STATICIMAGEDONE ; | =3 | |
public static final int TOPDOWNLEFTRIGHT ; | =2 | |
// | Public Instance Methods | |
public abstract void imageComplete (int status); | ||
public abstract void setColorModel (ColorModel model); | ||
public abstract void setDimensions (int width, int height); | ||
public abstract void setHints (int hintflags); | ||
public abstract void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public abstract void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
public abstract void setProperties (java.util.Hashtable props); | ||
} |
Implementations: ImageFilter, PixelGrabber
Passed To: Too many methods to list.
Type Of: ImageFilter.consumer
ImageFilter | Java 1.0 | |
|
||
java.awt.image | cloneable PJ1.1 |
This class is used in conjunction with a FilteredImageSource. It accepts image data through the ImageConsumer interface and passes it on to an ImageConsumer specified by the controlling FilteredImageSource. ImageFilter is the superclass of all image filters; it performs no filtering itself. You must subclass it to perform the desired filtering. See also CropImageFilter and RGBImageFilter. The ImageFilter methods are the ImageConsumer methods invoked by an ImageProducer. You should not call them directly. See FilteredImageSource for an example of using an ImageFilter.
public class ImageFilter implements Cloneable, ImageConsumer { | ||
// | Public Constructors | |
public ImageFilter (); | ||
// | Public Instance Methods | |
public ImageFilter getFilterInstance (ImageConsumer ic); | ||
public void resendTopDownLeftRight (ImageProducer ip); | ||
// | Methods Implementing ImageConsumer | |
public void imageComplete (int status); | ||
public void setColorModel (ColorModel model); | ||
public void setDimensions (int width, int height); | ||
public void setHints (int hints); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
public void setProperties (java.util.Hashtable props); | ||
// | Public Methods Overriding Object | |
public Object clone (); | ||
// | Protected Instance Fields | |
protected ImageConsumer consumer ; | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)
Subclasses: BufferedImageFilter, CropImageFilter, ReplicateScaleFilter, RGBImageFilter
Passed To: FilteredImageSource.FilteredImageSource()
Returned By: ImageFilter.getFilterInstance()
ImageObserver | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This interface defines a method and associated constants used by classes that want to receive information asynchronously about the status of an image. Many methods that query information about an image take an ImageObserver as an argument. If the specified information is not available when requested, it is passed to the ImageObserver when it becomes available. Component implements this interface, and components are the most commonly used image observers.
public abstract interface ImageObserver { | ||
// | Public Constants | |
public static final int ABORT ; | =128 | |
public static final int ALLBITS ; | =32 | |
public static final int ERROR ; | =64 | |
public static final int FRAMEBITS ; | =16 | |
public static final int HEIGHT ; | =2 | |
public static final int PROPERTIES ; | =4 | |
public static final int SOMEBITS ; | =8 | |
public static final int WIDTH ; | =1 | |
// | Public Instance Methods | |
public abstract boolean imageUpdate (Image img, int infoflags, int x, int y, int width, int height); | ||
} |
Implementations: Component
Passed To: Too many methods to list.
Returned By: javax.swing.ImageIcon.getImageObserver()
ImageProducer | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This interface defines the methods that any class that produces image data must define to enable communication with ImageConsumer classes. An ImageConsumer registers itself as interested in a producer's image by calling the addConsumer() method. Most applications never need to use or implement this interface.
public abstract interface ImageProducer { | ||
// | Public Instance Methods | |
public abstract void addConsumer (ImageConsumer ic); | ||
public abstract boolean isConsumer (ImageConsumer ic); | ||
public abstract void removeConsumer (ImageConsumer ic); | ||
public abstract void requestTopDownLeftRightResend (ImageConsumer ic); | ||
public abstract void startProduction (ImageConsumer ic); | ||
} |
Implementations: FilteredImageSource, MemoryImageSource, java.awt.image.renderable.RenderableImageProducer
Passed To: Component.createImage(), Toolkit.createImage(), FilteredImageSource.FilteredImageSource(), ImageFilter.resendTopDownLeftRight(), PixelGrabber.PixelGrabber(), java.awt.peer.ComponentPeer.createImage()
Returned By: Image.getSource(), BufferedImage.getSource()
ImagingOpException | Java 1.2 | |
|
||
java.awt.image | serializable unchecked |
Thrown by the filter() methods of BufferedImageOp and RasterOp if, for any reason, they are unable to filter the specified image.
public class ImagingOpException extends RuntimeException { | ||
// | Public Constructors | |
public ImagingOpException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->ImagingOpException
IndexColorModel | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This ColorModel is used with RGB color spaces and determines the red, green, blue, and, optionally, alpha components of a pixel by using the pixel value as an index into colormap arrays. If no array of alpha values is specified, all pixels are fully opaque, except for one optionally specified reserved value that is fully transparent. This color model is useful when working with image data that is defined in terms of a colormap. Only applications that are doing custom image processing need to use this, or any, ColorModel.
public class IndexColorModel extends ColorModel { | ||
// | Public Constructors | |
public IndexColorModel (int bits, int size, byte[ ] cmap, int start, boolean hasalpha); | ||
public IndexColorModel (int bits, int size, byte[ ] r, byte[ ] g, byte[ ] b); | ||
public IndexColorModel (int bits, int size, byte[ ] cmap, int start, boolean hasalpha, int trans); | ||
public IndexColorModel (int bits, int size, byte[ ] r, byte[ ] g, byte[ ] b, byte[ ] a); | ||
public IndexColorModel (int bits, int size, byte[ ] r, byte[ ] g, byte[ ] b, int trans); | ||
1.2 | public IndexColorModel (int bits, int size, int[ ] cmap, int start, boolean hasalpha, int trans, int transferType); | |
// | Public Instance Methods | |
1.2 | public BufferedImage convertToIntDiscrete (Raster raster, boolean forceARGB); | |
public final void getAlphas (byte[ ] a); | ||
public final void getBlues (byte[ ] b); | ||
public final void getGreens (byte[ ] g); | ||
public final int getMapSize (); | ||
public final void getReds (byte[ ] r); | ||
1.2 | public final void getRGBs (int[ ] rgb); | |
public final int getTransparentPixel (); | ||
// | Public Methods Overriding ColorModel | |
1.2 | public SampleModel createCompatibleSampleModel (int w, int h); | |
1.2 | public WritableRaster createCompatibleWritableRaster (int w, int h); | |
1.2 | public void finalize (); | |
public final int getAlpha (int pixel); | ||
public final int getBlue (int pixel); | ||
1.2 | public int[ ] getComponents (Object pixel, int[ ] components, int offset); | |
1.2 | public int[ ] getComponents (int pixel, int[ ] components, int offset); | |
1.2 | public int[ ] getComponentSize (); | |
1.2 | public int getDataElement (int[ ] components, int offset); | |
1.2 | public Object getDataElements (int rgb, Object pixel); | |
1.2 | public Object getDataElements (int[ ] components, int offset, Object pixel); | |
public final int getGreen (int pixel); | ||
public final int getRed (int pixel); | ||
public final int getRGB (int pixel); | ||
1.2 | public int getTransparency (); | |
1.2 | public boolean isCompatibleRaster (Raster raster); | |
1.2 | public boolean isCompatibleSampleModel (SampleModel sm); | |
1.2 | public String toString (); | |
} |
Hierarchy: Object-->ColorModel(Transparency)-->IndexColorModel
Passed To: BufferedImage.BufferedImage(), RGBImageFilter.filterIndexColorModel()
Returned By: RGBImageFilter.filterIndexColorModel()
Kernel | Java 1.2 | |
|
||
java.awt.image | cloneable |
This class represents a matrix of float values,
for use with the ConvolveOp image-processing
operation. Convolution is performed by combining a pixel value with
the values of the pixels that surround it. The convolution kernel
specifies the relative contribution of each pixel to the end result.
For example, to blur an image, you can use a kernel like this:
This matrix specifies that the destination pixel is composed of one-ninth (0.111) of the source pixel plus one-ninth of each of the eight
pixels that surround it.
To create a Kernel, pass the width and height of the kernel to the constructor, along with the array of float values that comprise the kernel. The array should be organized by rows. Note that a Kernel need not have a square array. Kernels typically have an odd number of rows and columns and are placed symmetrically about the source pixel being processed. However, if the number of rows or columns is even, the origin of the Kernel is such that the extra row or column is to the bottom or the right of the pixel being processed.
public class Kernel implements Cloneable { | ||
// | Public Constructors | |
public Kernel (int width, int height, float[ ] data); | ||
// | Property Accessor Methods (by property name) | |
public final int getHeight (); | ||
public final int getWidth (); | ||
public final int getXOrigin (); | ||
public final int getYOrigin (); | ||
// | Public Instance Methods | |
public final float[ ] getKernelData (float[ ] data); | ||
// | Public Methods Overriding Object | |
public Object clone (); | ||
} |
Hierarchy: Object-->Kernel(Cloneable)
Passed To: ConvolveOp.ConvolveOp()
Returned By: ConvolveOp.getKernel()
LookupOp | Java 1.2 | |
|
||
java.awt.image |
This class is a BufferedImageOp and RasterOp that processes an image by one or more lookup tables to convert the value of each component of each pixel to a new value. LookupOp is useful for operations such as brightening or darkening an image, reducing the number of colors in an image, or thresholding an image. When you create a LookupOp object, you specify the lookup table or tables with a LookupTable object, typically a ByteLookupTable or ShortLookupTable. If the LookupTable contains one table, that table is used for all color bands of the image (but not alpha bands). Otherwise, the LookupTable should contain one table for each color band or one table for each of the color and transparency bands. If you specify a RenderingHints object when you create a LookupOp, the operation may use the color rendering and dithering hints it contains.
To use a LookupOp, simply pass a source and optional destination image or raster to the filter() method. Because LookupOp processes pixels independently of each other, you can use the same objects as both source and destination. Because of the nature of lookup tables, however, you cannot use LookupOp with images that use an IndexColorModel. If the lookup tables used by a LookupOp describe a simple linear function, you can also use a RescaleOp to achieve the same effect. See BufferedImageOp for further details.
public class LookupOp implements BufferedImageOp, RasterOp { | ||
// | Public Constructors | |
public LookupOp (LookupTable lookup, RenderingHints hints); | ||
// | Public Instance Methods | |
public final LookupTable getTable (); | ||
// | Methods Implementing BufferedImageOp | |
public BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public final BufferedImage filter (BufferedImage src, BufferedImage dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public final WritableRaster filter (Raster src, WritableRaster dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
} |
Hierarchy: Object-->LookupOp(BufferedImageOp,RasterOp)
LookupTable | Java 1.2 | |
|
||
java.awt.image |
This abstract class defines one or more lookup tables used by the LookupOp image-processing operation. lookupPixel() performs the table-lookup operation. This method is passed an array of color component source values. It transforms this array into a new array of destination values by replacing each source value with the value found in the appropriate lookup table at the index that corresponds to the source value. Note, however, that an offset may be specified for the lookup tables. If so, the offset is subtracted from the source values before the lookup is performed. See the concrete subclasses ByteLookupTable and ShortLookupTable.
public abstract class LookupTable { | ||
// | Protected Constructors | |
protected LookupTable (int offset, int numComponents); | ||
// | Public Instance Methods | |
public int getNumComponents (); | ||
public int getOffset (); | ||
public abstract int[ ] lookupPixel (int[ ] src, int[ ] dest); | ||
} |
Subclasses: ByteLookupTable, ShortLookupTable
Passed To: LookupOp.LookupOp()
Returned By: LookupOp.getTable()
MemoryImageSource | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This class is an ImageProducer that produces an image from data stored in memory. The various constructors specify image data, color model, array offset, scanline length, and properties in slightly different ways. The instance methods implement the standard ImageProducer interface that allows an ImageConsumer object to register interest in the image.
public class MemoryImageSource implements ImageProducer { | ||
// | Public Constructors | |
public MemoryImageSource (int w, int h, int[ ] pix, int off, int scan); | ||
public MemoryImageSource (int w, int h, ColorModel cm, int[ ] pix, int off, int scan); | ||
public MemoryImageSource (int w, int h, ColorModel cm, byte[ ] pix, int off, int scan); | ||
public MemoryImageSource (int w, int h, int[ ] pix, int off, int scan, java.util.Hashtable props); | ||
public MemoryImageSource (int w, int h, ColorModel cm, byte[ ] pix, int off, int scan, java.util.Hashtable props); | ||
public MemoryImageSource (int w, int h, ColorModel cm, int[ ] pix, int off, int scan, java.util.Hashtable props); | ||
// | Public Instance Methods | |
1.1 | public void newPixels (); | |
1.1 | public void newPixels (byte[ ] newpix, ColorModel newmodel, int offset, int scansize); | synchronized |
1.1 | public void newPixels (int[ ] newpix, ColorModel newmodel, int offset, int scansize); | synchronized |
1.1 | public void newPixels (int x, int y, int w, int h); | synchronized |
1.1 | public void newPixels (int x, int y, int w, int h, boolean framenotify); | synchronized |
1.1 | public void setAnimated (boolean animated); | synchronized |
1.1 | public void setFullBufferUpdates (boolean fullbuffers); | synchronized |
// | Methods Implementing ImageProducer | |
public void addConsumer (ImageConsumer ic); | synchronized | |
public boolean isConsumer (ImageConsumer ic); | synchronized | |
public void removeConsumer (ImageConsumer ic); | synchronized | |
public void requestTopDownLeftRightResend (ImageConsumer ic); | empty | |
public void startProduction (ImageConsumer ic); | ||
} |
Hierarchy: Object-->MemoryImageSource(ImageProducer)
MultiPixelPackedSampleModel | Java 1.2 | |
|
||
java.awt.image |
This SampleModel knows how to interpret single-banded image data in a DataBuffer that is organized so that more than one pixel is packed into a single element of the data buffer. For example, a MultiPixelPackedSampleModel can be used to represent a monochrome image in which eight pixels are packed in a byte or 8-bit indexed color data in which four pixels are packed into an int. Most applications never need to use this class. See also SampleModel for further information.
public class MultiPixelPackedSampleModel extends SampleModel { | ||
// | Public Constructors | |
public MultiPixelPackedSampleModel (int dataType, int w, int h, int numberOfBits); | ||
public MultiPixelPackedSampleModel (int dataType, int w, int h, int numberOfBits, int scanlineStride, int dataBitOffset); | ||
// | Public Instance Methods | |
public int getBitOffset (int x); | ||
public int getDataBitOffset (); | ||
public int getOffset (int x, int y); | ||
public int getPixelBitStride (); | ||
public int getScanlineStride (); | ||
// | Public Methods Overriding SampleModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public DataBuffer createDataBuffer (); | ||
public int getNumDataElements (); | constant | |
public SampleModel createSubsetSampleModel (int[ ] bands); | ||
public Object getDataElements (int x, int y, Object obj, DataBuffer data); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public int getSample (int x, int y, int b, DataBuffer data); | ||
public int[ ] getSampleSize (); | ||
public int getSampleSize (int band); | ||
public int getTransferType (); | ||
public void setDataElements (int x, int y, Object obj, DataBuffer data); | ||
public void setPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public void setSample (int x, int y, int b, int s, DataBuffer data); | ||
} |
Hierarchy: Object-->SampleModel-->MultiPixelPackedSampleModel
PackedColorModel | Java 1.2 | |
|
||
java.awt.image |
This abstract ColorModel is used with image data in which color component and transparency values are packed into contiguous bits of a byte, short, or int. It uses bitmasks and bit-shifting operations to extract the color and transparency components from the pixel value. DirectColorModel is a concrete subclass that works with RGB color spaces. Only applications that are doing custom image processing need to use this, or any, ColorModel.
public abstract class PackedColorModel extends ColorModel { | ||
// | Public Constructors | |
public PackedColorModel (java.awt.color.ColorSpace space, int bits, int[ ] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType); | ||
public PackedColorModel (java.awt.color.ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int trans, int transferType); | ||
// | Public Instance Methods | |
public final int getMask (int index); | ||
public final int[ ] getMasks (); | ||
// | Public Methods Overriding ColorModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public boolean equals (Object obj); | ||
public WritableRaster getAlphaRaster (WritableRaster raster); | ||
public boolean isCompatibleSampleModel (SampleModel sm); | ||
} |
Hierarchy: Object-->ColorModel(Transparency)-->PackedColorModel
Subclasses: DirectColorModel
PixelGrabber | Java 1.0 | |
|
||
java.awt.image | PJ1.1 |
This class is an ImageConsumer that extracts a specified rectangular array of pixels (in the default RGB color model) from a specified Image or ImageProducer and stores them in a specified array (using the specified offset into the array and specified scanline size). Use this class when you want to inspect or manipulate the data of an image or some rectangular portion of an image.
The method grabPixels() makes the PixelGrabber start grabbing pixels. status() returns the status of the pixel-grabbing process. The return value uses the same flag value constants that the ImageObserver class does. The remaining methods are the standard ImageConsumer methods and should not be called directly.
public class PixelGrabber implements ImageConsumer { | ||
// | Public Constructors | |
1.1 | public PixelGrabber (Image img, int x, int y, int w, int h, boolean forceRGB); | |
public PixelGrabber (ImageProducer ip, int x, int y, int w, int h, int[ ] pix, int off, int scansize); | ||
public PixelGrabber (Image img, int x, int y, int w, int h, int[ ] pix, int off, int scansize); | ||
// | Property Accessor Methods (by property name) | |
1.1 | public ColorModel getColorModel (); | synchronized |
public void setColorModel (ColorModel model); | Implements:ImageConsumer empty | |
1.1 | public int getHeight (); | synchronized |
1.1 | public Object getPixels (); | synchronized |
1.1 | public int getStatus (); | synchronized |
1.1 | public int getWidth (); | synchronized |
// | Public Instance Methods | |
1.1 | public void abortGrabbing (); | synchronized |
public boolean grabPixels () throws InterruptedException; | ||
public boolean grabPixels (long ms) throws InterruptedException; | synchronized | |
1.1 | public void startGrabbing (); | synchronized |
public int status (); | synchronized | |
// | Methods Implementing ImageConsumer | |
public void imageComplete (int status); | synchronized | |
public void setColorModel (ColorModel model); | empty | |
public void setDimensions (int width, int height); | ||
public void setHints (int hints); | empty | |
public void setPixels (int srcX, int srcY, int srcW, int srcH, ColorModel model, int[ ] pixels, int srcOff, int srcScan); | ||
public void setPixels (int srcX, int srcY, int srcW, int srcH, ColorModel model, byte[ ] pixels, int srcOff, int srcScan); | ||
public void setProperties (java.util.Hashtable props); | empty | |
} |
Hierarchy: Object-->PixelGrabber(ImageConsumer)
PixelInterleavedSampleModel | Java 1.2 | |
|
||
java.awt.image |
This SampleModel represents image data stored so that each component of each pixel is stored in a separate element of the DataBuffer and all pixel components are stored in the same bank of the DataBuffer. For example, it can be used to represent RGB pixels in which the red, green, and blue components are interleaved into a single bank of byte values. Most applications never need to use this class or its subclasses. See SampleModel for further information.
public class PixelInterleavedSampleModel extends ComponentSampleModel { | ||
// | Public Constructors | |
public PixelInterleavedSampleModel (int dataType, int w, int h, int pixelStride, int scanlineStride, int[ ] bandOffsets); | ||
// | Public Methods Overriding ComponentSampleModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public SampleModel createSubsetSampleModel (int[ ] bands); | ||
} |
Hierarchy: Object-->SampleModel-->ComponentSampleModel-->PixelInterleavedSampleModel
Raster | Java 1.2 | |
|
||
java.awt.image |
This class represents a rectangular array of pixels. A Raster is composed of a DataBuffer that contains raw pixel data and a matching SampleModel that knows how to extract pixel data from that DataBuffer. A Raster object is used within a BufferedImage object, which also contains a ColorModel object to interpret the pixel values of the Raster as colors. Most applications can simply used BufferedImage objects and never have to work with Raster objects directly.
Raster does not have any public constructors. You can call the static method createRaster() or createWritableRaster() to create a Raster using arbitrary DataBuffer and SampleModel objects. However, you usually obtain more efficient results if you use createBandedRaster(), createInterleavedRaster(), or createPackedRaster() to create a Raster using one of the data formats supported by the built-in DataBuffer and SampleModel subclasses.
Raster contains a number of methods to read individual pixels and blocks of pixels. Note, however, that there are no methods to set pixel values. If you want to modify pixels in a Raster, you must use the WritableRaster subclass. A Raster can have a parent Raster that contains the actual data. The createChild() method uses this feature to return a Raster object that represents a rectangular subset of the current raster. (It can also return a child Raster that contains only a subset of the bands of the parent raster: for example, a Raster that contains only the alpha band of transparency values of its parent.) Finally, while BufferedImage objects have only a width and height, Raster objects have a size and location. Thus, you can specify an origin when you create a Raster.
public class Raster { | ||
// | Protected Constructors | |
protected Raster (SampleModel sampleModel, Point origin); | ||
protected Raster (SampleModel sampleModel, DataBuffer dataBuffer, Point origin); | ||
protected Raster (SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, Raster parent); | ||
// | Public Class Methods | |
public static WritableRaster createBandedRaster (int dataType, int w, int h, int bands, Point location); | ||
public static WritableRaster createBandedRaster (int dataType, int w, int h, int scanlineStride, int[ ] bankIndices, int[ ] bandOffsets, Point location); | ||
public static WritableRaster createBandedRaster (DataBuffer dataBuffer, int w, int h, int scanlineStride, int[ ] bankIndices, int[ ] bandOffsets, Point location); | ||
public static WritableRaster createInterleavedRaster (int dataType, int w, int h, int bands, Point location); | ||
public static WritableRaster createInterleavedRaster (int dataType, int w, int h, int scanlineStride, int pixelStride, int[ ] bandOffsets, Point location); | ||
public static WritableRaster createInterleavedRaster (DataBuffer dataBuffer, int w, int h, int scanlineStride, int pixelStride, int[ ] bandOffsets, Point location); | ||
public static WritableRaster createPackedRaster (DataBuffer dataBuffer, int w, int h, int bitsPerPixel, Point location); | ||
public static WritableRaster createPackedRaster (int dataType, int w, int h, int[ ] bandMasks, Point location); | ||
public static WritableRaster createPackedRaster (DataBuffer dataBuffer, int w, int h, int scanlineStride, int[ ] bandMasks, Point location); | ||
public static WritableRaster createPackedRaster (int dataType, int w, int h, int bands, int bitsPerBand, Point location); | ||
public static Raster createRaster (SampleModel sm, DataBuffer db, Point location); | ||
public static WritableRaster createWritableRaster (SampleModel sm, Point location); | ||
public static WritableRaster createWritableRaster (SampleModel sm, DataBuffer db, Point location); | ||
// | Property Accessor Methods (by property name) | |
public Rectangle getBounds (); | ||
public DataBuffer getDataBuffer (); | ||
public final int getHeight (); | ||
public final int getMinX (); | ||
public final int getMinY (); | ||
public final int getNumBands (); | ||
public final int getNumDataElements (); | ||
public Raster getParent (); | ||
public SampleModel getSampleModel (); | ||
public final int getSampleModelTranslateX (); | ||
public final int getSampleModelTranslateY (); | ||
public final int getTransferType (); | ||
public final int getWidth (); | ||
// | Public Instance Methods | |
public Raster createChild (int parentX, int parentY, int width, int height, int childMinX, int childMinY, int[ ] bandList); | ||
public WritableRaster createCompatibleWritableRaster (); | ||
public WritableRaster createCompatibleWritableRaster (Rectangle rect); | ||
public WritableRaster createCompatibleWritableRaster (int w, int h); | ||
public WritableRaster createCompatibleWritableRaster (int x, int y, int w, int h); | ||
public Raster createTranslatedChild (int childMinX, int childMinY); | ||
public Object getDataElements (int x, int y, Object outData); | ||
public Object getDataElements (int x, int y, int w, int h, Object outData); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray); | ||
public float[ ] getPixel (int x, int y, float[ ] fArray); | ||
public double[ ] getPixel (int x, int y, double[ ] dArray); | ||
public int[ ] getPixels (int x, int y, int w, int h, int[ ] iArray); | ||
public float[ ] getPixels (int x, int y, int w, int h, float[ ] fArray); | ||
public double[ ] getPixels (int x, int y, int w, int h, double[ ] dArray); | ||
public int getSample (int x, int y, int b); | ||
public double getSampleDouble (int x, int y, int b); | ||
public float getSampleFloat (int x, int y, int b); | ||
public int[ ] getSamples (int x, int y, int w, int h, int b, int[ ] iArray); | ||
public float[ ] getSamples (int x, int y, int w, int h, int b, float[ ] fArray); | ||
public double[ ] getSamples (int x, int y, int w, int h, int b, double[ ] dArray); | ||
// | Protected Instance Fields | |
protected DataBuffer dataBuffer ; | ||
protected int height ; | ||
protected int minX ; | ||
protected int minY ; | ||
protected int numBands ; | ||
protected int numDataElements ; | ||
protected Raster parent ; | ||
protected SampleModel sampleModel ; | ||
protected int sampleModelTranslateX ; | ||
protected int sampleModelTranslateY ; | ||
protected int width ; | ||
} |
Subclasses: WritableRaster
Passed To: Too many methods to list.
Returned By: PaintContext.getRaster(), BufferedImage.{getData(), getTile()}, Raster.{createChild(), createRaster(), createTranslatedChild(), getParent()}, RenderedImage.{getData(), getTile()}
Type Of: Raster.parent
RasterFormatException | Java 1.2 | |
|
||
java.awt.image | serializable unchecked |
Signals that a Raster is improperly configured.
public class RasterFormatException extends RuntimeException { | ||
// | Public Constructors | |
public RasterFormatException (String s); | ||
} |
Hierarchy: Object-->Throwable(Serializable)-->Exception-->RuntimeException-->RasterFormatException
RasterOp | Java 1.2 | |
|
||
java.awt.image |
This interface defines an image-processing operation that can be performed on a Raster. It is very similar to the BufferedImageOp, except that the operation is performed directly on the uninterpreted pixels of Raster data, rather than on the color values of a BufferedImage. Many of the implementations of BufferedImageOp are also implementations of RasterOp. See BufferedImageOp for details.
public abstract interface RasterOp { | ||
// | Public Instance Methods | |
public abstract WritableRaster createCompatibleDestRaster (Raster src); | ||
public abstract WritableRaster filter (Raster src, WritableRaster dest); | ||
public abstract java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
public abstract java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public abstract RenderingHints getRenderingHints (); | ||
} |
Implementations: AffineTransformOp, BandCombineOp, ColorConvertOp, ConvolveOp, LookupOp, RescaleOp
RenderedImage | Java 1.2 | |
|
||
java.awt.image |
This interface describes the methods of rendered images. RenderedImage exists primarily for use by the forthcoming Java Advanced Imaging API (javax.jai.*), but it is also implemented (through WritableRenderedImage) by BufferedImage, meaning that BufferedImage images will be able to interoperate with JAI-rendered images.
The getSources() method and the tile-related methods of RenderedImage are used in the JAI, and are not of interest in Java 2D. BufferedImage objects contain only a single tile, so the BufferedImage class defines implementations of these methods. Methods that are of interest include getData(), getSampleModel(), and getColorModel(). These methods return a copy of the Raster that contains pixels, the SampleModel that specifies the internal organization of the Raster, and the ColorModel that specifies how to interpret the pixels as colors, respectively. getWidth(), getHeight(), and copyData() are also useful in Java 2D programs.
public abstract interface RenderedImage { | ||
// | Property Accessor Methods (by property name) | |
public abstract ColorModel getColorModel (); | ||
public abstract Raster getData (); | ||
public abstract Raster getData (Rectangle rect); | ||
public abstract int getHeight (); | ||
public abstract int getMinTileX (); | ||
public abstract int getMinTileY (); | ||
public abstract int getMinX (); | ||
public abstract int getMinY (); | ||
public abstract int getNumXTiles (); | ||
public abstract int getNumYTiles (); | ||
public abstract String[ ] getPropertyNames (); | ||
public abstract SampleModel getSampleModel (); | ||
public abstract java.util.Vector getSources (); | ||
public abstract int getTileGridXOffset (); | ||
public abstract int getTileGridYOffset (); | ||
public abstract int getTileHeight (); | ||
public abstract int getTileWidth (); | ||
public abstract int getWidth (); | ||
// | Public Instance Methods | |
public abstract WritableRaster copyData (WritableRaster raster); | ||
public abstract Object getProperty (String name); | ||
public abstract Raster getTile (int tileX, int tileY); | ||
} |
Implementations: WritableRenderedImage
Passed To: Graphics2D.drawRenderedImage()
Returned By: java.awt.image.renderable.ContextualRenderedImageFactory.create(), java.awt.image.renderable.ParameterBlock.getRenderedSource(), java.awt.image.renderable.RenderableImage.{createDefaultRendering(), createRendering(), createScaledRendering()}, java.awt.image.renderable.RenderableImageOp.{createDefaultRendering(), createRendering(), createScaledRendering()}, java.awt.image.renderable.RenderedImageFactory.create()
ReplicateScaleFilter | Java 1.1 | |
|
||
java.awt.image | cloneable PJ1.1 |
This class implements an ImageFilter that scales an image to a specified pixel size. It uses a simple scaling algorithm in which rows and columns of image pixels are duplicated or omitted as necessary to achieve the desired size. See AreaAveragingScaleFilter for a scaling filter that results in smoother images. The methods of this class are ImageConsumer methods used for communication between the image filter and the FilteredImageSource that uses it. Applications usually do not call these methods directly. The easiest way to use this filter is to call the getScaledInstance() method of Image, specifying an appropriate hint constant.
public class ReplicateScaleFilter extends ImageFilter { | ||
// | Public Constructors | |
public ReplicateScaleFilter (int width, int height); | ||
// | Public Methods Overriding ImageFilter | |
public void setDimensions (int w, int h); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
public void setProperties (java.util.Hashtable props); | ||
// | Protected Instance Fields | |
protected int destHeight ; | ||
protected int destWidth ; | ||
protected Object outpixbuf ; | ||
protected int[ ] srccols ; | ||
protected int srcHeight ; | ||
protected int[ ] srcrows ; | ||
protected int srcWidth ; | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)-->ReplicateScaleFilter
Subclasses: AreaAveragingScaleFilter
RescaleOp | Java 1.2 | |
|
||
java.awt.image |
This class is a BufferedImageOp and a RasterOp that performs a linear scaling on the components of each pixel in an image by multiplying them by a scale factor and adding a constant. When you create a RescaleOp, you specify either a single scale factor and a single offset or an array of scale factors and an array of constants. If only one scale factor and constant are specified, then all color bands of the image are rescaled identically. Otherwise, there should be one scale factor and constant for each color band or for each color band plus the alpha transparency band. In this case, each color band, and possibly the alpha band, is rescaled independently.
To use a RescaleOp, simply pass a source and optional destination image or raster to the filter() method. Because RescaleOp processes pixels independently of each other, you can use the same objects as both source and destination. Because of the nature of the rescaling, however, you cannot use LookupOp with images that use an IndexColorModel. RescaleOp performs a linear rescaling. If you want to perform a nonlinear rescaling, you can do so with a LookupOp and a LookupTable that describes the desired scaling. See BufferedImageOp for further details.
public class RescaleOp implements BufferedImageOp, RasterOp { | ||
// | Public Constructors | |
public RescaleOp (float scaleFactor, float offset, RenderingHints hints); | ||
public RescaleOp (float[ ] scaleFactors, float[ ] offsets, RenderingHints hints); | ||
// | Public Instance Methods | |
public final int getNumFactors (); | ||
public final float[ ] getOffsets (float[ ] offsets); | ||
public final float[ ] getScaleFactors (float[ ] scaleFactors); | ||
// | Methods Implementing BufferedImageOp | |
public BufferedImage createCompatibleDestImage (BufferedImage src, ColorModel destCM); | ||
public final BufferedImage filter (BufferedImage src, BufferedImage dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (BufferedImage src); | ||
public final java.awt.geom.Point2D getPoint2D (java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt); | ||
public final RenderingHints getRenderingHints (); | ||
// | Methods Implementing RasterOp | |
public WritableRaster createCompatibleDestRaster (Raster src); | ||
public final WritableRaster filter (Raster src, WritableRaster dst); | ||
public final java.awt.geom.Rectangle2D getBounds2D (Raster src); | ||
} |
Hierarchy: Object-->RescaleOp(BufferedImageOp,RasterOp)
RGBImageFilter | Java 1.0 | |
|
||
java.awt.image | cloneable PJ1.1 |
This abstract class is an ImageFilter that provides an easy way to implement filters that modify the colors of an image. To create a color filter that modifies the colors of an image, you should subclass RGBImageFilter and provide a definition of filterRGB() that converts the input pixel value (in the default RGB color model) to an output value. If the conversion does not depend on the location of the pixel, set the canFilterIndexColorModel variable to true so that the RGBImageFilter can save time by filtering the colormap of an image that uses an IndexColorModel, instead of filtering each pixel of the image.
public abstract class RGBImageFilter extends ImageFilter { | ||
// | Public Constructors | |
public RGBImageFilter (); | ||
// | Public Instance Methods | |
public IndexColorModel filterIndexColorModel (IndexColorModel icm); | ||
public abstract int filterRGB (int x, int y, int rgb); | ||
public void filterRGBPixels (int x, int y, int w, int h, int[ ] pixels, int off, int scansize); | ||
public void substituteColorModel (ColorModel oldcm, ColorModel newcm); | ||
// | Public Methods Overriding ImageFilter | |
public void setColorModel (ColorModel model); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, int[ ] pixels, int off, int scansize); | ||
public void setPixels (int x, int y, int w, int h, ColorModel model, byte[ ] pixels, int off, int scansize); | ||
// | Protected Instance Fields | |
protected boolean canFilterIndexColorModel ; | ||
protected ColorModel newmodel ; | ||
protected ColorModel origmodel ; | ||
} |
Hierarchy: Object-->ImageFilter(Cloneable,ImageConsumer)-->RGBImageFilter
Subclasses: javax.swing.GrayFilter
SampleModel | Java 1.2 | |
|
||
java.awt.image |
This abstract class defines methods for extracting the pixels of an image from an arbitrary DataBuffer, regardless of how those pixels are stored in the DataBuffer. Image data is stored in a Raster object, which consists of a DataBuffer to hold the raw data and a SampleModel to interpret the storage format. Only appliations that read or write image data directly from files or other sources ever need to use this class. See also the concrete subclasses ComponentSampleModel, SinglePixelPackedSampleModel, and MultiPixelPackedSampleModel.
public abstract class SampleModel { | ||
// | Public Constructors | |
public SampleModel (int dataType, int w, int h, int numBands); | ||
// | Property Accessor Methods (by property name) | |
public final int getDataType (); | ||
public final int getHeight (); | ||
public final int getNumBands (); | ||
public abstract int getNumDataElements (); | ||
public abstract int[ ] getSampleSize (); | ||
public abstract int getSampleSize (int band); | ||
public int getTransferType (); | ||
public final int getWidth (); | ||
// | Public Instance Methods | |
public abstract SampleModel createCompatibleSampleModel (int w, int h); | ||
public abstract DataBuffer createDataBuffer (); | ||
public abstract SampleModel createSubsetSampleModel (int[ ] bands); | ||
public abstract Object getDataElements (int x, int y, Object obj, DataBuffer data); | ||
public Object getDataElements (int x, int y, int w, int h, Object obj, DataBuffer data); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public float[ ] getPixel (int x, int y, float[ ] fArray, DataBuffer data); | ||
public double[ ] getPixel (int x, int y, double[ ] dArray, DataBuffer data); | ||
public int[ ] getPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public float[ ] getPixels (int x, int y, int w, int h, float[ ] fArray, DataBuffer data); | ||
public double[ ] getPixels (int x, int y, int w, int h, double[ ] dArray, DataBuffer data); | ||
public abstract int getSample (int x, int y, int b, DataBuffer data); | ||
public double getSampleDouble (int x, int y, int b, DataBuffer data); | ||
public float getSampleFloat (int x, int y, int b, DataBuffer data); | ||
public int[ ] getSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
public float[ ] getSamples (int x, int y, int w, int h, int b, float[ ] fArray, DataBuffer data); | ||
public double[ ] getSamples (int x, int y, int w, int h, int b, double[ ] dArray, DataBuffer data); | ||
public abstract void setDataElements (int x, int y, Object obj, DataBuffer data); | ||
public void setDataElements (int x, int y, int w, int h, Object obj, DataBuffer data); | ||
public void setPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public void setPixel (int x, int y, float[ ] fArray, DataBuffer data); | ||
public void setPixel (int x, int y, double[ ] dArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, float[ ] fArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, double[ ] dArray, DataBuffer data); | ||
public abstract void setSample (int x, int y, int b, int s, DataBuffer data); | ||
public void setSample (int x, int y, int b, float s, DataBuffer data); | ||
public void setSample (int x, int y, int b, double s, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, float[ ] fArray, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, double[ ] dArray, DataBuffer data); | ||
// | Protected Instance Fields | |
protected int dataType ; | ||
protected int height ; | ||
protected int numBands ; | ||
protected int width ; | ||
} |
Subclasses: ComponentSampleModel, MultiPixelPackedSampleModel, SinglePixelPackedSampleModel
Passed To: ColorModel.isCompatibleSampleModel(), ComponentColorModel.isCompatibleSampleModel(), IndexColorModel.isCompatibleSampleModel(), PackedColorModel.isCompatibleSampleModel(), Raster.{createRaster(), createWritableRaster(), Raster()}, WritableRaster.WritableRaster()
Returned By: Too many methods to list.
Type Of: Raster.sampleModel
ShortLookupTable | Java 1.2 | |
|
||
java.awt.image |
This concrete subclass of LookupTable contains one or more short arrays that serve as lookup tables for a LookupOp image-processing operation. Applications never need to use a ShortLookupTable directly; they need to create one only to pass to the LookupOp() constructor. Create a ShortLookupTable by passing the short array or arrays to the ShortLookupTable() constructor, along with an offset that is subtracted from each source color component before the lookup is performed. See also ByteLookupTable().
public class ShortLookupTable extends LookupTable { | ||
// | Public Constructors | |
public ShortLookupTable (int offset, short[ ][ ] data); | ||
public ShortLookupTable (int offset, short[ ] data); | ||
// | Public Instance Methods | |
public final short[ ][ ] getTable (); | ||
public short[ ] lookupPixel (short[ ] src, short[ ] dst); | ||
// | Public Methods Overriding LookupTable | |
public int[ ] lookupPixel (int[ ] src, int[ ] dst); | ||
} |
Hierarchy: Object-->LookupTable-->ShortLookupTable
SinglePixelPackedSampleModel | Java 1.2 | |
|
||
java.awt.image |
This SampleModel knows how to interpret image data in a DataBuffer that is organized so that each pixel is stored in a single data element and each data element contains exactly one pixel. For example, it can be used to represent RGB and ARGB data packed into a int element or 8-bit grayscale data stored in byte elements. The bitMasks array passed to the constructor specifies the bitmask used to extract each color component from the data element. For example, to extract the red color component of an RGB color from an int, you specify a bitmask of 0x00FF0000. Most applications never need to use this class. See SampleModel for further information.
public class SinglePixelPackedSampleModel extends SampleModel { | ||
// | Public Constructors | |
public SinglePixelPackedSampleModel (int dataType, int w, int h, int[ ] bitMasks); | ||
public SinglePixelPackedSampleModel (int dataType, int w, int h, int scanlineStride, int[ ] bitMasks); | ||
// | Public Instance Methods | |
public int[ ] getBitMasks (); | ||
public int[ ] getBitOffsets (); | ||
public int getOffset (int x, int y); | ||
public int getScanlineStride (); | ||
// | Public Methods Overriding SampleModel | |
public SampleModel createCompatibleSampleModel (int w, int h); | ||
public int getNumDataElements (); | constant | |
public DataBuffer createDataBuffer (); | ||
public SampleModel createSubsetSampleModel (int[ ] bands); | ||
public Object getDataElements (int x, int y, Object obj, DataBuffer data); | ||
public int[ ] getPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public int[ ] getPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public int getSample (int x, int y, int b, DataBuffer data); | ||
public int[ ] getSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
public int[ ] getSampleSize (); | ||
public int getSampleSize (int band); | ||
public void setDataElements (int x, int y, Object obj, DataBuffer data); | ||
public void setPixel (int x, int y, int[ ] iArray, DataBuffer data); | ||
public void setPixels (int x, int y, int w, int h, int[ ] iArray, DataBuffer data); | ||
public void setSample (int x, int y, int b, int s, DataBuffer data); | ||
public void setSamples (int x, int y, int w, int h, int b, int[ ] iArray, DataBuffer data); | ||
} |
Hierarchy: Object-->SampleModel-->SinglePixelPackedSampleModel
TileObserver | Java 1.2 | |
|
||
java.awt.image |
This interface is implemented by objects that wish to be notified when a WritableRenderedImage is about to be written to. It is used as part of the Java Advanced Imaging API (javax.jai.*) and is not of interest to Java 2D programs. In particular, note that while BufferedImage objects allow TileObserver objects to be registered, they never send out notifications to them. Only programs using the JAI will ever implement this interface. It is used in the java.awt.image package simply for future compatibility with the JAI.
public abstract interface TileObserver { | ||
// | Public Instance Methods | |
public abstract void tileUpdate (WritableRenderedImage source, int tileX, int tileY, boolean willBeWritable); | ||
} |
Passed To: BufferedImage.{addTileObserver(), removeTileObserver()}, WritableRenderedImage.{addTileObserver(), removeTileObserver()}
WritableRaster | Java 1.2 | |
|
||
java.awt.image |
This class extends Raster to add methods for setting pixel values in the Raster. It does not have any public constructors. You create WritableRaster objects with the static methods defined by the Raster class. WritableRaster is used by BufferedImage, and, in practice, most rasters used in a program are WritableRaster objects. Most applications can use the features of BufferedImage and never need to use WritableRaster or Raster directly. See Raster for more information.
public class WritableRaster extends Raster { | ||
// | Protected Constructors | |
protected WritableRaster (SampleModel sampleModel, Point origin); | ||
protected WritableRaster (SampleModel sampleModel, DataBuffer dataBuffer, Point origin); | ||
protected WritableRaster (SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, WritableRaster parent); | ||
// | Public Instance Methods | |
public WritableRaster createWritableChild (int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[ ] bandList); | ||
public WritableRaster createWritableTranslatedChild (int childMinX, int childMinY); | ||
public WritableRaster getWritableParent (); | ||
public void setDataElements (int x, int y, Raster inRaster); | ||
public void setDataElements (int x, int y, Object inData); | ||
public void setDataElements (int x, int y, int w, int h, Object inData); | ||
public void setPixel (int x, int y, float[ ] fArray); | ||
public void setPixel (int x, int y, int[ ] iArray); | ||
public void setPixel (int x, int y, double[ ] dArray); | ||
public void setPixels (int x, int y, int w, int h, double[ ] dArray); | ||
public void setPixels (int x, int y, int w, int h, float[ ] fArray); | ||
public void setPixels (int x, int y, int w, int h, int[ ] iArray); | ||
public void setRect (Raster srcRaster); | ||
public void setRect (int dx, int dy, Raster srcRaster); | ||
public void setSample (int x, int y, int b, double s); | ||
public void setSample (int x, int y, int b, float s); | ||
public void setSample (int x, int y, int b, int s); | ||
public void setSamples (int x, int y, int w, int h, int b, double[ ] dArray); | ||
public void setSamples (int x, int y, int w, int h, int b, float[ ] fArray); | ||
public void setSamples (int x, int y, int w, int h, int b, int[ ] iArray); | ||
} |
Hierarchy: Object-->Raster-->WritableRaster
Passed To: Too many methods to list.
Returned By: Too many methods to list.
WritableRenderedImage | Java 1.2 | |
|
||
java.awt.image |
This interface defines methods that allow image data to be written into a RenderedImage in a way that allows for notification of updates. Most of the methods of this interface exist for use with the forthcoming Java Advanced Imaging (JAI) API (javax.jai.*) and are not of interest to programs using Java 2D. Nevertheless, BufferedImage implements this interface, so that Java 2D BufferedImage objects can interoperate with future JAI RenderedImage objects. BufferedImage objects contain only a single tile and provide trivial implementations of all the tile-related methods. setData() is the only method of interest to Java 2D programs.
public abstract interface WritableRenderedImage extends RenderedImage { | ||
// | Public Instance Methods | |
public abstract void addTileObserver (TileObserver to); | ||
public abstract WritableRaster getWritableTile (int tileX, int tileY); | ||
public abstract Point[ ] getWritableTileIndices (); | ||
public abstract boolean hasTileWriters (); | ||
public abstract boolean isTileWritable (int tileX, int tileY); | ||
public abstract void releaseWritableTile (int tileX, int tileY); | ||
public abstract void removeTileObserver (TileObserver to); | ||
public abstract void setData (Raster r); | ||
} |
Hierarchy: (WritableRenderedImage(RenderedImage))
Implementations: BufferedImage
Passed To: TileObserver.tileUpdate()
Copyright © 2001 O'Reilly & Associates. All rights reserved.
This HTML Help has been published using the chm2web software. |