2D Graphics

The System.Graphics unit provides the TPixmap class, a lightweight 2D pixel buffer for procedural generation and image manipulation.

Creating a Pixmap

A Pixmap is an array of ARGB (Alpha, Red, Green, Blue) values. You can create one with a specific width and height.

var bmp := CreatePixmap(100, 100);

// Draw a pixel
bmp.SetPixel(10, 10, $FFFF0000); // Red pixel at 10,10

Colors

Colors are represented as 32-bit integers in $AARRGGBB format.

var red := $FFFF0000;
var transparentGreen := $8000FF00;

Exporting Data

You can retrieve the raw buffer data as a hex string for transfer to a browser or saving to a file.

var bmp := CreatePixmap(10, 10);
var data := bmp.ToHexString;
PrintLn('Hex data length: ' + IntToStr(data.Length));
Result
Hex data length: 800

Related Reference

For details on coordinate systems and performance-optimized data access, see the reference documentation:

On this page