00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _FL_IMAGEFILTER_H_
00023 #define _FL_IMAGEFILTER_H_
00024 
00025 #include "Enumerations.h"
00026 #include "Fl_Renderer.h"
00027 #include "Fl_Util.h"
00028 
00029 class Fl_Image;
00030 
00039 
00040 
00041 
00042 
00043 
00044 
00048 class Fl_Image_Filter
00049 {
00050 public:
00051     static bool apply_to_this(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter);
00052     static bool apply_to_this(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1);
00053     static bool apply_to_this(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1, float val2);
00054     static bool apply_to_this(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1, float val2, float val3);
00055 
00056     static Fl_Image *apply_to_new(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter);
00057     static Fl_Image *apply_to_new(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1);
00058     static Fl_Image *apply_to_new(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1, float val2);
00059     static Fl_Image *apply_to_new(Fl_Image *image, Fl_Rect *rect, Fl_Image_Filter *filter, float val1, float val2, float val3);
00060 
00061 protected:
00062     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3) { return false; }
00063 };
00064 
00065 class FilterBrightness : public Fl_Image_Filter
00066 {
00067 public:
00068     
00069     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00070 };
00071 
00072 class FilterContrast : public Fl_Image_Filter
00073 {
00074 public:
00075     
00076     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00077 };
00078 
00079 class FilterGamma : public Fl_Image_Filter
00080 {
00081 public:
00082     
00083     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00084 };
00085 
00086 class FilterGrayscale : public Fl_Image_Filter
00087 {
00088 public:
00089     
00090     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00091 };
00092 
00093 class FilterForeBlend : public Fl_Image_Filter
00094 {
00095 public:
00096     
00097     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00098 };
00099 
00100 class FilterBackBlend : public Fl_Image_Filter
00101 {
00102 public:
00103     
00104     virtual bool execute(uint8 **data, Fl_Rect &rect, int pitch, Fl_PixelFormat *fmt, float val1, float val2, float val3);
00105 };
00106 
00107 extern FL_API FilterBrightness filter_brightness;
00108 #define FILTER_BRIGHTNESS (&filter_brightness)
00109 
00110 extern FL_API FilterContrast filter_contrast;
00111 #define FILTER_CONTRAST (&filter_contrast)
00112 
00113 extern FL_API FilterGamma filter_gamma;
00114 #define FILTER_GAMMA (&filter_gamma)
00115 
00116 extern FL_API FilterGrayscale filter_grayscale;
00117 #define FILTER_GRAYSCALE (&filter_grayscale)
00118 
00119 extern FL_API FilterForeBlend filter_foreblend;
00120 #define FILTER_FOREBLEND (&filter_foreblend)
00121 
00122 extern FL_API FilterBackBlend filter_backblend;
00123 #define FILTER_BACKBLEND (&filter_backblend)
00124 
00125 #endif