![]() |
COP2_MaskOp allows you to include all the masking and scoping parameters, and it provides the code to support these parameters. Unless you have a filter operation that cannot be masked (ie, it changes the resolution of the image), you should always derive from COP2_MaskOp. The big exception is if your algorithm happens to be a pixel operation, in which case you should derive from COP2_PixelOp (which also derives from COP2_MaskOp).virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles);
virtual int getOpInput() const
This method returns the index of the main input (usually 0 for the main input).
virtual int getMaskInput() const
This method returns the index of the mask input. If you have more than one main input, you will need to override this method to set it to the last main input + 1.
virtual bool doNormalMask(COP2_Context &)
Masking can be handled in two ways - by blending the input with the output, and by modifying the effect of the operation per-pixel. The 'Normal' way to do masking is by blending. If your operation needs to do a per-pixel mask operation (such as varying the size of a kernel matrix), return false from this method.
virtual bool isFrameEffectHandled()
Similar to the doNormalMask() method, this method returns whether the frame effect has been incorporated into the parameters of the operation (true), or whether it needs to be incorporated as part of the masking operation (false). The 'frame effect' is a combination of the Effect parameter and the Non-Scoped Effect parameter (on the Frame Scope page). The frame effect can be accessed via the method float getFrameScopeEffect(int image_index).
TIL_Region *getMaskRegion(COP2_Context &context,const TIL_Plane *plane, float t,int x1, int y1, int x2, int y2)
This method returns a TIL_Region pointer to the plane that occupies the area x1,y1,x2,y2. It assumes that the plane you pass in is the mask plane.
float *getMaskData(COP2_Context &context, int x1,int y1,int x2,int y2, int component)
This is a simpler interface to getMaskRegion(). It returns you a single floating point array of the data in the mask plane for a given component in the area x1,y1 to x2,y2. You are responsible for delete[]'ing the data.
void getMaskDependency(COP2_CookAreaInfo &output_area,const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas)
If you need to override COP2_MaskOp's getInputDependenciesForOutputArea() but don't want to call COP2_Mask's version, you can use this method to set up the mask dependency.
void setupMaskParms()
If you need to override COP2_MaskOp's cookSequenceInfo() method, but don't want to call COP2_MaskOp's version, you must use this method to set up the mask parameters properly.