As described in the previous paragraphs
both tiled solid color and the raster paint concepts use some kind of
rasters describing either a tile, or a raster image in the raster
paint. Bifrost defines a class BitMap for using with tiling and a
class PixMap to be used in the RasterPaint.
In the Figure below, the hierarchy is illustrated.
Figure 12: The Raster Hierarchy
The implementation of bit and pixel maps are inspired by 'portable
bitmap file format (PBM)' and 'portable pixmap file format (PPM)' [Poskanzer] available on many
Unix and MS/DOS installations. Since the format of the Bifrost rasters
are very close to this 'standard', Bifrost can read and write PBM and
PPM files, and thereby get access to a huge set of rasters in a lot of
The Raster class generalizes the raster concept defining the following attributes
- MagicNumber for identifying the type of the raster.
- Hotspot is a point used when the raster is used in a fill operation: the raster in positioned so that hotspot coincides with the hotspot of the shape being filled.
- Width and Height of the raster.
- Pixel is virtually declared as an Object, and must be further bound in specializations of Raster.
- Width * Height Values specifying the raster itself, starting at the top-left corner of the raster, proceeding in normal reading order.
In BETA code it could look like:
Values: [Width*Height] @Pixel;
Two operations are supported by all rasters:
- Takes an index (i,j) and a pixel value as argument and sets the pixel
value into the specified position of the Values.
- Takes an index (i,j) as argument and returns the pixel value in the
specified position of the Values.
Bifrost defines a bit map in the following way:
is bound to a Boolean where TRUE means 'set' and FALSE
means 'not set'.
Two operations are defined to read and write BitMaps:
Read a bit map from a PBM file into the BitMap.
Write the BitMap out on a PBM file.
Bifrost defines a pixel map in the following way:
The maximum color component value.
is bound to three decimal values between 0 and the specified
maximum value. The three values for each pixel represent red, green,
and blue, respectively. If it is desired to specify the pixel value
relative to some other color space, e.g. HSV (cf. SolidColor), the
easiest way is to instantiate a SolidColor (SolidColor), specify the
HSV values to this, and then get the RGB values from the SolidColor,
and use these in the Pixel.
|The Bifrost Graphics System - Reference Manual
||© 1991-2004 Mjølner Informatics
[Modified: Tuesday October 24th 2000 at 15:02]