The OMRaster object lets you create multi-colored images. An image is a two dimensional array of pixel values that correspond to some color values. The pixels are used from the top left, across each row to the right, down to the bottom row.
There are two colormodels that are implemented in OMRaster - the direct colormodel and the indexed colormodel. The direct colormodel is implemented when the pixel values contain the actual java.awt.Color values for the image. The indexed colormodel is implemented when the pixel values are actually indexes into an array of java.awt.Colors. NOTE: The direct colormodel OMRaster is faster to display, because it doesn't need to take the time to resolve the colortable values into pixels.
For direct colormodel images: If you pass in a null pix or a pix with a zero length, the object will create the pixels for you but will not general a renderable version of the object. You will need to call render before generate after the pixels have been set. This feature is for cached rasters, where the content may be changed later. Use this (null pix) if you are building images in a cache, for tiled mapping data or something else where the data is not yet known. The memory for the pixels will be allocated, and then they can be set with image data later when a database is accessed.
For ImageIcon OMRasters: Using an ImageIcon to create an OMRaster gives you the ability to put an image on the screen based on an ImageIcon made from file or URL. The OMRaster uses this ImageIcon as is - there is no opportunity to change any parameters of this image. So set the colors, transparency, etc. before you create the OMRaster.
For indexed colormodel images: If you pass in an empty byte array, a byte array will be created based on the width and height. You will have to resolve empty colortables and set the pixels later. Use this method (null bytes) if you are building images in a cache, for tiled mapping data or something else where the data is not yet known. The memory for the pixels will be allocated, and then they can be set with image data later when a database is accessed. There is the ability to add a filter to the image, to change it's appearance for rendering. The most common filter, which is included as a kind of default, is the scale filter. Filtering the OMRasterObject replaces the bitmap variable, which is the internal java.awt.Image used for rendering. For OMRasters created with pixels, or with the colortable and the colortable index, the original data is left intact, and can be recreated later, or rescaled on the fly, because the internal bitmap will be recreated prior to rescaling. For OMRasters created by ImageIcons or Images, though, you'll need to hold on to the original Image. The internal version is replaced by the filtered version.
@see OMRasterObject