fltk.images
FLTK High-Level Images API
This package provides idiomatic D wrappers for FLTK image handling. It offers RAII-based image classes with automatic resource management, support for various image formats, and convenient loading helpers.
Supported image formats:
- PNG (Portable Network Graphics) - lossless, supports transparency
- JPEG (Joint Photographic Experts Group) - lossy, ideal for photos
- BMP (Windows Bitmap) - uncompressed
- GIF (Graphics Interchange Format) - supports animation (first frame only)
- Bitmap (XBM) - monochrome 1-bit images for icons and cursors
Example:
import fltk.images;
void main() {
// Load an image (auto-detects format)
auto img = loadImage("photo.png");
if (img !is null) {
writefln("Loaded %dx%d image", img.width, img.height);
}
// Or use specific loaders
auto png = new PngImage("icon.png");
auto jpeg = new JpegImage("photo.jpg");
// Create image from raw pixel data
ubyte[] pixels = ...;
auto rgb = new RgbImage(pixels, 100, 100, 3);
}
License
BSD-3-Clause
Copyright
Copyright © 2025 DDN (D Developer Network) Members
Types 1
enumImageFormat
Supported image formats for auto-detection.
UNKNOWNUnknown or unsupported format
PNGPNG format
JPEGJPEG format
BMPBMP format
GIFGIF format
Functions 4
fn
Image loadImageFromMemory(const(ubyte)[] data, ImageFormat format)Loads an image from memory data with explicit format.fn
RgbImage createImage(const(ubyte)[] data, int width, int height, int depth = 3)Creates an RGB image from raw pixel data.