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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_BASE_GF_GAMMA_H
25 #define PXR_BASE_GF_GAMMA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/base/gf/api.h"
29 
30 /// \file gf/gamma.h
31 /// Utilities to map colors between gamma spaces.
32 
34 
35 class GfVec3f;
36 class GfVec3d;
37 class GfVec4f;
38 class GfVec4d;
39 class GfVec3h;
40 class GfVec4h;
41 
42 /// Return a new vector with each component of \p v raised to the power \p
43 /// gamma
44 GF_API
45 GfVec3f GfApplyGamma(const GfVec3f &v, double gamma);
46 
47 /// Return a new vector with each component of \p v raised to the power \p
48 /// gamma
49 GF_API
50 GfVec3d GfApplyGamma(const GfVec3d &v, double gamma);
51 
52 /// \copydoc GfApplyGamma(GfVec3d,double)
53 GF_API
54 GfVec3h GfApplyGamma(const GfVec3h &v, double gamma);
55 
56 /// Return a new vector with the first three components of \p v raised to the
57 /// power \p gamma and the fourth component unchanged.
58 GF_API
59 GfVec4f GfApplyGamma(const GfVec4f &v, double gamma);
60 
61 /// Return a new vector with the first three components of \p v raised to the
62 /// power \p gamma and the fourth component unchanged.
63 GF_API
64 GfVec4d GfApplyGamma(const GfVec4d &v, double gamma);
65 
66 /// \copydoc GfApplyGamma(GfVec4h,double)
67 GF_API
68 GfVec4h GfApplyGamma(const GfVec4h &v, double gamma);
69 
70 /// Return a new float raised to the power \p gamma
71 GF_API
72 float GfApplyGamma(const float &v, double gamma);
73 
74 /// Return a new char raised to the power \p gamma
75 GF_API
76 unsigned char GfApplyGamma(const unsigned char &v, double gamma);
77 
78 /// Return the system display gamma
79 GF_API
80 double GfGetDisplayGamma();
81 
82 /// Given a vec, \p v, representing an energy-linear RGB(A) color, return a
83 /// vec of the same type converted to the system's display gamma.
90 GF_API float GfConvertLinearToDisplay(const float &v);
91 GF_API unsigned char GfConvertLinearToDisplay(const unsigned char &v);
92 
93 /// Given a vec, \p v, representing an RGB(A) color in the system's display
94 /// gamma space, return an energy-linear vec of the same type.
101 GF_API float GfConvertDisplayToLinear(const float &v);
102 GF_API unsigned char GfConvertDisplayToLinear(const unsigned char &v);
103 
105 
106 #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:62
Definition: vec4d.h:62
GF_API GfVec3f GfApplyGamma(const GfVec3f &v, double gamma)
Definition: vec4h.h:63
Definition: vec4f.h:62
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
Definition: vec3d.h:62
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GF_API GfVec3f GfConvertLinearToDisplay(const GfVec3f &v)
Definition: vec3h.h:63
#define GF_API
Definition: api.h:40