HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_KeyBase.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: COP2_KeyBase.h
7  *
8  * COMMENTS:
9  * Interface class for all keying Cops.
10  */
11 #ifndef _COP2_KEYBASE_H_
12 #define _COP2_KEYBASE_H_
13 
14 #include "COP2_API.h"
15 #include "COP2_MaskOp.h"
16 
17 #include <TIL/TIL_CompOptions.h>
18 class TIL_TileList;
19 class COP2_Context;
20 class UT_ComputeGPU;
21 
23 {
29 };
30 
31 typedef float (*cop2_InterpFunc) (float w);
32 typedef float (*cop2_Interpolate) (float v1, float v2, float w);
33 typedef float (*COP2_KeyFunction) (void *data, const float val[4]);
34 
36 {
37 public:
38  virtual bool hasSpillParms() const;
39  virtual void setColorParms(float hmin, float hmax,
40  float smin, float smax,
41  float lmin, float lmax,
42  bool add, float t);
43 
44  virtual void setSpillParms(float hmin, float hmax,
45  float smin, float smax,
46  float lmin, float lmax,
47  bool add, float t);
48 
49  virtual void setStateControl(int state);
50 
51  // Interpolation functions.
52  static float hueInterp(float v1, float v2, float w);
53  static float linear(float v1, float v2, float w);
54 
55  // Comparison functions.
56  static float hueComp(float h, float hue1, float hue2, float spill = 0.0f,
57  float (*ifunc)(float) = 0);
58  static float linearComp(float v, float v1, float v2, float spill = 0.0f,
59  float (*ifunc)(float) = 0);
60 
61  // does a bounding box expansion on the HSL region
62  static void expandRegion(float h, float s, float l,
63  float &hmin, float &hmax,
64  float &smin, float &smax,
65  float &lmin, float &lmax);
66 
67  static cop2_InterpFunc getInterpolation(cop2_InterpType type);
68 protected:
69  // override these methods.
70  virtual const char *getKeyPlane(COP2_Context &context);
71  virtual int getSuperSample(COP2_Context & /*context*/) { return 1; }
72 
73  virtual bool convertToColorSpace(COP2_Context &context,
74  const float *c1,
75  const float *c2,
76  const float *c3,
77  const float *c4,
78  float *&d1,
79  float *&d2,
80  float *&d3,
81  float *&d4,
82  int size);
83 
84  virtual COP2_KeyFunction getKeyFunction(COP2_Context &context,
85  void *&data);
86 
87  virtual void colorFunction(COP2_Context &context,
88  float val[4], float key);
89 
90  virtual cop2_Interpolate getInterpFunction(COP2_Context &context,
91  int component);
92 
93 protected:
94  COP2_KeyBase(OP_Network *parent,
95  const char *name,
96  OP_Operator *entry);
97  ~COP2_KeyBase() override;
98 
100 
102  TIL_TileList *tilelist) override;
103 
104  OP_ERROR doGPUCook(COP2_Context &context,
105  TIL_TileList *tilelist,
106  const TIL_Plane *keyplane,
107  int supersample);
108  void doKeyOperation(TIL_TileList *tiles,
109  int supersample,
110  COP2_Context &context,
111  const float *c1,
112  const float *c2,
113  const float *c3,
114  const float *c4);
115 
117  COP2_CookAreaInfo &output_area,
118  const COP2_CookAreaList &input_areas,
119  COP2_CookAreaList &needed_areas) override;
120 
121  virtual void getShaderAndConstants(COP2_Context &context,
122  UT_String &shader_funcs,
123  UT_ComputeGPU &engine);
124 
126 };
127 
128 #endif
void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas) override
bool myAlphaGenerated
Definition: COP2_KeyBase.h:125
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles)=0
GLboolean * data
Definition: glcorearb.h:131
const GLdouble * v
Definition: glcorearb.h:837
virtual int getSuperSample(COP2_Context &)
Definition: COP2_KeyBase.h:71
GLdouble s
Definition: glad.h:3009
UT_ErrorSeverity
Definition: UT_Error.h:25
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:818
cop2_InterpType
Definition: COP2_KeyBase.h:22
< returns > If no error
Definition: snippets.dox:2
GLfloat f
Definition: glcorearb.h:1926
GLuint const GLchar * name
Definition: glcorearb.h:786
float(* cop2_InterpFunc)(float w)
Definition: COP2_KeyBase.h:31
GLdouble t
Definition: glad.h:2397
GLsizeiptr size
Definition: glcorearb.h:664
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
#define COP2_API
Definition: COP2_API.h:10
GLfloat GLfloat v1
Definition: glcorearb.h:817
GLuint GLfloat * val
Definition: glcorearb.h:1608
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
type
Definition: core.h:1059
float(* COP2_KeyFunction)(void *data, const float val[4])
Definition: COP2_KeyBase.h:33
Definition: format.h:895
float(* cop2_Interpolate)(float v1, float v2, float w)
Definition: COP2_KeyBase.h:32
TIL_Sequence * cookSequenceInfo(OP_ERROR &error) override