HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gamma.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_GF_GAMMA_H
8 #define PXR_BASE_GF_GAMMA_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/base/gf/api.h"
12 
13 /// \file gf/gamma.h
14 /// Utilities to map colors between gamma spaces.
15 
17 
18 class GfVec3f;
19 class GfVec3d;
20 class GfVec4f;
21 class GfVec4d;
22 class GfVec3h;
23 class GfVec4h;
24 
25 /// Return a new vector with each component of \p v raised to the power \p
26 /// gamma
27 GF_API
28 GfVec3f GfApplyGamma(const GfVec3f &v, double gamma);
29 
30 /// Return a new vector with each component of \p v raised to the power \p
31 /// gamma
32 GF_API
33 GfVec3d GfApplyGamma(const GfVec3d &v, double gamma);
34 
35 /// \copydoc GfApplyGamma(GfVec3d,double)
36 GF_API
37 GfVec3h GfApplyGamma(const GfVec3h &v, double gamma);
38 
39 /// Return a new vector with the first three components of \p v raised to the
40 /// power \p gamma and the fourth component unchanged.
41 GF_API
42 GfVec4f GfApplyGamma(const GfVec4f &v, double gamma);
43 
44 /// Return a new vector with the first three components of \p v raised to the
45 /// power \p gamma and the fourth component unchanged.
46 GF_API
47 GfVec4d GfApplyGamma(const GfVec4d &v, double gamma);
48 
49 /// \copydoc GfApplyGamma(GfVec4h,double)
50 GF_API
51 GfVec4h GfApplyGamma(const GfVec4h &v, double gamma);
52 
53 /// Return a new float raised to the power \p gamma
54 GF_API
55 float GfApplyGamma(const float &v, double gamma);
56 
57 /// Return a new char raised to the power \p gamma
58 GF_API
59 unsigned char GfApplyGamma(const unsigned char &v, double gamma);
60 
61 /// Return the system display gamma
62 GF_API
63 double GfGetDisplayGamma();
64 
65 /// Given a vec, \p v, representing an energy-linear RGB(A) color, return a
66 /// vec of the same type converted to the system's display gamma.
73 GF_API float GfConvertLinearToDisplay(const float &v);
74 GF_API unsigned char GfConvertLinearToDisplay(const unsigned char &v);
75 
76 /// Given a vec, \p v, representing an RGB(A) color in the system's display
77 /// gamma space, return an energy-linear vec of the same type.
84 GF_API float GfConvertDisplayToLinear(const float &v);
85 GF_API unsigned char GfConvertDisplayToLinear(const unsigned char &v);
86 
88 
89 #endif // PXR_BASE_GF_GAMMA_H
GF_API GfVec3f GfConvertDisplayToLinear(const GfVec3f &v)
GF_API double GfGetDisplayGamma()
Return the system display gamma.
const GLdouble * v
Definition: glcorearb.h:837
Definition: vec3f.h:45
Definition: vec4d.h:45
GF_API GfVec3f GfApplyGamma(const GfVec3f &v, double gamma)
Definition: vec4h.h:46
Definition: vec4f.h:45
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
Definition: vec3d.h:45
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
GF_API GfVec3f GfConvertLinearToDisplay(const GfVec3f &v)
Definition: vec3h.h:46
#define GF_API
Definition: api.h:23