00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _COP2_COLORREPLACE_H_
00020 #define _COP2_COLORREPLACE_H_
00021
00022 #include "COP2_API.h"
00023 #define ARG_COLORREPLACE_SRCHUE (myParmBase + 0)
00024 #define ARG_COLORREPLACE_SRCLUM (myParmBase + 1)
00025 #define ARG_COLORREPLACE_TGTCLR (myParmBase + 2)
00026 #define ARG_COLORREPLACE_HUE_ROLLOFF (myParmBase + 3)
00027 #define ARG_COLORREPLACE_SAT_ROLLOFF (myParmBase + 4)
00028 #define ARG_COLORREPLACE_LUM_ROLLOFF (myParmBase + 5)
00029 #define ARG_COLORREPLACE_ROLL_FUNC (myParmBase + 6)
00030 #define ARG_COLORREPLACE_OPERATION (myParmBase + 7)
00031
00032 class RU_PixelFunction;
00033
00034 #include "COP2_PixelOp.h"
00035 #include "COP2_KeyBase.h"
00036
00037 class COP2_API COP2_ColorReplace : public COP2_KeyBase
00038 {
00039 public:
00040
00041 static OP_Node *myConstructor(OP_Network*, const char *,
00042 OP_Operator *);
00043 static OP_TemplatePair myTemplatePair;
00044 static OP_VariablePair myVariablePair;
00045 static PRM_Template myTemplateList[];
00046 static CH_LocalVariable myVariableList[];
00047 static const char * myInputLabels[];
00048
00049
00050 virtual bool hasSpillParms() const { return true; }
00051 virtual void setColorParms(float hmin, float hmax,
00052 float smin, float smax,
00053 float lmin, float lmax,
00054 bool add, float t);
00055
00056 virtual void setSpillParms(float hmin, float hmax,
00057 float smin, float smax,
00058 float lmin, float lmax,
00059 bool add, float t);
00060
00061 protected:
00062 virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
00063 float t, int xres, int yres,
00064 int thread,
00065 int max_threads);
00066
00067 virtual bool usesPartialFrameScope() { return false; }
00068 virtual bool isFrameEffectHandled() { return false; }
00069
00070 virtual bool convertToColorSpace(COP2_Context &context,
00071 const float *c1, const float *c2,
00072 const float *c3, const float *c4,
00073 float *&d1, float *&d2,
00074 float *&d3, float *&d4,
00075 int size);
00076
00077 virtual COP2_KeyFunction getKeyFunction(COP2_Context &context,
00078 void *&data);
00079
00080 virtual void colorFunction(COP2_Context &context,
00081 float val[4], float key);
00082 virtual int getSuperSample(COP2_Context &context);
00083
00084 private:
00085 COP2_ColorReplace(OP_Network *parent, const char *name,
00086 OP_Operator *entry);
00087 virtual ~COP2_ColorReplace();
00088
00089 virtual const char *getOperationInfo();
00090
00091 void SRC_HUE(float &h1, float &h2, float t)
00092 {
00093 h1 = evalFloat("srchuesat", 0, t);
00094 h2 = evalFloat("srchuesat", 1, t);
00095 }
00096 void SRC_SAT(float &s1, float &s2, float t)
00097 {
00098 s1 = evalFloat("srchuesat", 2, t);
00099 s2 = evalFloat("srchuesat", 3, t);
00100 }
00101 void SRC_LUM(float &l1, float &l2, float t)
00102 {
00103 l1 = evalFloat("srclum", 0, t);
00104 l2 = evalFloat("srclum", 1, t);
00105 }
00106
00107 float TARGET_RED(float t)
00108 { return evalFloat("targetclr", 0, t); }
00109 float TARGET_GREEN(float t)
00110 { return evalFloat("targetclr", 1, t); }
00111 float TARGET_BLUE(float t)
00112 { return evalFloat("targetclr", 2, t); }
00113
00114 float HUE_ROLLOFF(float t)
00115 { return evalFloat("hrolloff", 0, t); }
00116 float SAT_ROLLOFF(float t)
00117 { return evalFloat("srolloff", 0, t); }
00118 float LUM_ROLLOFF(float t)
00119 { return evalFloat("lrolloff", 0, t); }
00120
00121 int ROLLOFF_FUNCTION()
00122 { return evalInt("rollfunc", 0, 0.0F); }
00123
00124 int OPERATION()
00125 { return evalInt("operation", 0, 0.0F); }
00126
00127 int SUPER_SAMPLE(float t)
00128 { return evalInt("supersample", 0, t); }
00129
00130 int myParmBase;
00131 };
00132
00133 class COP2_API cop2_ColorReplaceData : public COP2_ContextData
00134 {
00135 public:
00136 cop2_ColorReplaceData() {}
00137 virtual ~cop2_ColorReplaceData() {}
00138
00139 virtual bool createPerRes() const { return false; }
00140
00141 float myHueMin;
00142 float myHueMax;
00143 float mySatMin;
00144 float mySatMax;
00145 float myLumMin;
00146 float myLumMax;
00147
00148 float myHueRoll;
00149 float mySatRoll;
00150 float myLumRoll;
00151 cop2_InterpType myRolloffFunc;
00152
00153 float myR;
00154 float myG;
00155 float myB;
00156
00157 float myHue;
00158 float mySat;
00159 float myLumScale;
00160
00161 int myOperation;
00162
00163 int mySuperSample;
00164 };
00165 #endif