fltk.images.bitmap
FLTK Bitmap Image Class
This module provides the Bitmap class that wraps FLTK's Fl_Bitmap. Bitmaps are monochrome (1-bit) images, typically used for icons, cursors, and simple graphics.
The Bitmap class provides:
- RAII-based resource management
- Construction from XBM format data
- Property-based access to dimensions
XBM Format: XBM (X BitMap) is a monochrome image format where each bit represents one pixel. A bit value of 1 typically means the foreground color, and 0 means transparent/background. The data is stored with the least significant bit first within each byte.
License
BSD-3-Clause
Copyright
Copyright © 2025 DDN (D Developer Network) Members
class Bitmap
Types 1
Monochrome (1-bit) bitmap image.
Bitmap images are useful for simple graphics like icons, cursors, and masks. They use minimal memory (1 bit per pixel) and can be drawn with any foreground color.
Note
The bitmap data passed to the constructor must remain valid
for the lifetime of the Bitmap object, as FLTK does not copy the data.
Example:
// XBM data for a simple 8x8 pattern
static immutable ubyte[] pattern = [
0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55
];
auto bm = new Bitmap(pattern, 8, 8);
if (bm.isValid) {
writefln("Created %dx%d bitmap", bm.width, bm.height);
}Fields
FltkBitmap _bitmapHandleconst(ubyte)[] _dataRefStore reference to data to prevent GC collectionMethods
Constructors
this(const(ubyte)[] bits, int w, int h)Creates a bitmap from XBM data.this(const(ubyte) * bits, int w, int h)Creates a bitmap from a raw pointer to XBM data.Destructors
~thisDestroys the bitmap and releases resources.