Raster object represents raster graphics image (bitmap).

It is implemented as record specifying raste dimensions, color depth, color format etc. and table of data representing raster lines. Different implementations of raster exist supporting different raster formats (BMP, PNG, JPG). It is possible to implement other types too.

Providers should represent bitmaps in their native encoding. All transformations (ie. HSV to RGB) should be handled by special filters.

Raster structure

Raster: width: 1..2147483647 px height: 1..2147483647 px format: RGB|RGBA|HSV|YCbCr|Grayscale|GrayscaleA|Pallete depth: 1..32 bits -- number of bits per pixel palette: table of RGB -- if the picture has Pallete format, this represents the pallete lines: table[1..height] of Data source_format: Id -- Void, JPEG, PNG, BMP source_data: Data -- source data for JPEG, PNG, BMP


Lines field represents the actual raster as table of lines. Item with index 1 represents the first (top) line of the raster. One line is represented as data object containing bytes in specified format.

Source data

Some raster consumers can support some raster formats in a special way (for example PDF can include JPEG rasters directly, Windows implementation draws BMF files faster using source data). It can detect, if the raster has the proper source format using source_format property. If it is supported format, it can use source_data to access original source (where applicable).

If a raster returns other source_format than VOID, it MUST return non-null source_data object.


One of the following formats an be specified:

If there is an alpha channel present, APLHA_FLAG is specified. Alpha flag may be combined with any of the formats.