5.1 Rasters

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

[1kb 153x49 GIF]

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 different formats.

5.1.1 Raster

The Raster class generalizes the raster concept defining the following attributes

In BETA code it could look like:

   MagicNumber: @Integer;
   Width,Height: @Integer;
   Pixel:< Object;
   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.

5.1.2 BitMap

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.

5.1.3 PixMap

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]