58 template <
typename T>
static constexpr
inline T
61 constexpr
T zero = 0.0031308;
63 constexpr
T a = 0.055;
64 constexpr
T gamma = 2.4;
65 return x <= zero ? x*scale : (1+
a)*SYSpow(x, 1/gamma) -
a;
67 template <
typename T>
static constexpr
inline T
70 constexpr
T zero = 0.018;
71 constexpr
T scale = 4.5;
72 constexpr
T a = 0.099;
73 constexpr
T gamma = 0.45;
74 return x <= zero ? x*scale : (1+
a)*SYSpow(x, gamma) -
a;
76 template <
typename T>
static constexpr
inline T
77 linearToGamma(T x, T gamma)
79 return SYSsafepow(x, 1/gamma);
81 template <
typename T>
static constexpr
inline T
84 constexpr
T gamma = 2.2;
85 return linearToGamma(x, gamma);
88 template <
typename T>
static constexpr
inline T
91 constexpr
T zero = 0.04045;
92 constexpr
T scale = 12.92;
93 constexpr
T a = 0.055;
94 constexpr
T gamma = 2.4;
95 return x <= zero ? x*(1/
scale) : SYSpow((x+a)*(1/(1+
a)), gamma);
97 template <
typename T>
static constexpr
inline T
100 constexpr
T zero = 0.081;
101 constexpr
T scale = 4.5;
102 constexpr
T a = 0.099;
103 constexpr
T gamma = 0.45;
104 return x <= zero ? x*(1/
scale) : SYSpow((x+a)*(1/(1+
a)), (1/gamma));
106 template <
typename T>
static constexpr
inline T
107 gammaToLinear(T x, T gamma)
109 return SYSsafepow(x, gamma);
111 template <
typename T>
static constexpr
inline T
114 constexpr
T gamma = 2.2;
115 return gammaToLinear(x, gamma);
128 #define UT_BLACK (UT_Color::getConstantColor(0))
129 #define UT_BLUE (UT_Color::getConstantColor(1))
130 #define UT_GREEN (UT_Color::getConstantColor(2))
131 #define UT_RED (UT_Color::getConstantColor(3))
132 #define UT_CYAN (UT_Color::getConstantColor(4))
133 #define UT_MAGENTA (UT_Color::getConstantColor(5))
134 #define UT_YELLOW (UT_Color::getConstantColor(6))
135 #define UT_WHITE (UT_Color::getConstantColor(7))
136 #define UT_GREY1 (UT_Color::getConstantColor(8))
137 #define UT_GREY2 (UT_Color::getConstantColor(9))
138 #define UT_GREY3 (UT_Color::getConstantColor(10))
139 #define UT_GREY4 (UT_Color::getConstantColor(11))
140 #define UT_GREY5 (UT_Color::getConstantColor(12))
141 #define UT_GREY6 (UT_Color::getConstantColor(13))
142 #define UT_GREY7 (UT_Color::getConstantColor(14))
143 #define UT_GREY8 (UT_Color::getConstantColor(15))
144 #define UT_GREY9 (UT_Color::getConstantColor(16))
157 explicit UT_Color(
const char *colorname);
164 { x = u; y =
v; z =
w;}
171 else getRGBConvert(r,g,b);
174 void getHSV(
float *
h,
float *
s,
float *
v)
const;
175 void getHSL(
float *
h,
float *
s,
float *l)
const;
176 void getXYZ(
float *x,
float *y,
float *z)
const;
177 void getLAB(
float *l,
float *a,
float *
b)
const;
178 void getTMI(
float *t,
float *m,
float *i)
const;
192 fpreal relativeLuminance()
const;
201 void setLABluminance(
fpreal l);
203 void setUnique(
int64 idx);
205 void setColorByName(
const char *colorname);
209 void ghost(
fpreal gfactor = 0.75
f);
220 void brighten(
fpreal amount);
227 void gamma(
fpreal gamma );
233 int save(std::ostream &os,
int binary)
const;
234 void saveMinimalAsText(std::ostream &os)
const;
252 float *
r,
float *
g,
float *
b);
265 static void getUniqueColor(
int64 idx,
266 float *
r,
float *
g,
float *
b);
269 static const UT_Color &getConstantColor(
int i);
275 static void getRandomContrastingColor(
const UT_Vector3 * contrast_to,
300 void getRGBConvert(
float *
r,
float *
g,
float *
b)
const;
318 float burn = 0,
float maxtemp = 40000,
319 int N = 64,
bool tonemap =
true);
void getValue(float &x, float &y, float &z) const
void getRGB(float *r, float *g, float *b) const
const GLuint GLenum const void * binary
GLdouble GLdouble GLdouble z
GLboolean GLboolean GLboolean GLboolean a
JSON reader class which handles parsing of JSON or bJSON files.
void getValue(fpreal64 &x, fpreal64 &y, fpreal64 &z) const
UT_API void UT_TMItoRGB(fpreal *values, int nvalues)
Class which writes ASCII or binary JSON streams.
std::ostream & operator<<(std::ostream &ostr, const DataType &a)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
GA_API const UT_StringHolder scale
GLint GLint GLsizei GLint GLenum GLenum type
const char * className() const
UT_API void UT_HSVtoRGB(fpreal *values, int nvalues)
void setValue(fpreal x, fpreal y, fpreal z)
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
UT_API void UT_RGBtoTMI(fpreal *values, int nvalues)
GLboolean GLboolean GLboolean b
UT_API void UTinitPhysicalBBRamp(UT_Ramp &ramp, float adaptation=0.15, float burn=0, float maxtemp=40000, int N=64, bool tonemap=true)
GLfloat GLfloat GLfloat GLfloat h
UT_API size_t UTformatBuffer(char *buffer, size_t buffer_size, const UT_Color &v)
int operator!=(const UT_Color &c) const
GLenum GLsizei GLsizei GLint * values
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
GA_API const UT_StringHolder N
Class to store JSON objects as C++ objects.
UT_API UT_ColorType UTcolorTypeFromName(const char *cname)
UT_API const char * UTnameFromColorType(UT_ColorType ctype)
GLubyte GLubyte GLubyte GLubyte w
void getColor(UT_Color &c) const
UT_API void UT_RGBtoHSV(fpreal *values, int nvalues)
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
UT_ColorType getType() const