HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 <SYS/SYS_Types.h>
16 
17 class UT_StringHolder;
18 class UT_StringArray;
19 class UT_Options;
20 
21 /// Abstract interface to OpenColorIO
23 {
24 public:
25  /// Private class
26  class ColorSpace;
27 
28  /// Returns whether the user has set $OCIO, $OCIO_ACTIVE_DISPLAYS or
29  /// $OCIO_ACTIVE_VIEWS is set. If there's an error loading the
30  /// configuration, this method will return @c false.
31  static bool isOCIOEnvSet(bool check_for_active_vars=true);
32 
33  /// Returns the current color space name
34  static const char *getDefaultDisplay();
35 
36  /// Returns the current color space name
37  static const char *getDefaultView(const char *display = NULL);
38 
39  /// Return the list of views for a given display.
40  static void getViewsForDisplay(const char *display,
41  UT_StringArray &view_names);
42 
43  /// Returns the list of active displays
44  static void getActiveDisplays(UT_StringArray &names);
45 
46  /// Returns the list of active views
47  static void getActiveViews(UT_StringArray &names);
48 
49  /// Returns a list of the supported color spaces
50  static void getColorSpaces(UT_StringArray &names);
51  /// Returns a list of the supported roles
52  static void getRoles(UT_StringArray &names);
53 
54  static const char *getDefaultRole();
55  static const char *getReferenceRole();
56  static const char *getDataRole();
57  static const char *getSceneLinearRole();
58  static const char *getCompLogRole();
59  static const char *getColorPickingRole();
60 
61  // find an sRGB color space in the given config file
62  static const char *getsRGBColorSpace(const char *display = nullptr);
63 
64  /// Return the colorspace defined by the view for a given display.
65  static const char *getColorSpaceForDisplayView(const char *display_name,
66  const char *view_name);
67 
68  /// Return the looks attached to the view for a given display.
69  static const char *getLooksForDisplayView(const char *display_name,
70  const char *view_name);
71 
72  /// Guess at the colorspace using the rightmost colorspace found, or NULL
73  /// if none are found.
74  static const char *parseColorSpaceFromString(const char *string);
75 
76  /// Return a color space handle given a name. The name may be a color
77  /// space name or prefixed with "role:" to specify a color space role.
78  static const ColorSpace *lookupSpace(const UT_StringHolder &name);
79 
80  /// Return the name of the color space
81  static const char *getName(const ColorSpace *space);
82  /// Return the description of the color space
83  static const char *getDescription(const ColorSpace *space);
84  /// Return the allocation variable meta data about the color space
85  static bool getAllocationVars(const ColorSpace* space,
86  bool &uniform,
87  fpreal &min,
88  fpreal &max,
89  fpreal &offset);
90  /// Set 'fp' to true if the color space is defined for FP, false for uint
91  static bool isFloatPointSpace(const ColorSpace* space,
92  bool &fp);
93 
94  /// Fill out metadata for color space in a UT_Options
95  /// Keys are the tokens in the config.ocio file:
96  /// - @c name
97  /// - @c family
98  /// - @c equalitygroup
99  /// - @c bitdepth
100  /// - @c description
101  /// - @c isdata
102  /// - @c allocation
103  /// - @c allocationvars
104  static bool getInfo(const ColorSpace *space, UT_Options &info);
105 
106  /// @{
107  /// Transform color data from one color space to another color space.
108  /// The color space names may either refer to a color space name, or it can
109  /// also be prefixed with "role:" and refer to a color space role. The
110  /// 'looks' is a comma separated list of color gradings (aka looks)
111  static bool transform(const UT_StringHolder &src,
112  const UT_StringHolder &dest,
113  const UT_StringHolder &looks,
114  fpreal32 *data, int npixels, int nchannels);
115  static bool transform(const ColorSpace *src,
116  const ColorSpace *dest,
117  const UT_StringHolder &looks,
118  fpreal32 *data, int npixels, int nchannels);
119  /// @}
120 
121  /// Transform from a colorspace to a display/view, including looks.
122  static bool transformToView(const UT_StringHolder &src,
123  const UT_StringHolder &display,
124  const UT_StringHolder &view,
125  fpreal32 *data, int npixels, int nchannels);
126 
127 private:
128 };
129 
130 #endif
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:128
#define PXL_API
Definition: PXL_API.h:10
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:132
png_FILE_p fp
Definition: png.h:2028
GLintptr offset
Definition: glcorearb.h:664
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
GA_API const UT_StringHolder transform
double fpreal
Definition: SYS_Types.h:263
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:22
float fpreal32
Definition: SYS_Types.h:184
GLenum src
Definition: glcorearb.h:1792