HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpenColorTypes.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
3 All Rights Reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13 * Neither the name of Sony Pictures Imageworks nor the names of its
14  contributors may be used to endorse or promote products derived from
15  this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 
30 #ifndef INCLUDED_OCIO_OPENCOLORTYPES_H
31 #define INCLUDED_OCIO_OPENCOLORTYPES_H
32 
33 #include "OpenColorABI.h"
34 
35 #ifndef OCIO_NAMESPACE_ENTER
36 #error This header cannot be used directly. Use <OpenColorIO/OpenColorIO.h> instead.
37 #endif
38 
39 #include <limits>
40 #include <string>
41 
42 /*!rst::
43 C++ Types
44 =========
45 */
46 
48 {
49  // Predeclare all class ptr definitions
50 
51  //!rst::
52  // Core
53  // ****
54 
55  class OCIOEXPORT Config;
56  //!cpp:type::
57  typedef OCIO_SHARED_PTR<const Config> ConstConfigRcPtr;
58  //!cpp:type::
59  typedef OCIO_SHARED_PTR<Config> ConfigRcPtr;
60 
62  //!cpp:type::
63  typedef OCIO_SHARED_PTR<const ColorSpace> ConstColorSpaceRcPtr;
64  //!cpp:type::
65  typedef OCIO_SHARED_PTR<ColorSpace> ColorSpaceRcPtr;
66 
68  //!cpp:type::
69  typedef OCIO_SHARED_PTR<const Look> ConstLookRcPtr;
70  //!cpp:type::
71  typedef OCIO_SHARED_PTR<Look> LookRcPtr;
72 
74  //!cpp:type::
75  typedef OCIO_SHARED_PTR<const Context> ConstContextRcPtr;
76  //!cpp:type::
77  typedef OCIO_SHARED_PTR<Context> ContextRcPtr;
78 
80  //!cpp:type::
81  typedef OCIO_SHARED_PTR<const Processor> ConstProcessorRcPtr;
82  //!cpp:type::
83  typedef OCIO_SHARED_PTR<Processor> ProcessorRcPtr;
84 
86  //!cpp:type::
87  typedef OCIO_SHARED_PTR<const ProcessorMetadata> ConstProcessorMetadataRcPtr;
88  //!cpp:type::
89  typedef OCIO_SHARED_PTR<ProcessorMetadata> ProcessorMetadataRcPtr;
90 
92  //!cpp:type::
93  typedef OCIO_SHARED_PTR<const Baker> ConstBakerRcPtr;
94  //!cpp:type::
95  typedef OCIO_SHARED_PTR<Baker> BakerRcPtr;
96 
100 
101 
102  //!rst::
103  // Transforms
104  // **********
105 
107  //!cpp:type::
108  typedef OCIO_SHARED_PTR<const Transform> ConstTransformRcPtr;
109  //!cpp:type::
110  typedef OCIO_SHARED_PTR<Transform> TransformRcPtr;
111 
113  //!cpp:type::
114  typedef OCIO_SHARED_PTR<const AllocationTransform> ConstAllocationTransformRcPtr;
115  //!cpp:type::
116  typedef OCIO_SHARED_PTR<AllocationTransform> AllocationTransformRcPtr;
117 
119  //!cpp:type::
120  typedef OCIO_SHARED_PTR<const CDLTransform> ConstCDLTransformRcPtr;
121  //!cpp:type::
122  typedef OCIO_SHARED_PTR<CDLTransform> CDLTransformRcPtr;
123 
125  //!cpp:type::
126  typedef OCIO_SHARED_PTR<const ColorSpaceTransform> ConstColorSpaceTransformRcPtr;
127  //!cpp:type::
128  typedef OCIO_SHARED_PTR<ColorSpaceTransform> ColorSpaceTransformRcPtr;
129 
131  //!cpp:type::
132  typedef OCIO_SHARED_PTR<const DisplayTransform> ConstDisplayTransformRcPtr;
133  //!cpp:type::
134  typedef OCIO_SHARED_PTR<DisplayTransform> DisplayTransformRcPtr;
135 
137  //!cpp:type::
138  typedef OCIO_SHARED_PTR<const ExponentTransform> ConstExponentTransformRcPtr;
139  //!cpp:type::
140  typedef OCIO_SHARED_PTR<ExponentTransform> ExponentTransformRcPtr;
141 
143  //!cpp:type::
144  typedef OCIO_SHARED_PTR<const FileTransform> ConstFileTransformRcPtr;
145  //!cpp:type::
146  typedef OCIO_SHARED_PTR<FileTransform> FileTransformRcPtr;
147 
149  //!cpp:type::
150  typedef OCIO_SHARED_PTR<const GroupTransform> ConstGroupTransformRcPtr;
151  //!cpp:type::
152  typedef OCIO_SHARED_PTR<GroupTransform> GroupTransformRcPtr;
153 
155  //!cpp:type::
156  typedef OCIO_SHARED_PTR<const LogTransform> ConstLogTransformRcPtr;
157  //!cpp:type::
158  typedef OCIO_SHARED_PTR<LogTransform> LogTransformRcPtr;
159 
161  //!cpp:type::
162  typedef OCIO_SHARED_PTR<const LookTransform> ConstLookTransformRcPtr;
163  //!cpp:type::
164  typedef OCIO_SHARED_PTR<LookTransform> LookTransformRcPtr;
165 
167  //!cpp:type::
168  typedef OCIO_SHARED_PTR<const MatrixTransform> ConstMatrixTransformRcPtr;
169  //!cpp:type::
170  typedef OCIO_SHARED_PTR<MatrixTransform> MatrixTransformRcPtr;
171 
173  //!cpp:type::
174  typedef OCIO_SHARED_PTR<const TruelightTransform> ConstTruelightTransformRcPtr;
175  //!cpp:type::
176  typedef OCIO_SHARED_PTR<TruelightTransform> TruelightTransformRcPtr;
177 
178  template <class T, class U>
179  inline OCIO_SHARED_PTR<T> DynamicPtrCast(OCIO_SHARED_PTR<U> const & ptr)
180  {
181  return OCIO_DYNAMIC_POINTER_CAST<T,U>(ptr);
182  }
183 
184 
185  //!rst::
186  // Enums
187  // *****
188 
190  {
196  };
197 
198  //!cpp:type::
200  {
204  };
205 
206  //!cpp:type::
208  {
212  };
213 
214  //!cpp:type::
215  //
216  // Specify the interpolation type to use
217  // If the specified interpolation type is not supported in the requested
218  // context (for example, using tetrahedral interpolationon 1D luts)
219  // an exception will be throw.
220  //
221  // INTERP_BEST will choose the best interpolation type for the requested
222  // context:
223  //
224  // Lut1D INTERP_BEST: LINEAR
225  // Lut3D INTERP_BEST: LINEAR
226  //
227  // Note: INTERP_BEST is subject to change in minor releases, so if you
228  // care about locking off on a specific interpolation type, we'd recommend
229  // directly specifying it.
230 
232  {
234  INTERP_NEAREST = 1, //! nearest neighbor in all dimensions
235  INTERP_LINEAR = 2, //! linear interpolation in all dimensions
236  INTERP_TETRAHEDRAL = 3, //! tetrahedral interpolation in all directions
237  INTERP_BEST = 255 //! the 'best' suitable interpolation type
238  };
239 
240  //!cpp:type::
241  enum BitDepth {
251  };
252 
253  //!cpp:type::
254  enum Allocation {
258  };
259 
260  //!cpp:type:: Used when there is a choice of hardware shader language.
262  {
264  GPU_LANGUAGE_CG, ///< Nvidia Cg shader
265  GPU_LANGUAGE_GLSL_1_0, ///< OpenGL Shading Language
266  GPU_LANGUAGE_GLSL_1_3 ///< OpenGL Shading Language
267  };
268 
269  //!cpp:type::
271  {
275  };
276 
277  //!rst::
278  // Conversion
279  // **********
280 
281  //!cpp:function::
282  extern OCIOEXPORT const char * BoolToString(bool val);
283  //!cpp:function::
284  extern OCIOEXPORT bool BoolFromString(const char * s);
285 
286  //!cpp:function::
287  extern OCIOEXPORT const char * LoggingLevelToString(LoggingLevel level);
288  //!cpp:function::
289  extern OCIOEXPORT LoggingLevel LoggingLevelFromString(const char * s);
290 
291  //!cpp:function::
293  //!cpp:function::
295 
296  //!cpp:function::
298  //!cpp:function::
300  TransformDirection d2);
301 
302  //!cpp:function::
304  //!cpp:function::
306 
307  //!cpp:function::
308  extern OCIOEXPORT const char * BitDepthToString(BitDepth bitDepth);
309  //!cpp:function::
310  extern OCIOEXPORT BitDepth BitDepthFromString(const char * s);
311  //!cpp:function::
312  extern OCIOEXPORT bool BitDepthIsFloat(BitDepth bitDepth);
313  //!cpp:function::
314  extern OCIOEXPORT int BitDepthToInt(BitDepth bitDepth);
315 
316  //!cpp:function::
317  extern OCIOEXPORT const char * AllocationToString(Allocation allocation);
318  //!cpp:function::
319  extern OCIOEXPORT Allocation AllocationFromString(const char * s);
320 
321  //!cpp:function::
323  //!cpp:function::
324  extern OCIOEXPORT Interpolation InterpolationFromString(const char * s);
325 
326  //!cpp:function::
327  extern OCIOEXPORT const char * GpuLanguageToString(GpuLanguage language);
328  //!cpp:function::
329  extern OCIOEXPORT GpuLanguage GpuLanguageFromString(const char * s);
330 
331  //!cpp:function::
333  //!cpp:function::
335 
336 
337  /*!rst::
338  Roles
339  *****
340 
341  ColorSpace Roles are used so that plugins, in addition to this API can have
342  abstract ways of asking for common colorspaces, without referring to them
343  by hardcoded names.
344 
345  Internal::
346 
347  GetGPUDisplayTransform - (ROLE_SCENE_LINEAR (fstop exposure))
348  (ROLE_COLOR_TIMING (ASCColorCorrection))
349 
350  External Plugins (currently known)::
351 
352  Colorpicker UIs - (ROLE_COLOR_PICKING)
353  Compositor LogConvert - (ROLE_SCENE_LINEAR, ROLE_COMPOSITING_LOG)
354 
355  */
356 
357  //!rst::
358  // .. c:var:: const char* ROLE_DEFAULT
359  //
360  // "default"
361  extern OCIOEXPORT const char * ROLE_DEFAULT;
362  //!rst::
363  // .. c:var:: const char* ROLE_REFERENCE
364  //
365  // "reference"
366  extern OCIOEXPORT const char * ROLE_REFERENCE;
367  //!rst::
368  // .. c:var:: const char* ROLE_DATA
369  //
370  // "data"
371  extern OCIOEXPORT const char * ROLE_DATA;
372  //!rst::
373  // .. c:var:: const char* ROLE_COLOR_PICKING
374  //
375  // "color_picking"
376  extern OCIOEXPORT const char * ROLE_COLOR_PICKING;
377  //!rst::
378  // .. c:var:: const char* ROLE_SCENE_LINEAR
379  //
380  // "scene_linear"
381  extern OCIOEXPORT const char * ROLE_SCENE_LINEAR;
382  //!rst::
383  // .. c:var:: const char* ROLE_COMPOSITING_LOG
384  //
385  // "compositing_log"
386  extern OCIOEXPORT const char * ROLE_COMPOSITING_LOG;
387  //!rst::
388  // .. c:var:: const char* ROLE_COLOR_TIMING
389  //
390  // "color_timing"
391  extern OCIOEXPORT const char * ROLE_COLOR_TIMING;
392  //!rst::
393  // .. c:var:: const char* ROLE_TEXTURE_PAINT
394  //
395  // This role defines the transform for painting textures. In some
396  // workflows this is just a inverse display gamma with some limits
397  extern OCIOEXPORT const char * ROLE_TEXTURE_PAINT;
398  //!rst::
399  // .. c:var:: const char* ROLE_MATTE_PAINT
400  //
401  // This role defines the transform for matte painting. In some workflows
402  // this is a 1D HDR to LDR allocation. It is normally combined with
403  // another display transform in the host app for preview.
404  extern OCIOEXPORT const char * ROLE_MATTE_PAINT;
405 
406 }
408 
409 #endif
GLdouble s
Definition: glew.h:1390
rst::
Definition: OpenColorIO.h:88
rst:: .. _colorspace_section:
Definition: OpenColorIO.h:577
rst::
Definition: OpenColorIO.h:925
OCIOEXPORT const char * ROLE_REFERENCE
rst::
TransformDirection
cpp:type::
ColorSpaceDirection
cpp:type::
OCIO_NAMESPACE_ENTER
OCIO_SHARED_PTR< const AllocationTransform > ConstAllocationTransformRcPtr
cpp:type::
OCIOEXPORT const char * ROLE_DEFAULT
rst::
OCIO_SHARED_PTR< DisplayTransform > DisplayTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< ExponentTransform > ExponentTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIOEXPORT ColorSpaceDirection ColorSpaceDirectionFromString(const char *s)
cpp:function::
OCIO_SHARED_PTR< Context > ContextRcPtr
cpp:type::
OCIOEXPORT TransformDirection TransformDirectionFromString(const char *s)
cpp:function::
rst:: //////////////////////////////////////////////////////////////////
Nvidia Cg shader.
OCIOEXPORT Allocation AllocationFromString(const char *s)
cpp:function::
GLenum mode
Definition: glew.h:2163
OCIO_SHARED_PTR< const Processor > ConstProcessorRcPtr
cpp:type::
OCIO_SHARED_PTR< TruelightTransform > TruelightTransformRcPtr
cpp:type::
OCIOEXPORT const char * TransformDirectionToString(TransformDirection dir)
cpp:function::
nearest neighbor in all dimensions
GLuint const GLfloat * val
Definition: glew.h:2794
rst::
Definition: OpenColorIO.h:775
OCIOEXPORT const char * ROLE_COMPOSITING_LOG
rst::
OCIO_SHARED_PTR< const CDLTransform > ConstCDLTransformRcPtr
cpp:type::
OCIOEXPORT TransformDirection GetInverseTransformDirection(TransformDirection dir)
cpp:function::
OCIOEXPORT const char * ROLE_TEXTURE_PAINT
rst::
OCIOEXPORT const char * InterpolationToString(Interpolation interp)
cpp:function::
cpp:class::
Definition: OpenColorIO.h:863
OCIOEXPORT const char * EnvironmentModeToString(EnvironmentMode mode)
cpp:function::
OCIO_SHARED_PTR< const LogTransform > ConstLogTransformRcPtr
cpp:type::
class OCIOEXPORT Transform
rst::
LoggingLevel
rst::
cpp:class::
Definition: OpenColorIO.h:1040
OCIO_SHARED_PTR< Baker > BakerRcPtr
cpp:type::
OpenGL Shading Language.
OpenGL Shading Language.
OCIOEXPORT int BitDepthToInt(BitDepth bitDepth)
cpp:function::
OCIO_SHARED_PTR< GroupTransform > GroupTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< Transform > TransformRcPtr
cpp:type::
OCIO_SHARED_PTR< ColorSpace > ColorSpaceRcPtr
cpp:type::
GLuint interp
Definition: glew.h:8277
rst:: //////////////////////////////////////////////////////////////////
rst:: //////////////////////////////////////////////////////////////////
OCIO_SHARED_PTR< const FileTransform > ConstFileTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const ExponentTransform > ConstExponentTransformRcPtr
cpp:type::
tetrahedral interpolation in all directions
OCIOEXPORT bool BitDepthIsFloat(BitDepth bitDepth)
cpp:function::
OCIO_SHARED_PTR< const Config > ConstConfigRcPtr
cpp:type::
OCIOEXPORT LoggingLevel LoggingLevelFromString(const char *s)
cpp:function::
OCIO_SHARED_PTR< MatrixTransform > MatrixTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const Baker > ConstBakerRcPtr
cpp:type::
OCIO_SHARED_PTR< LookTransform > LookTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIO_SHARED_PTR< const Transform > ConstTransformRcPtr
cpp:type::
OCIOEXPORT const char * GpuLanguageToString(GpuLanguage language)
cpp:function::
rst:: .. _look_section:
Definition: OpenColorIO.h:717
OCIOEXPORT const char * LoggingLevelToString(LoggingLevel level)
cpp:function::
GpuLanguage
cpp:type:: Used when there is a choice of hardware shader language.
#define OCIOEXPORT
Definition: OpenColorABI.h:97
OCIOEXPORT const char * AllocationToString(Allocation allocation)
cpp:function::
BitDepth
cpp:type::
OCIOEXPORT const char * BoolToString(bool val)
rst::
OCIO_SHARED_PTR< Config > ConfigRcPtr
cpp:type::
OCIO_SHARED_PTR< const MatrixTransform > ConstMatrixTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIOEXPORT BitDepth BitDepthFromString(const char *s)
cpp:function::
OCIO_SHARED_PTR< AllocationTransform > AllocationTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const LookTransform > ConstLookTransformRcPtr
cpp:type::
#define OCIO_NAMESPACE_EXIT
Definition: OpenColorABI.h:50
OCIO_SHARED_PTR< Look > LookRcPtr
cpp:type::
Allocation
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
Interpolation
cpp:type::
OCIOEXPORT bool BoolFromString(const char *s)
cpp:function::
OCIO_SHARED_PTR< FileTransform > FileTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const Context > ConstContextRcPtr
cpp:type::
OCIOEXPORT const char * ROLE_DATA
rst::
OCIOEXPORT const char * ColorSpaceDirectionToString(ColorSpaceDirection dir)
cpp:function::
OCIO_SHARED_PTR< LogTransform > LogTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIOEXPORT const char * BitDepthToString(BitDepth bitDepth)
cpp:function::
OCIO_SHARED_PTR< const Look > ConstLookRcPtr
cpp:type::
const void * ptr(const T *p)
Definition: format.h:3292
OCIO_SHARED_PTR< const ProcessorMetadata > ConstProcessorMetadataRcPtr
cpp:type::
OCIO_SHARED_PTR< T > DynamicPtrCast(OCIO_SHARED_PTR< U > const &ptr)
OCIO_SHARED_PTR< CDLTransform > CDLTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const TruelightTransform > ConstTruelightTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIOEXPORT const char * ROLE_MATTE_PAINT
rst::
rst::
Definition: OpenColorIO.h:1205
OCIO_SHARED_PTR< const GroupTransform > ConstGroupTransformRcPtr
cpp:type::
OCIOEXPORT GpuLanguage GpuLanguageFromString(const char *s)
cpp:function::
OCIO_SHARED_PTR< const ColorSpaceTransform > ConstColorSpaceTransformRcPtr
cpp:type::
OCIO_SHARED_PTR< const DisplayTransform > ConstDisplayTransformRcPtr
cpp:type::
OCIOEXPORT const char * ROLE_COLOR_PICKING
rst::
rst:: //////////////////////////////////////////////////////////////////
OCIOEXPORT Interpolation InterpolationFromString(const char *s)
cpp:function::
OCIOEXPORT TransformDirection CombineTransformDirections(TransformDirection d1, TransformDirection d2)
cpp:function::
EnvironmentMode
cpp:type::
OCIO_SHARED_PTR< const ColorSpace > ConstColorSpaceRcPtr
cpp:type::
OCIOEXPORT EnvironmentMode EnvironmentModeFromString(const char *s)
cpp:function::
OCIOEXPORT const char * ROLE_COLOR_TIMING
rst::
OCIOEXPORT const char * ROLE_SCENE_LINEAR
rst::
linear interpolation in all dimensions
OCIO_SHARED_PTR< Processor > ProcessorRcPtr
cpp:type::
GLint level
Definition: glew.h:1252
OCIO_SHARED_PTR< ColorSpaceTransform > ColorSpaceTransformRcPtr
cpp:type::
rst:: //////////////////////////////////////////////////////////////////
OCIO_SHARED_PTR< ProcessorMetadata > ProcessorMetadataRcPtr
cpp:type::