fltk.images.loaders
FLTK Image Format Loaders
This module provides classes for loading images from various file formats:
- PngImage: PNG format (Portable Network Graphics)
- JpegImage: JPEG format (Joint Photographic Experts Group)
- BmpImage: BMP format (Windows Bitmap)
- GifImage: GIF format (Graphics Interchange Format)
License
BSD-3-ClauseCopyright
Copyright © 2025 DDN (D Developer Network) Members
Types 5
PNG image loaded from file or memory.
PNG supports lossless compression, transparency (alpha channel), and various color depths.
Example:
auto img = new PngImage("photo.png");
if (img.isValid) {
writefln("Loaded %dx%d PNG", img.width, img.height);
}Fields
FltkPngImage _pngHandleMethods
Constructors
this(string filename)Loads a PNG image from a file.this(const(ubyte)[] data)Loads a PNG image from memory data.Destructors
~thisDestroys the PNG image.JPEG image loaded from file or memory.
JPEG uses lossy compression and is ideal for photographs.
Note
JPEG does not support transparency.
Example:
auto img = new JpegImage("photo.jpg");
if (img.isValid) {
writefln("Loaded %dx%d JPEG", img.width, img.height);
}Fields
FltkJpegImage _jpegHandleMethods
Constructors
this(string filename)Loads a JPEG image from a file.this(const(ubyte)[] data)Loads a JPEG image from memory data.Destructors
~thisDestroys the JPEG image.BMP image loaded from file.
BMP is Windows Bitmap format, typically uncompressed.
Example:
auto img = new BmpImage("image.bmp");
if (img.isValid) {
writefln("Loaded %dx%d BMP", img.width, img.height);
}Fields
FltkBmpImage _bmpHandleMethods
Constructors
this(string filename)Loads a BMP image from a file.Destructors
~thisDestroys the BMP image.GIF image loaded from file.
GIF supports animation and transparency (1-bit alpha).
Note
Only the first frame of animated GIFs is loaded.
Example:
auto img = new GifImage("animation.gif");
if (img.isValid) {
writefln("Loaded %dx%d GIF", img.width, img.height);
}Fields
FltkGifImage _gifHandleMethods
Constructors
this(string filename)Loads a GIF image from a file.Destructors
~thisDestroys the GIF image.PNM image loaded from file.
PNM (Portable Any Map) is a family of simple image formats:
- PBM (Portable Bitmap) - 1-bit monochrome
- PGM (Portable Graymap) - grayscale
- PPM (Portable Pixmap) - color
Both ASCII and binary formats are supported.
Example:
auto img = new PnmImage("image.ppm");
if (img.isValid) {
writefln("Loaded %dx%d PNM", img.width, img.height);
}Fields
FltkPnmImage _pnmHandleMethods
Constructors
this(string filename)Loads a PNM image from a file.Destructors
~thisDestroys the PNM image.