• Reference Guide


bitmap(dx, dy)
bitmap(dx, dy, color)
bitmap(dx, dy, bits)
bitmap(dx, dy, bits, gray)
bitmap(dx, dy, bits, gray, color_index)
bitmap(dx, dy, bits, gray, color)
Creates an empty image (a value of the type Bitmap).
This function creates an initial empty image, which can be then used to draw. The typical way to use the bitmap function is to store the created image to a variable:
var Bitmap bmp = bitmap(100, 100)


Horizontal size of the image in pixels (the type Int).
Vertical size of the image in pixels (the type Int).
The number of bits per pixel. For color images, only the values 1, 2, 4, 8, 16, and 24 are permitted. For monochrome images, only the values 1, 2, 4, and 8 are permitted. If this parameter is not specified, 24 is assumed for color images and 8 for monochrome. Color images with 8 bits per pixel and less have a palette, which provides the actual color assignment.
If the parameter is TRUE, a monochromatic image is constructed (i.e. an image containing gray shades only). If omitted, FALSE (i.e. color image) is expected.
The color to fill initially the image (a value of the type Dword). For color images with a palette, it is interpreted as an index to the palette. For color images without a palette, the value is interpreted as an RGB color with the RGB components stored in the three low-order bytes of the value. For monochrome images, the value is an intensity within the range 0–255 (0 is full black, 255 is full white).
A value of the type Color, which is used to fill initially the image. For the images with less than 24 bits per pixel, the nearest available color is used. The values of the type Color can be created by the color function, or using the color definition type (Color_def.
If no initial color is specified, white is assumed.
If a negative dimension is specified, an error is returned.


An alternate method to create a bitmap is to read it from a file. For example:
var File f;
f <- open("image.jpg");
var Bitmap bmp = read_binary(f, Bitmap);
Analogically, an image can be stored to a file using the function write_binary.

See Also