00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef RU_ColorFunctions_h
00021 #define RU_ColorFunctions_h
00022
00023 #include "RU_API.h"
00024 #include "RU_PixelFunction.h"
00025
00026 typedef float (*RU_InterpFunction)(float);
00027
00028 class RU_API RU_ColorReplace : public RU_PixelFunction
00029 {
00030 public:
00031 RU_ColorReplace( float hmin, float hmax, float hspill,
00032 float smin, float smax, float sspill,
00033 float lmin, float lmax, float lspill,
00034 RU_InterpFunction interp,
00035 float hshift, float sscale, float lscale)
00036 {
00037 myHueMin = hmin; myHueMax = hmax; myHueSpill = hspill;
00038 mySatMin = smin; mySatMax = smax; mySatSpill = sspill;
00039 myLumMin = lmin; myLumMax = lmax; myLumSpill = lspill;
00040
00041 myInterp = interp;
00042
00043 myHueShift = hshift; mySatScale = sscale; myLumScale = lscale;
00044 }
00045
00046 inline float hueKey(float hue) const;
00047 inline float satKey(float sat) const;
00048 inline float lumKey(float lum) const;
00049 protected:
00050 static void replacecolor(RU_PixelFunction *f, float **vals,
00051 const bool *scope);
00052
00053 virtual bool needAllComponents() const { return true; }
00054 virtual RUVectorFunc getVectorFunction() const
00055 { return replacecolor; }
00056
00057 private:
00058
00059 float myHueMin;
00060 float myHueMax;
00061 float myHueSpill;
00062 float mySatMin;
00063 float mySatMax;
00064 float mySatSpill;
00065 float myLumMin;
00066 float myLumMax;
00067 float myLumSpill;
00068 RU_InterpFunction myInterp;
00069
00070
00071 float myHueShift;
00072 float mySatScale;
00073 float myLumScale;
00074 };
00075
00076 #endif