HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Ramp.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Ramp_h__
10 #define __HOM_Ramp_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_EnumModules.h"
16 #include "HOM_Module.h"
17 #include <UT/UT_Ramp.h>
18 
19 
20 SWIGOUT(%rename(Ramp) HOM_Ramp;)
21 
23 {
24 public:
26  : myIsColor(false)
27  { HOM_CONSTRUCT_OBJECT(this) }
28 
29  HOM_Ramp(std::vector<HOM_EnumValue *> basis,
30  const std::vector<double> &keys,
31  const std::vector<double> &values);
32 
33  HOM_Ramp(std::vector<HOM_EnumValue *> basis,
34  const std::vector<double> &keys,
35  const std::vector<std::vector<double> > &values);
36 
37  SWIGOUT(%ignore HOM_Ramp(const UT_Ramp&);)
38  HOM_Ramp(const UT_Ramp &ramp)
39  : myRamp{ramp}
40  , myIsColor{true}
41  {}
42 
44  { HOM_DESTRUCT_OBJECT(this) }
45 
46 
47  SWIGOUT(%ignore operator=;)
48  HOM_Ramp &operator=(const HOM_Ramp& ramp)
49  {
50  if (this != &ramp)
51  myRamp = ramp.myRamp;
52  return *this;
53  }
54 
56  {
57  return rhs.myPointer &&
58  myRamp == rhs.myPointer->myRamp &&
59  myIsColor == rhs.myPointer->myIsColor;
60  }
61 
63  { return !operator==(rhs); }
64 
65  std::string __repr__();
66 
67  bool isColor()
68  { return myIsColor; }
69 
70  HOM_EnumValue &colorType();
71  void setColorType(HOM_EnumValue &enum_value);
72 
73 
74  std::vector<HOM_EnumValue *> basis();
75 
76  std::vector<double> keys();
77 
79  { return &myRamp; }
80 
81 
82  SWIGOUT(%ignore getUTRamp;)
84  { return myRamp; }
85 
86  SWIGOUT(%ignore setIsColor;)
87  void setIsColor(bool is_color)
88  { myIsColor = is_color; }
89 
90  SWIGOUT(%ignore rampLookup;)
91  hboost::any rampLookup(double pos);
92 
93  SWIGOUT(%ignore rampValues;)
94  hboost::any rampValues();
95 
96  // Internal converters
97  SWIGOUT(%ignore splineBasisForEnumValue;)
98  static UT_SPLINE_BASIS splineBasisForEnumValue(
99  HOM_EnumValue &enum_value);
100  SWIGOUT(%ignore splineBasisToEnumValue;)
101  static HOM_EnumValue & splineBasisToEnumValue(UT_SPLINE_BASIS basis);
102 
103 #ifdef SWIG
104 %extend
105 {
106  InterpreterObject lookup(double pos)
107  {
108  return HOMboostAnyToInterpreterObject(self->rampLookup(pos));
109  }
110 
111  InterpreterObject values()
112  {
113  return HOMboostAnyToInterpreterObject(self->rampValues());
114  }
115 }
116 #endif
117 
118 private:
119  UT_Ramp myRamp;
120  bool myIsColor;
121 };
122 
123 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1398
HOM_Ramp(const UT_Ramp &ramp)
Definition: HOM_Ramp.h:38
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
UT_SPLINE_BASIS
Definition: UT_Spline.h:31
UT_Ramp & getUTRamp()
Definition: HOM_Ramp.h:83
bool isColor()
Definition: HOM_Ramp.h:67
bool any(const vbool4 &v)
Definition: simd.h:3600
#define HOM_API
Definition: HOM_API.h:13
bool operator==(HOM_PtrOrNull< HOM_Ramp > rhs)
Definition: HOM_Ramp.h:55
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1397
HOM_Ramp()
Definition: HOM_Ramp.h:25
void setIsColor(bool is_color)
Definition: HOM_Ramp.h:87
void * _asVoidPointer()
Definition: HOM_Ramp.h:78
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
bool operator!=(HOM_PtrOrNull< HOM_Ramp > rhs)
Definition: HOM_Ramp.h:62
~HOM_Ramp()
Definition: HOM_Ramp.h:43
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542