ddn.lib.fltk.images

FLTK Images Library Bindings

This package provides low-level D bindings for the FLTK images library (libfltk_images), which adds support for loading various image formats.

Supported image formats:

  • BMP (Windows Bitmap)
  • GIF (Graphics Interchange Format)
  • JPEG (Joint Photographic Experts Group)
  • PNG (Portable Network Graphics)
  • PNM/PPM/PGM (Portable Anymap)
  • XBM (X BitMap)
  • XPM (X PixMap)

Memory Management:

  • Images created with *_new() functions must be destroyed with fltk_image_delete()
  • Shared images use reference counting via Fl_Shared_Image

Example:

import ddn.lib.fltk.images;

void main() {
   // Load a PNG image
   auto img = fltk_png_image_new("photo.png");
   if (img !is null) {
      auto w = fltk_image_w(fltk_png_image_as_image(img));
      auto h = fltk_image_h(fltk_png_image_as_image(img));
      writefln("Image size: %dx%d", w, h);
      fltk_png_image_delete(img);
   }
}

Authors

Dejan Lekić

License

BSD-3-Clause

Types 19

Opaque handle for Fl_Shared_Image.

This type is not part of the core ddn.lib.fltk.shim module because it is only needed when using the fltk:images subpackage.

Fields
private void * ptr

Alias for shared image handle

Opaque handle for Fl_BMP_Image.

Fields
private void * ptr

Alias for BMP image handle

Opaque handle for Fl_GIF_Image.

Fields
private void * ptr

Alias for GIF image handle

Opaque handle for Fl_JPEG_Image.

Fields
private void * ptr

Alias for JPEG image handle

Opaque handle for Fl_PNG_Image.

Fields
private void * ptr

Alias for PNG image handle

Opaque handle for Fl_PNM_Image.

Fields
private void * ptr

Alias for PNM image handle

Opaque handle for Fl_XBM_Image.

Fields
private void * ptr

Alias for XBM image handle

Opaque handle for Fl_XPM_Image.

Fields
private void * ptr

Alias for XPM image handle

Opaque handle for Fl_Tiled_Image.

Fields
private void * ptr

Alias for tiled image handle

Image loading error codes.

These values indicate the result of image loading operations.

OK = 0Image loaded successfully
FILE_NOT_FOUND = 1File not found or cannot be opened
INVALID_DATA = 2Invalid or corrupt image data
UNSUPPORTED_FORMAT = 3Unsupported image format
OUT_OF_MEMORY = 4Memory allocation failed

Functions 32

fnbool isValid(FltkImage image) @safe nothrow @nogcChecks if an image handle is valid (non-null).
fnbool isValid(FltkPngImage image) @safe nothrow @nogcChecks if a PNG image handle is valid (non-null).
fnbool isValid(FltkJpegImage image) @safe nothrow @nogcChecks if a JPEG image handle is valid (non-null).
fnbool isValid(FltkBmpImage image) @safe nothrow @nogcChecks if a BMP image handle is valid (non-null).
fnbool isValid(FltkGifImage image) @safe nothrow @nogcChecks if a GIF image handle is valid (non-null).
fnbool isValid(FltkSharedImage image) @safe nothrow @nogcChecks if a shared image handle is valid (non-null).
fnFltkPngImage fltk_png_image_new(const(char) * filename)Creates a new PNG image from a file.
fnFltkPngImage fltk_png_image_new_data(const(ubyte) * data, int len)Creates a new PNG image from memory data.
fnvoid fltk_png_image_delete(FltkPngImage image)Deletes a PNG image.
fnFltkImage fltk_png_image_as_image(FltkPngImage image)Casts a PNG image to base image.
fnint fltk_png_image_fail(FltkPngImage image)Gets the error status of a PNG image load.
fnFltkJpegImage fltk_jpeg_image_new(const(char) * filename)Creates a new JPEG image from a file.
fnFltkJpegImage fltk_jpeg_image_new_data(const(ubyte) * data, int len)Creates a new JPEG image from memory data.
fnvoid fltk_jpeg_image_delete(FltkJpegImage image)Deletes a JPEG image.
fnFltkImage fltk_jpeg_image_as_image(FltkJpegImage image)Casts a JPEG image to base image.
fnint fltk_jpeg_image_fail(FltkJpegImage image)Gets the error status of a JPEG image load.
fnFltkBmpImage fltk_bmp_image_new(const(char) * filename)Creates a new BMP image from a file.
fnvoid fltk_bmp_image_delete(FltkBmpImage image)Deletes a BMP image.
fnFltkImage fltk_bmp_image_as_image(FltkBmpImage image)Casts a BMP image to base image.
fnint fltk_bmp_image_fail(FltkBmpImage image)Gets the error status of a BMP image load.
fnFltkPnmImage fltk_pnm_image_new(const(char) * filename)Creates a new PNM image from a file.
fnvoid fltk_pnm_image_delete(FltkPnmImage image)Deletes a PNM image.
fnFltkImage fltk_pnm_image_as_image(FltkPnmImage image)Casts a PNM image to base image.
fnint fltk_pnm_image_fail(FltkPnmImage image)Gets the error status of a PNM image load.
fnFltkGifImage fltk_gif_image_new(const(char) * filename)Creates a new GIF image from a file.
fnvoid fltk_gif_image_delete(FltkGifImage image)Deletes a GIF image.
fnFltkImage fltk_gif_image_as_image(FltkGifImage image)Casts a GIF image to base image.
fnint fltk_gif_image_fail(FltkGifImage image)Gets the error status of a GIF image load.
fnFltkSharedImage fltk_shared_image_get(const(char) * filename)Sets the widget's callback function. Gets a shared image from file (loads if not cached).
fnFltkSharedImage fltk_shared_image_find(const(char) * filename)Finds a shared image in the cache.
fnvoid fltk_shared_image_release(FltkSharedImage image)Releases a reference to a shared image.
fnFltkImage fltk_shared_image_as_image(FltkSharedImage image)Casts a shared image to base image.