Base class for image caching and drawing.
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK. This class keeps track of common image data such as the pixels, colormap, width, height, and depth. Virtual methods are used to provide type-specific image handling.
Since the Fl_Image class does not support image drawing by itself, calling the draw() method results in a box with an X in it being drawn instead.
Fl_Image::Fl_Image |
( |
int |
W, |
|
|
int |
H, |
|
|
int |
D |
|
) |
| |
The constructor creates an empty image with the specified width, height, and depth.
The width and height are in pixels. The depth is 0 for bitmaps, 1 for pixmap (colormap) images, and 1 to 4 for color images.
void Fl_Image::color_average |
( |
Fl_Color |
c, |
|
|
float |
i |
|
) |
| |
|
virtual |
The color_average() method averages the colors in the image with the FLTK color value c.
The i argument specifies the amount of the original image to combine with the color, so a value of 1.0 results in no color blend, and a value of 0.0 results in a constant image of the specified color.
An internal copy is made of the original image before changes are applied, to avoid modifying the original image.
Reimplemented in Fl_RGB_Image, Fl_Pixmap, Fl_Shared_Image, and Fl_Tiled_Image.
void Fl_Image::desaturate |
( |
| ) |
|
|
virtual |
The desaturate() method converts an image to grayscale.
If the image contains an alpha channel (depth = 4), the alpha channel is preserved.
An internal copy is made of the original image before changes are applied, to avoid modifying the original image.
Reimplemented in Fl_RGB_Image, Fl_Pixmap, Fl_Shared_Image, and Fl_Tiled_Image.
void Fl_Image::draw |
( |
int |
X, |
|
|
int |
Y, |
|
|
int |
W, |
|
|
int |
H, |
|
|
int |
cx = 0 , |
|
|
int |
cy = 0 |
|
) |
| |
|
virtual |
Draws the image with a bounding box.
Arguments X,Y,W,H
specify a bounding box for the image, with the origin
(upper-left corner) of the image offset by the cx
and cy
arguments.
In other words: fl_push_clip(X,Y,W,H)
is applied, the image is drawn with its upper-left corner at X-cx,Y-cy
and its own width and height, fl_pop_clip
()
is applied.
Reimplemented in Fl_Shared_Image, Fl_Tiled_Image, Fl_Bitmap, Fl_RGB_Image, and Fl_Pixmap.
void Fl_Image::ld |
( |
int |
LD | ) |
|
|
inlineprotected |
Sets the current line data size in bytes.
Color images may contain extra data that is included after every line of color image data and is normally not present.
If LD
is zero, then line data size is assumed to be w() * d() bytes.
If LD
is non-zero, then it must be positive and larger than w() * d() to account for the extra data per line.