HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_OCIO.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: PXL_OCIO.h (UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __PXL_OCIO__
12 #define __PXL_OCIO__
13 
14 #include "PXL_API.h"
15 #include <UT/UT_Functor.h>
16 #include <SYS/SYS_Types.h>
17 
18 class UT_StringHolder;
19 class UT_StringArray;
20 class UT_Options;
21 
22 /// Abstract interface to OpenColorIO
24 {
25 public:
26  /// Private class
27  class ColorSpace;
28 
29  /// Returns whether the user has set $OCIO, $OCIO_ACTIVE_DISPLAYS or
30  /// $OCIO_ACTIVE_VIEWS is set. If there's an error loading the
31  /// configuration, this method will return @c false.
32  static bool isOCIOEnvSet(bool check_for_active_vars=true);
33 
34  /// Returns the current color space name
35  static const char *getDefaultDisplay();
36 
37  /// Returns the current color space name
38  static const char *getDefaultView(const char *display = NULL);
39 
40  /// Return the list of views for a given display.
41  static void getViewsForDisplay(const char *display,
42  UT_StringArray &view_names);
43 
44  /// Returns the list of active displays
45  static void getActiveDisplays(UT_StringArray &names);
46 
47  /// Returns the list of active views
48  static void getActiveViews(UT_StringArray &names);
49 
50  /// Returns a list of the supported color spaces
51  static void getColorSpaces(UT_StringArray &names);
52 
53  /// Returns a list of looks (color transforms)
54  static void getLooks(UT_StringArray &looks);
55 
56  /// Returns a list of the supported roles
57  static void getRoles(UT_StringArray &names);
58 
59  /// Reload the configuration.
60  static void reload();
61 
62  static const char *getDefaultRole();
63  static const char *getReferenceRole();
64  static const char *getDataRole();
65  static const char *getSceneLinearRole();
66  static const char *getCompLogRole();
67  static const char *getColorPickingRole();
68 
69  // find an sRGB color space in the given config file
70  static const char *getsRGBColorSpace(const char *display = nullptr);
71 
72  /// Return the colorspace defined by the view for a given display.
73  static const char *getColorSpaceForDisplayView(const char *display_name,
74  const char *view_name);
75 
76  /// Return the looks attached to the view for a given display.
77  static const char *getLooksForDisplayView(const char *display_name,
78  const char *view_name);
79 
80 
81  /// Guess at the colorspace using the rightmost colorspace found, or NULL
82  /// if none are found.
83  static const char *parseColorSpaceFromString(const char *string);
84 
85  /// Return a color space handle given a name. The name may be a color
86  /// space name or prefixed with "role:" to specify a color space role.
87  static const ColorSpace *lookupSpace(const UT_StringHolder &name);
88 
89  /// Return the name of the color space
90  static const char *getName(const ColorSpace *space);
91  /// Return the description of the color space
92  static const char *getDescription(const ColorSpace *space);
93  /// Return the allocation variable meta data about the color space
94  static bool getAllocationVars(const ColorSpace* space,
95  bool &uniform,
96  fpreal &min,
97  fpreal &max,
98  fpreal &offset);
99  /// Set 'fp' to true if the color space is defined for FP, false for uint
100  static bool isFloatPointSpace(const ColorSpace* space,
101  bool &fp);
102 
103  /// Fill out metadata for color space in a UT_Options
104  /// Keys are the tokens in the config.ocio file:
105  /// - @c name
106  /// - @c family
107  /// - @c equalitygroup
108  /// - @c bitdepth
109  /// - @c description
110  /// - @c isdata
111  /// - @c allocation
112  /// - @c allocationvars
113  static bool getInfo(const ColorSpace *space, UT_Options &info);
114 
115  /// @{
116  /// Transform color data from one color space to another color space.
117  /// The color space names may either refer to a color space name, or it can
118  /// also be prefixed with "role:" and refer to a color space role. The
119  /// 'looks' is a comma separated list of color gradings (aka looks)
120  static bool transform(const UT_StringHolder &src,
121  const UT_StringHolder &dest,
122  const UT_StringHolder &looks,
123  fpreal32 *data, int npixels, int nchannels);
124  static bool transform(const ColorSpace *src,
125  const ColorSpace *dest,
126  const UT_StringHolder &looks,
127  fpreal32 *data, int npixels, int nchannels);
128  /// @}
129 
130  /// Transform from a colorspace to a display/view, including looks.
131  static bool transformToView(const UT_StringHolder &src,
132  const UT_StringHolder &display,
133  const UT_StringHolder &view,
134  fpreal32 *data, int npixels, int nchannels);
135 
136 
137  static int addConfigChangeCB(UT_Functor<void> callback);
138  static void removeConfigChangeCB(int id);
139 
140 private:
141 };
142 
143 #endif
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
GLenum src
Definition: glew.h:2410
GLuint const GLchar * name
Definition: glew.h:1814
GLuint GLenum GLenum transform
Definition: glew.h:14742
#define PXL_API
Definition: PXL_API.h:10
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
GLuint const GLuint * names
Definition: glew.h:2690
double fpreal
Definition: SYS_Types.h:276
A map of string to various well defined value types.
Definition: UT_Options.h:42
cl_int getInfo(Func f, cl_uint name, T *param)
Definition: cl.hpp:1028
Abstract interface to OpenColorIO.
Definition: PXL_OCIO.h:23
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
float fpreal32
Definition: SYS_Types.h:195
GLintptr offset
Definition: glew.h:1682