00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00031 #ifndef Fl_Shared_Image_H
00032 # define Fl_Shared_Image_H
00033
00034 # include "Fl_Image.H"
00035
00036
00037
00038 typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header,
00039 int headerlen);
00040
00041
00049 class FL_EXPORT Fl_Shared_Image : public Fl_Image {
00050 protected:
00051
00052 static Fl_Shared_Image **images_;
00053 static int num_images_;
00054 static int alloc_images_;
00055 static Fl_Shared_Handler *handlers_;
00056 static int num_handlers_;
00057 static int alloc_handlers_;
00058
00059 const char *name_;
00060 int original_;
00061 int refcount_;
00062 Fl_Image *image_;
00063 int alloc_image_;
00064
00065 static int compare(Fl_Shared_Image **i0, Fl_Shared_Image **i1);
00066
00067
00068 Fl_Shared_Image();
00069 Fl_Shared_Image(const char *n, Fl_Image *img = 0);
00070 virtual ~Fl_Shared_Image();
00071 void add();
00072 void update();
00073
00074 public:
00076 const char *name() { return name_; }
00078 int refcount() { return refcount_; }
00079 void release();
00080 void reload();
00081
00082 virtual Fl_Image *copy(int W, int H);
00083 Fl_Image *copy() { return copy(w(), h()); }
00084 virtual void color_average(Fl_Color c, float i);
00085 virtual void desaturate();
00086 virtual void draw(int X, int Y, int W, int H, int cx, int cy);
00087 void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
00088 virtual void uncache();
00089
00090 static Fl_Shared_Image *find(const char *n, int W = 0, int H = 0);
00091 static Fl_Shared_Image *get(const char *n, int W = 0, int H = 0);
00092 static Fl_Shared_Image **images();
00093 static int num_images();
00094 static void add_handler(Fl_Shared_Handler f);
00095 static void remove_handler(Fl_Shared_Handler f);
00096 };
00097
00098
00099
00100
00101
00102
00103
00104 FL_EXPORT extern void fl_register_images();
00105
00106 #endif // !Fl_Shared_Image_H
00107
00108
00109
00110