HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RU_ColorCurve.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: RU_ColorCurve.h
7  *
8  * COMMENTS:
9  * A simple 2D curve for quick evaluation (for color curves).
10  */
11 #ifndef RU_SMOOTHCURVE_H
12 #define RU_SMOOTHCURVE_H
13 
14 #include "RU_API.h"
15 #include <UT/UT_FloatArray.h>
16 #include <UT/UT_Singleton.h>
17 #include <UT/UT_Vector2Array.h>
18 #include <TIL/TIL_Defines.h>
19 
20 #include "RU_PixelFunction.h"
21 
22 class GU_Detail;
23 
25 {
26 public:
27  RU_ColorCurve();
28  ~RU_ColorCurve();
29 
30  void reset();
31  void addPoint(float pos, float val, float sharpness);
32  void create(bool extend_slopes = true);
33 
34  float evaluate(float pos) const;
35 
36 // data
41  float myPreSlope, myPostSlope;
45 };
46 
47 
49 {
50 public:
52  RU_ColorCurveFunc(RU_ColorCurve **curves, int num);
53 
54  virtual ~RU_ColorCurveFunc();
55 
56 protected:
57  virtual bool eachComponentDifferent() const { return myNumCurves > 1; }
58 
59  static float curve(RU_PixelFunction *pf, float val, int);
60  virtual RUPixelFunc getPixelFunction() const { return curve; }
61  virtual void getPixelShader(UT_String &frag_shader);
62 
63  RU_ColorCurve *myCurves[4];
65  float *myCurveData;
66 };
67 
69 {
70 public:
71  // mode = 0, adjust sat. mode = 1, adjust lum.
72  RU_HueCurveFunc(RU_ColorCurve *curve, int mode);
73 
74  virtual ~RU_HueCurveFunc();
75 
76 protected:
77  virtual bool needAllComponents() const { return true; }
78 
79  static void hueSat(RU_PixelFunction *f, float **vals,
80  const bool *scope);
81  static void hueLum(RU_PixelFunction *f, float **vals,
82  const bool *scope);
84  { return myMode ? hueLum:hueSat; }
85  virtual void getPixelShader(UT_String &frag_shader);
86 
87  struct CurveData
88  {
90  ~CurveData();
91 
92  float *myScales;
93  float myAvgScale;
94  };
95 
97  int myMode;
99 };
100 
101 
102 #endif
virtual bool eachComponentDifferent() const
Definition: RU_ColorCurve.h:57
#define RU_API
Definition: RU_API.h:10
UT_FloatArray myDivs
Definition: RU_ColorCurve.h:37
UT_FloatArray mySharp
Definition: RU_ColorCurve.h:39
GLfloat f
Definition: glcorearb.h:1925
RU_ColorCurve * myCurve
Definition: RU_ColorCurve.h:96
GLenum mode
Definition: glcorearb.h:98
virtual bool needAllComponents() const
Definition: RU_ColorCurve.h:77
GLuint GLfloat * val
Definition: glcorearb.h:1607
UT_Vector2Array myPoints
Definition: RU_ColorCurve.h:40
png_infop png_uint_32 int num
Definition: png.h:2158
virtual RUPixelFunc getPixelFunction() const
Definition: RU_ColorCurve.h:60
void(* RUVectorFunc)(RU_PixelFunction *, float **, const bool *)
UT_SingletonWithLock< CurveData, true > myCurveData
Definition: RU_ColorCurve.h:98
virtual void getPixelShader(UT_String &frag_shader)
float(* RUPixelFunc)(RU_PixelFunction *, float, int)
UT_FloatArray myValues
Definition: RU_ColorCurve.h:38
virtual RUVectorFunc getVectorFunction() const
Definition: RU_ColorCurve.h:83