Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fltk/fltk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of color information. Images with an even number of channels are assumed to contain alpha information, which is used to blend the image with the contents of the screen. Header:<FL/Fl_RGB_Image.H> or <FL/Fl_Image.H>
Base Class: Fl_Image
Constructors
Creates an RGB image from raw pixel data.
Pointer to the image data array containing R, G, B [, A] values
Image width in pixels
Image height in pixels
Image depth (number of bytes per pixel):
- 1 = Grayscale
- 2 = Grayscale + Alpha
- 3 = RGB
- 4 = RGBA
Line data size in bytes. If 0, assumed to be
W * D. If non-zero, must be >= W * D to account for padding.Public Members
Points to the start of the object’s data array containing pixel values.
For Fl_SVG_Image subclass, this member variable initialization may be delayed.
If non-zero, the object’s data array is delete[]‘d when deleting the object. Set to 0 if the data is managed externally.
Image Operations
Converts the RGB image to grayscale.
Drawing Methods
Cache Management
Releases cached platform-specific image data, freeing memory while keeping the image object.
Returns the width of the cached image data.
Returns the height of the cached image data.
Size Limits
Sets the maximum allowed image size in bytes when creating an Fl_RGB_Image object.The default max_size() value is essentially infinite. This does not apply to direct RGB image creation via the constructor.
Maximum size in bytes (calculated as
w() * h() * d())Returns the maximum allowed image size in bytes.
Type Detection
Returns a pointer to Fl_SVG_Image if this object is an instance of Fl_SVG_Image, or NULL otherwise.
Makes sure the object is fully initialized. In particular, ensures the
array member variable is non-null.Widget Integration
Sets this image as the label for a widget.
Sets this image as the label for a menu item.
Example Usage
Creating RGB Image from Raw Data
Creating RGBA Image with Alpha Channel
Converting Pixmap to RGB Image
Image Manipulation
Memory Layout
Thearray data is organized as follows:
For D=3 (RGB):
LD bytes instead of W * D bytes, with extra padding:
See Also
- Fl_Image - Base image class
- Fl_Pixmap - XPM pixmap images
- Drawing Functions - Drawing API