PageRenderTime 24ms CodeModel.GetById 7ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/export/OpenColorIO/OpenColorTypes.h

http://github.com/imageworks/OpenColorIO
C++ Header | 409 lines | 167 code | 58 blank | 184 comment | 0 complexity | 4b1105e70519d8a3a9866c93c3676088 MD5 | raw file
  1/*
  2Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
  3All Rights Reserved.
  4
  5Redistribution and use in source and binary forms, with or without
  6modification, are permitted provided that the following conditions are
  7met:
  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.
 16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 17"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 18LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 19A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 20OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 21SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 22LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 26OF 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::
 43C++ Types
 44=========
 45*/
 46
 47OCIO_NAMESPACE_ENTER
 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    
 61    class OCIOEXPORT ColorSpace;
 62    //!cpp:type::
 63    typedef OCIO_SHARED_PTR<const ColorSpace> ConstColorSpaceRcPtr;
 64    //!cpp:type::
 65    typedef OCIO_SHARED_PTR<ColorSpace> ColorSpaceRcPtr;
 66    
 67    class OCIOEXPORT Look;
 68    //!cpp:type::
 69    typedef OCIO_SHARED_PTR<const Look> ConstLookRcPtr;
 70    //!cpp:type::
 71    typedef OCIO_SHARED_PTR<Look> LookRcPtr;
 72    
 73    class OCIOEXPORT Context;
 74    //!cpp:type::
 75    typedef OCIO_SHARED_PTR<const Context> ConstContextRcPtr;
 76    //!cpp:type::
 77    typedef OCIO_SHARED_PTR<Context> ContextRcPtr;
 78    
 79    class OCIOEXPORT Processor;
 80    //!cpp:type::
 81    typedef OCIO_SHARED_PTR<const Processor> ConstProcessorRcPtr;
 82    //!cpp:type::
 83    typedef OCIO_SHARED_PTR<Processor> ProcessorRcPtr;
 84    
 85    class OCIOEXPORT ProcessorMetadata;
 86    //!cpp:type::
 87    typedef OCIO_SHARED_PTR<const ProcessorMetadata> ConstProcessorMetadataRcPtr;
 88    //!cpp:type::
 89    typedef OCIO_SHARED_PTR<ProcessorMetadata> ProcessorMetadataRcPtr;
 90    
 91    class OCIOEXPORT Baker;
 92    //!cpp:type::
 93    typedef OCIO_SHARED_PTR<const Baker> ConstBakerRcPtr;
 94    //!cpp:type::
 95    typedef OCIO_SHARED_PTR<Baker> BakerRcPtr;
 96    
 97    class OCIOEXPORT ImageDesc;
 98    class OCIOEXPORT GpuShaderDesc;
 99    class OCIOEXPORT Exception;
