00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COP2_MaskOp_h__
00021 #define __COP2_MaskOp_h__
00022
00023 #include "COP2_API.h"
00024 #include <UT/UT_IntArray.h>
00025 #include <UT/UT_FloatArray.h>
00026
00027 #include "COP2_PixelBase.h"
00028
00029 #define ARG_MASKOP_AMOUNT "effectamount"
00030 #define ARG_MASKOP_MASKINPUT "maskinput"
00031 #define ARG_MASKOP_MASKPLANE "maskplane"
00032 #define ARG_MASKOP_RESIZEMASK "maskresize"
00033 #define ARG_MASKOP_MASKINVERT "maskinvert"
00034
00035 class COP2_API COP2_MaskOp : public COP2_PixelBase
00036 {
00037 public:
00038 static OP_TemplatePair myTemplatePair;
00039 static PRM_Template myTemplateList[];
00040
00041 unsigned disableParms();
00042
00043
00044
00045
00046 virtual int getOpInput() const { return 0; }
00047 virtual int getMaskInput() const { return 1; }
00048
00049 virtual const char *inputConnectorLabel(unsigned idx);
00050
00051 virtual int getAuxInput() const { return getMaskInput(); }
00052
00053 virtual COP2_Node * getPassThroughInput(COP2_Context &) { return this; }
00054
00055
00056
00057 virtual bool doNormalMask(COP2_Context &) { return true; }
00058
00059
00060
00061 virtual bool isFrameEffectHandled() { return true; }
00062
00063 int getMaskFromInput();
00064
00065 virtual void computeImageBounds(COP2_Context &context);
00066
00067 bool getMaskBounds(float t, int xres, int yres, int thread,
00068 int &x1,int &y1, int &x2, int &y2);
00069
00070 bool getMaskBounds(COP2_Context &context,
00071 int &x1,int &y1, int &x2, int &y2)
00072 { return getMaskBounds(context.myTime,
00073 context.myXres, context.myYres,
00074 context.myThreadIndex, x1,y1,x2,y2); }
00075
00076 virtual void modifyViewMatrix(int input,
00077 COP2_Context &context,
00078 UT_Matrix4 &matrix,
00079 float zoom);
00080 protected:
00081 COP2_MaskOp(OP_Network *parent, const char *name, OP_Operator *entry);
00082 virtual ~COP2_MaskOp();
00083
00084 virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error);
00085
00086
00087
00088
00089
00090 void setupMaskParms();
00091
00092 virtual float getFrameScopeEffect(int image_index);
00093
00094
00095 virtual OP_ERROR doCookMyTile(COP2_Context &context,
00096 TIL_TileList *tiles) = 0;
00097
00098
00099
00100 virtual OP_ERROR cookMyTile(COP2_Context &context,
00101 TIL_TileList *tiles);
00102
00103 virtual void getInputDependenciesForOutputArea(
00104 COP2_CookAreaInfo &output_area,
00105 const COP2_CookAreaList &input_areas,
00106 COP2_CookAreaList &needed_areas);
00107
00108
00109
00110
00111 void getMaskDependency(COP2_CookAreaInfo &output_area,
00112 const COP2_CookAreaList &input_areas,
00113 COP2_CookAreaList &needed_areas);
00114
00115 TIL_Region *getMaskRegion(COP2_Context &context,
00116 const TIL_Plane *plane, float t,
00117 int x1, int y1, int x2, int y2);
00118
00119 float * getMaskData(COP2_Context &context, int x1,int y1,
00120 int x2,int y2, int component = 0);
00121
00122 virtual float AMOUNT(float t) { return evalFloat(ARG_MASKOP_AMOUNT, 0, t);}
00123 virtual int MASK_INPUT() { return evalInt(ARG_MASKOP_MASKINPUT, 0, 0); }
00124 virtual void MASK_PLANE(UT_String &s)
00125 { evalString(s, ARG_MASKOP_MASKPLANE, 0, 0); }
00126 virtual int MASK_INVERT() { return evalInt(ARG_MASKOP_MASKINVERT, 0,0); }
00127 virtual int MASK_RESIZE() { return evalInt(ARG_MASKOP_RESIZEMASK, 0,0); }
00128
00129 bool getMask(int &pindex, int &cindex);
00130
00131 float getAmount(int image_index);
00132
00133 int myMaskInput;
00134 UT_String myMaskPlane;
00135 bool myMaskInvert;
00136 bool myHasMask;
00137 bool myMaskResize;
00138 UT_Lock myAmountLock;
00139 UT_IntArray myAmountIndex;
00140 UT_FloatArray myAmountValue;
00141 };
00142
00143 #endif