A class describing the desired layout of an
OpImage.
The ImageLayout class encapsulates three types of information about an image:
- The image bounds, comprising the min X and Y coordinates, image width, and image height;
- The tile grid layout, comprising the tile grid X and Y offsets, the tile width, and the tile height; and
- The
SampleModel and ColorModel of the image.
Each of these parameters may be set individually, or left unset. An unset parameter will cause the corresponding value of a given RenderedImage to be used. For example, the code:
ImageLayout layout; RenderedImage im; int width = layout.getTileWidth(im);
will return the tile width of the
ImageLayout if it is set, or the tile width of the image
im if it is not.
ImageLayout objects are primarily intended to be passed as part of the renderingHints argument of the create() method of RenderedImageFactory. The create() method may remove parameter settings that it cannot deal with, prior to passing the ImageLayout to any OpImage constructors. New OpImage subclasses are not required to accept an ImageLayout parameter, but most will at least need to synthesize one to be passed up the constructor chain.
Methods that modify the state of an ImageLayout return a reference to 'this' following the change. This allows multiple modifications to be made in a single expression. This provides a way of modifying an ImageLayout within a superclass constructor call.