20#ifndef Fl_Shared_Image_H
21# define Fl_Shared_Image_H
71typedef Fl_Image *(*Fl_Shared_Handler)(
const char *name,
96 friend class Fl_JPEG_Image;
97 friend class Fl_PNG_Image;
98 friend class Fl_SVG_Image;
99 friend class Fl_Graphics_Driver;
104 static int num_images_;
105 static int alloc_images_;
107 static int num_handlers_;
108 static int alloc_handlers_;
128 static void print_pool();
132 const char *
name() {
return name_; }
149 virtual
void reload();
161 void draw(
int X,
int Y,
int W,
int H,
int cx = 0,
int cy = 0)
FL_OVERRIDE;
162 void draw(
int X,
int Y) {
draw(X, Y,
w(),
h(), 0, 0); }
165 static Fl_Shared_Image *find(const
char *name,
int W = 0,
int H = 0);
166 static Fl_Shared_Image *get(const
char *name,
int W = 0,
int H = 0);
167 static Fl_Shared_Image *get(Fl_RGB_Image *rgb,
int own_it = 1);
168 static Fl_Shared_Image **images();
169 static
int num_images();
194 const Fl_Image *
image()
const {
return image_; }
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Image, Fl_RGB_Image classes.
void fl_register_images()
Register the known image formats.
Definition fl_images_core.cxx:61
Fl_Image *(* Fl_Shared_Handler)(const char *name, uchar *header, int headerlen)
Test function (typedef) for adding new shared image formats.
Definition Fl_Shared_Image.H:71
Base class for image caching, scaling and drawing.
Definition Fl_Image.H:60
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image to the current drawing surface with a bounding box.
Definition Fl_Image.cxx:62
virtual void desaturate()
The desaturate() method converts an image to grayscale.
Definition Fl_Image.cxx:144
virtual void color_average(Fl_Color c, float i)
The color_average() method averages the colors in the image with the provided FLTK color value.
Definition Fl_Image.cxx:132
int w() const
Returns the current image drawing width in FLTK units.
Definition Fl_Image.H:131
Fl_Image * copy() const
Creates a copy of the image in the same size.
Definition Fl_Image.H:266
virtual void release()
Releases an Fl_Image - the same as 'delete this'.
Definition Fl_Image.H:220
int h() const
Returns the current image drawing height in FLTK units.
Definition Fl_Image.H:137
virtual void uncache()
If the image has been cached for display, delete the cache data.
Definition Fl_Image.cxx:59
void add()
Adds a shared image to the image pool.
Definition Fl_Shared_Image.cxx:159
void update()
Update the dimensions of the shared images.
Definition Fl_Shared_Image.cxx:191
static int compare(Fl_Shared_Image **i0, Fl_Shared_Image **i1)
Compares two shared images.
Definition Fl_Shared_Image.cxx:95
const char * name()
Returns the filename of the shared image.
Definition Fl_Shared_Image.H:132
Fl_Shared_Image * copy_(int W, int H) const
Create a resized copy of the image and wrap it into the share image class.
Definition Fl_Shared_Image.cxx:335
Fl_Shared_Image()
Creates an empty shared image.
Definition Fl_Shared_Image.cxx:114
int original()
Returns whether this is an original image.
Definition Fl_Shared_Image.H:146
Fl_Shared_Image * as_shared_image() FL_OVERRIDE
Returns whether an image is an Fl_Shared_Image or not.
Definition Fl_Shared_Image.H:151
const Fl_Image * image() const
Returns a pointer to the internal Fl_Image object.
Definition Fl_Shared_Image.H:194
int refcount()
Returns the number of references of this shared image.
Definition Fl_Shared_Image.H:137
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
unsigned char uchar
unsigned char
Definition fl_types.h:30