/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. /*
  2. Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
  3. All Rights Reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. * Neither the name of Sony Pictures Imageworks nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef INCLUDED_OCIO_OPENCOLORTYPES_H
  28. #define INCLUDED_OCIO_OPENCOLORTYPES_H
  29. #include "OpenColorABI.h"
  30. #ifndef OCIO_NAMESPACE_ENTER
  31. #error This header cannot be used directly. Use <OpenColorIO/OpenColorIO.h> instead.
  32. #endif
  33. #include <limits>
  34. #include <string>
  35. /*!rst::
  36. C++ Types
  37. =========
  38. */
  39. OCIO_NAMESPACE_ENTER
  40. {
  41. // Predeclare all class ptr definitions
  42. //!rst::
  43. // Core
  44. // ****
  45. class OCIOEXPORT Config;
  46. //!cpp:type::
  47. typedef OCIO_SHARED_PTR<const Config> ConstConfigRcPtr;
  48. //!cpp:type::
  49. typedef OCIO_SHARED_PTR<Config> ConfigRcPtr;
  50. class OCIOEXPORT ColorSpace;
  51. //!cpp:type::
  52. typedef OCIO_SHARED_PTR<const ColorSpace> ConstColorSpaceRcPtr;
  53. //!cpp:type::
  54. typedef OCIO_SHARED_PTR<ColorSpace> ColorSpaceRcPtr;
  55. class OCIOEXPORT Look;
  56. //!cpp:type::
  57. typedef OCIO_SHARED_PTR<const Look> ConstLookRcPtr;
  58. //!cpp:type::
  59. typedef OCIO_SHARED_PTR<Look> LookRcPtr;
  60. class OCIOEXPORT Context;
  61. //!cpp:type::
  62. typedef OCIO_SHARED_PTR<const Context> ConstContextRcPtr;
  63. //!cpp:type::
  64. typedef OCIO_SHARED_PTR<Context> ContextRcPtr;
  65. class OCIOEXPORT Processor;
  66. //!cpp:type::
  67. typedef OCIO_SHARED_PTR<const Processor> ConstProcessorRcPtr;
  68. //!cpp:type::
  69. typedef OCIO_SHARED_PTR<Processor> ProcessorRcPtr;
  70. class OCIOEXPORT ProcessorMetadata;
  71. //!cpp:type::
  72. typedef OCIO_SHARED_PTR<const ProcessorMetadata> ConstProcessorMetadataRcPtr;
  73. //!cpp:type::
  74. typedef OCIO_SHARED_PTR<ProcessorMetadata> ProcessorMetadataRcPtr;
  75. class OCIOEXPORT Baker;
  76. //!cpp:type::
  77. typedef OCIO_SHARED_PTR<const Baker> ConstBakerRcPtr;
  78. //!cpp:type::
  79. typedef OCIO_SHARED_PTR<Baker> BakerRcPtr;
  80. class OCIOEXPORT ImageDesc;
  81. class OCIOEXPORT GpuShaderDesc;
  82. class OCIOEXPORT Exception;
  83. //!rst::
  84. // Transforms
  85. // **********
  86. class OCIOEXPORT Transform;
  87. //!cpp:type::
  88. typedef OCIO_SHARED_PTR<const Transform> ConstTransformRcPtr;
  89. //!cpp:type::
  90. typedef OCIO_SHARED_PTR<Transform> TransformRcPtr;
  91. class OCIOEXPORT AllocationTransform;
  92. //!cpp:type::
  93. typedef OCIO_SHARED_PTR<const AllocationTransform> ConstAllocationTransformRcPtr;
  94. //!cpp:type::
  95. typedef OCIO_SHARED_PTR<AllocationTransform> AllocationTransformRcPtr;
  96. class OCIOEXPORT CDLTransform;
  97. //!cpp:type::
  98. typedef OCIO_SHARED_PTR<const CDLTransform> ConstCDLTransformRcPtr;
  99. //!cpp:type::
  100. typedef OCIO_SHARED_PTR<CDLTransform> CDLTransformRcPtr;
  101. class OCIOEXPORT ColorSpaceTransform;
  102. //!cpp:type::
  103. typedef OCIO_SHARED_PTR<const ColorSpaceTransform> ConstColorSpaceTransformRcPtr;
  104. //!cpp:type::
  105. typedef OCIO_SHARED_PTR<ColorSpaceTransform> ColorSpaceTransformRcPtr;
  106. class OCIOEXPORT DisplayTransform;
  107. //!cpp:type::
  108. typedef OCIO_SHARED_PTR<const DisplayTransform> ConstDisplayTransformRcPtr;
  109. //!cpp:type::
  110. typedef OCIO_SHARED_PTR<DisplayTransform> DisplayTransformRcPtr;
  111. class OCIOEXPORT ExponentTransform;
  112. //!cpp:type::
  113. typedef OCIO_SHARED_PTR<const ExponentTransform> ConstExponentTransformRcPtr;
  114. //!cpp:type::
  115. typedef OCIO_SHARED_PTR<ExponentTransform> ExponentTransformRcPtr;
  116. class OCIOEXPORT FileTransform;
  117. //!cpp:type::
  118. typedef OCIO_SHARED_PTR<const FileTransform> ConstFileTransformRcPtr;
  119. //!cpp:type::
  120. typedef OCIO_SHARED_PTR<FileTransform> FileTransformRcPtr;
  121. class OCIOEXPORT GroupTransform;
  122. //!cpp:type::
  123. typedef OCIO_SHARED_PTR<const GroupTransform> ConstGroupTransformRcPtr;
  124. //!cpp:type::
  125. typedef OCIO_SHARED_PTR<GroupTransform> GroupTransformRcPtr;
  126. class OCIOEXPORT LogTransform;
  127. //!cpp:type::
  128. typedef OCIO_SHARED_PTR<const LogTransform> ConstLogTransformRcPtr;
  129. //!cpp:type::
  130. typedef OCIO_SHARED_PTR<LogTransform> LogTransformRcPtr;
  131. class OCIOEXPORT LookTransform;
  132. //!cpp:type::
  133. typedef OCIO_SHARED_PTR<const LookTransform> ConstLookTransformRcPtr;
  134. //!cpp:type::
  135. typedef OCIO_SHARED_PTR<LookTransform> LookTransformRcPtr;
  136. class OCIOEXPORT MatrixTransform;
  137. //!cpp:type::
  138. typedef OCIO_SHARED_PTR<const MatrixTransform> ConstMatrixTransformRcPtr;
  139. //!cpp:type::
  140. typedef OCIO_SHARED_PTR<MatrixTransform> MatrixTransformRcPtr;
  141. class OCIOEXPORT TruelightTransform;
  142. //!cpp:type::
  143. typedef OCIO_SHARED_PTR<const TruelightTransform> ConstTruelightTransformRcPtr;
  144. //!cpp:type::
  145. typedef OCIO_SHARED_PTR<TruelightTransform> TruelightTransformRcPtr;
  146. template <class T, class U>
  147. inline OCIO_SHARED_PTR<T> DynamicPtrCast(OCIO_SHARED_PTR<U> const & ptr)
  148. {
  149. return OCIO_DYNAMIC_POINTER_CAST<T,U>(ptr);
  150. }
  151. //!rst::
  152. // Enums
  153. // *****
  154. enum LoggingLevel
  155. {
  156. LOGGING_LEVEL_NONE = 0,
  157. LOGGING_LEVEL_WARNING = 1,
  158. LOGGING_LEVEL_INFO = 2,
  159. LOGGING_LEVEL_DEBUG = 3,
  160. LOGGING_LEVEL_UNKNOWN = 255
  161. };
  162. //!cpp:type::
  163. enum ColorSpaceDirection
  164. {
  165. COLORSPACE_DIR_UNKNOWN = 0,
  166. COLORSPACE_DIR_TO_REFERENCE,
  167. COLORSPACE_DIR_FROM_REFERENCE
  168. };
  169. //!cpp:type::
  170. enum TransformDirection
  171. {
  172. TRANSFORM_DIR_UNKNOWN = 0,
  173. TRANSFORM_DIR_FORWARD,
  174. TRANSFORM_DIR_INVERSE
  175. };
  176. //!cpp:type::
  177. //
  178. // Specify the interpolation type to use
  179. // If the specified interpolation type is not supported in the requested
  180. // context (for example, using tetrahedral interpolationon 1D luts)
  181. // an exception will be throw.
  182. //
  183. // INTERP_BEST will choose the best interpolation type for the requested
  184. // context:
  185. //
  186. // Lut1D INTERP_BEST: LINEAR
  187. // Lut3D INTERP_BEST: LINEAR
  188. //
  189. // Note: INTERP_BEST is subject to change in minor releases, so if you
  190. // care about locking off on a specific interpolation type, we'd recommend
  191. // directly specifying it.
  192. enum Interpolation
  193. {
  194. INTERP_UNKNOWN = 0,
  195. INTERP_NEAREST = 1, //! nearest neighbor in all dimensions
  196. INTERP_LINEAR = 2, //! linear interpolation in all dimensions
  197. INTERP_TETRAHEDRAL = 3, //! tetrahedral interpolation in all directions
  198. INTERP_BEST = 255 //! the 'best' suitable interpolation type
  199. };
  200. //!cpp:type::
  201. enum BitDepth {
  202. BIT_DEPTH_UNKNOWN = 0,
  203. BIT_DEPTH_UINT8,
  204. BIT_DEPTH_UINT10,
  205. BIT_DEPTH_UINT12,
  206. BIT_DEPTH_UINT14,
  207. BIT_DEPTH_UINT16,
  208. BIT_DEPTH_UINT32,
  209. BIT_DEPTH_F16,
  210. BIT_DEPTH_F32
  211. };
  212. //!cpp:type::
  213. enum Allocation {
  214. ALLOCATION_UNKNOWN = 0,
  215. ALLOCATION_UNIFORM,
  216. ALLOCATION_LG2
  217. };
  218. //!cpp:type:: Used when there is a choice of hardware shader language.
  219. enum GpuLanguage
  220. {
  221. GPU_LANGUAGE_UNKNOWN = 0,
  222. GPU_LANGUAGE_CG, ///< Nvidia Cg shader
  223. GPU_LANGUAGE_GLSL_1_0, ///< OpenGL Shading Language
  224. GPU_LANGUAGE_GLSL_1_3 ///< OpenGL Shading Language
  225. };
  226. //!cpp:type::
  227. enum EnvironmentMode
  228. {
  229. ENV_ENVIRONMENT_UNKNOWN = 0,
  230. ENV_ENVIRONMENT_LOAD_PREDEFINED,
  231. ENV_ENVIRONMENT_LOAD_ALL
  232. };
  233. //!rst::
  234. // Conversion
  235. // **********
  236. //!cpp:function::
  237. extern OCIOEXPORT const char * BoolToString(bool val);
  238. //!cpp:function::
  239. extern OCIOEXPORT bool BoolFromString(const char * s);
  240. //!cpp:function::
  241. extern OCIOEXPORT const char * LoggingLevelToString(LoggingLevel level);
  242. //!cpp:function::
  243. extern OCIOEXPORT LoggingLevel LoggingLevelFromString(const char * s);
  244. //!cpp:function::
  245. extern OCIOEXPORT const char * TransformDirectionToString(TransformDirection dir);
  246. //!cpp:function::
  247. extern OCIOEXPORT TransformDirection TransformDirectionFromString(const char * s);
  248. //!cpp:function::
  249. extern OCIOEXPORT TransformDirection GetInverseTransformDirection(TransformDirection dir);
  250. //!cpp:function::
  251. extern OCIOEXPORT TransformDirection CombineTransformDirections(TransformDirection d1,
  252. TransformDirection d2);
  253. //!cpp:function::
  254. extern OCIOEXPORT const char * ColorSpaceDirectionToString(ColorSpaceDirection dir);
  255. //!cpp:function::
  256. extern OCIOEXPORT ColorSpaceDirection ColorSpaceDirectionFromString(const char * s);
  257. //!cpp:function::
  258. extern OCIOEXPORT const char * BitDepthToString(BitDepth bitDepth);
  259. //!cpp:function::
  260. extern OCIOEXPORT BitDepth BitDepthFromString(const char * s);
  261. //!cpp:function::
  262. extern OCIOEXPORT bool BitDepthIsFloat(BitDepth bitDepth);
  263. //!cpp:function::
  264. extern OCIOEXPORT int BitDepthToInt(BitDepth bitDepth);
  265. //!cpp:function::
  266. extern OCIOEXPORT const char * AllocationToString(Allocation allocation);
  267. //!cpp:function::
  268. extern OCIOEXPORT Allocation AllocationFromString(const char * s);
  269. //!cpp:function::
  270. extern OCIOEXPORT const char * InterpolationToString(Interpolation interp);
  271. //!cpp:function::
  272. extern OCIOEXPORT Interpolation InterpolationFromString(const char * s);
  273. //!cpp:function::
  274. extern OCIOEXPORT const char * GpuLanguageToString(GpuLanguage language);
  275. //!cpp:function::
  276. extern OCIOEXPORT GpuLanguage GpuLanguageFromString(const char * s);
  277. //!cpp:function::
  278. extern OCIOEXPORT const char * EnvironmentModeToString(EnvironmentMode mode);
  279. //!cpp:function::
  280. extern OCIOEXPORT EnvironmentMode EnvironmentModeFromString(const char * s);
  281. /*!rst::
  282. Roles
  283. *****
  284. ColorSpace Roles are used so that plugins, in addition to this API can have
  285. abstract ways of asking for common colorspaces, without referring to them
  286. by hardcoded names.
  287. Internal::
  288. GetGPUDisplayTransform - (ROLE_SCENE_LINEAR (fstop exposure))
  289. (ROLE_COLOR_TIMING (ASCColorCorrection))
  290. External Plugins (currently known)::
  291. Colorpicker UIs - (ROLE_COLOR_PICKING)
  292. Compositor LogConvert - (ROLE_SCENE_LINEAR, ROLE_COMPOSITING_LOG)
  293. */
  294. //!rst::
  295. // .. c:var:: const char* ROLE_DEFAULT
  296. //
  297. // "default"
  298. extern OCIOEXPORT const char * ROLE_DEFAULT;
  299. //!rst::
  300. // .. c:var:: const char* ROLE_REFERENCE
  301. //
  302. // "reference"
  303. extern OCIOEXPORT const char * ROLE_REFERENCE;
  304. //!rst::
  305. // .. c:var:: const char* ROLE_DATA
  306. //
  307. // "data"
  308. extern OCIOEXPORT const char * ROLE_DATA;
  309. //!rst::
  310. // .. c:var:: const char* ROLE_COLOR_PICKING
  311. //
  312. // "color_picking"
  313. extern OCIOEXPORT const char * ROLE_COLOR_PICKING;
  314. //!rst::
  315. // .. c:var:: const char* ROLE_SCENE_LINEAR
  316. //
  317. // "scene_linear"
  318. extern OCIOEXPORT const char * ROLE_SCENE_LINEAR;
  319. //!rst::
  320. // .. c:var:: const char* ROLE_COMPOSITING_LOG
  321. //
  322. // "compositing_log"
  323. extern OCIOEXPORT const char * ROLE_COMPOSITING_LOG;
  324. //!rst::
  325. // .. c:var:: const char* ROLE_COLOR_TIMING
  326. //
  327. // "color_timing"
  328. extern OCIOEXPORT const char * ROLE_COLOR_TIMING;
  329. //!rst::
  330. // .. c:var:: const char* ROLE_TEXTURE_PAINT
  331. //
  332. // This role defines the transform for painting textures. In some
  333. // workflows this is just a inverse display gamma with some limits
  334. extern OCIOEXPORT const char * ROLE_TEXTURE_PAINT;
  335. //!rst::
  336. // .. c:var:: const char* ROLE_MATTE_PAINT
  337. //
  338. // This role defines the transform for matte painting. In some workflows
  339. // this is a 1D HDR to LDR allocation. It is normally combined with
  340. // another display transform in the host app for preview.
  341. extern OCIOEXPORT const char * ROLE_MATTE_PAINT;
  342. }
  343. OCIO_NAMESPACE_EXIT
  344. #endif