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);
}

Authors

Dejan Lekić

License

BSD-3-Clause

Types 1

Supported image formats for auto-detection.

UNKNOWNUnknown or unsupported format
PNGPNG format
JPEGJPEG format
BMPBMP format
GIFGIF format

Functions 4

fnImageFormat detectFormat(string filename)Detects image format from filename extension.
fnImage loadImage(string filename)Loads an image from file, auto-detecting the format.
fnImage loadImageFromMemory(const(ubyte)[] data, ImageFormat format)Loads an image from memory data with explicit format.
fnRgbImage createImage(const(ubyte)[] data, int width, int height, int depth = 3)Creates an RGB image from raw pixel data.