100    
101    
102    //!rst::
103    // Transforms
104    // **********
105    
106    class OCIOEXPORT Transform;
107    //!cpp:type::
108    typedef OCIO_SHARED_PTR<const Transform> ConstTransformRcPtr;
109    //!cpp:type::
110    typedef OCIO_SHARED_PTR<Transform> TransformRcPtr;
111    
112    class OCIOEXPORT AllocationTransform;
113    //!cpp:type::
114    typedef OCIO_SHARED_PTR<const AllocationTransform> ConstAllocationTransformRcPtr;
115    //!cpp:type::
116    typedef OCIO_SHARED_PTR<AllocationTransform> AllocationTransformRcPtr;
117    
118    class OCIOEXPORT CDLTransform;
119    //!cpp:type::
120    typedef OCIO_SHARED_PTR<const CDLTransform> ConstCDLTransformRcPtr;
121    //!cpp:type::
122    typedef OCIO_SHARED_PTR<CDLTransform> CDLTransformRcPtr;
123    
124    class OCIOEXPORT ColorSpaceTransform;
125    //!cpp:type::
126    typedef OCIO_SHARED_PTR<const ColorSpaceTransform> ConstColorSpaceTransformRcPtr;
127    //!cpp:type::
128    typedef OCIO_SHARED_PTR<ColorSpaceTransform> ColorSpaceTransformRcPtr;
129    
130    class OCIOEXPORT DisplayTransform;
131    //!cpp:type::
132    typedef OCIO_SHARED_PTR<const DisplayTransform> ConstDisplayTransformRcPtr;
133    //!cpp:type::
134    typedef OCIO_SHARED_PTR<DisplayTransform> DisplayTransformRcPtr;
135    
136    class OCIOEXPORT ExponentTransform;
137    //!cpp:type::
138    typedef OCIO_SHARED_PTR<const ExponentTransform> ConstExponentTransformRcPtr;
139    //!cpp:type::
140    typedef OCIO_SHARED_PTR<ExponentTransform> ExponentTransformRcPtr;
141    
142    class OCIOEXPORT FileTransform;
143    //!cpp:type::
144    typedef OCIO_SHARED_PTR<const FileTransform> ConstFileTransformRcPtr;
145    //!cpp:type::
146    typedef OCIO_SHARED_PTR<FileTransform> FileTransformRcPtr;
147    
148    class OCIOEXPORT GroupTransform;
149    //!cpp:type::
150    typedef OCIO_SHARED_PTR<const GroupTransform> ConstGroupTransformRcPtr;
151    //!cpp:type::
152    typedef OCIO_SHARED_PTR<GroupTransform> GroupTransformRcPtr;
153    
154    class OCIOEXPORT LogTransform;
155    //!cpp:type::
156    typedef OCIO_SHARED_PTR<const LogTransform> ConstLogTransformRcPtr;
157    //!cpp:type::
158    typedef OCIO_SHARED_PTR<LogTransform> LogTransformRcPtr;
159    
160    class OCIOEXPORT LookTransform;
161    //!cpp:type::
162    typedef OCIO_SHARED_PTR<const LookTransform> ConstLookTransformRcPtr;
163    //!cpp:type::
164    typedef OCIO_SHARED_PTR<LookTransform> LookTransformRcPtr;
165    
166    class OCIOEXPORT MatrixTransform;
167    //!cpp:type::
168    typedef OCIO_SHARED_PTR<const MatrixTransform> ConstMatrixTransformRcPtr;
169    //!cpp:type::
170    typedef OCIO_SHARED_PTR<MatrixTransform> MatrixTransformRcPtr;
171    
172    class OCIOEXPORT TruelightTransform;
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    
189    enum LoggingLevel
190    {
191        LOGGING_LEVEL_NONE = 0,
192        LOGGING_LEVEL_WARNING = 1,
193        LOGGING_LEVEL_INFO = 2,
194        LOGGING_LEVEL_DEBUG = 3,
195        LOGGING_LEVEL_UNKNOWN = 255
196    };
197    
198    //!cpp:type::
199    enum ColorSpaceDirection
200    {
201        COLORSPACE_DIR_UNKNOWN = 0,
202        COLORSPACE_DIR_TO_REFERENCE,
203        COLORSPACE_DIR_FROM_REFERENCE
204    };
205    
206    //!cpp:type::
207    enum TransformDirection
208    {
209        TRANSFORM_DIR_UNKNOWN = 0,
210        TRANSFORM_DIR_FORWARD,
211        TRANSFORM_DIR_INVERSE
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    
231    enum Interpolation
232    {
233        INTERP_UNKNOWN = 0,
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 {
242        BIT_DEPTH_UNKNOWN = 0,
243        BIT_DEPTH_UINT8,
244        BIT_DEPTH_UINT10,
245        BIT_DEPTH_UINT12,
246        BIT_DEPTH_UINT14,
247        BIT_DEPTH_UINT16,
248        BIT_DEPTH_UINT32,
249        BIT_DEPTH_F16,
250        BIT_DEPTH_F32
251    };
252    
253    //!cpp:type::
254    enum Allocation {
255        ALLOCATION_UNKNOWN = 0,
256        ALLOCATION_UNIFORM,
257        ALLOCATION_LG2
258    };
259    
260    //!cpp:type:: Used when there is a choice of hardware shader language.
261    enum GpuLanguage
262    {
263        GPU_LANGUAGE_UNKNOWN = 0,
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::
270    enum EnvironmentMode
271    {
272        ENV_ENVIRONMENT_UNKNOWN = 0,
273        ENV_ENVIRONMENT_LOAD_PREDEFINED,
274        ENV_ENVIRONMENT_LOAD_ALL
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::
292    extern OCIOEXPORT const char * TransformDirectionToString(TransformDirection dir);
293    //!cpp:function::
294    extern OCIOEXPORT TransformDirection TransformDirectionFromString(const char * s);
295    
296    //!cpp:function::
297    extern OCIOEXPORT TransformDirection GetInverseTransformDirection(TransformDirection dir);
298    //!cpp:function::
299    extern OCIOEXPORT TransformDirection CombineTransformDirections(TransformDirection d1,
300                                                                    TransformDirection d2);
301    
302    //!cpp:function::
303    extern OCIOEXPORT const char * ColorSpaceDirectionToString(ColorSpaceDirection dir);
304    //!cpp:function::
305    extern OCIOEXPORT ColorSpaceDirection ColorSpaceDirectionFromString(const char * s);
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::
322    extern OCIOEXPORT const char * InterpolationToString(Interpolation interp);
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::
332    extern OCIOEXPORT const char * EnvironmentModeToString(EnvironmentMode mode);
333    //!cpp:function::
334    extern OCIOEXPORT EnvironmentMode EnvironmentModeFromString(const char * s);
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}
407OCIO_NAMESPACE_EXIT
408
409#endif