ImfStandardAttributes.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
  4. // Digital Ltd. LLC
  5. //
  6. // All rights reserved.
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions are
  10. // met:
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Industrial Light & Magic nor the names of
  18. // its contributors may be used to endorse or promote products derived
  19. // from this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. //
  33. ///////////////////////////////////////////////////////////////////////////
  34. //-----------------------------------------------------------------------------
  35. //
  36. // Optional Standard Attributes
  37. //
  38. //-----------------------------------------------------------------------------
  39. #include <ImfStandardAttributes.h>
  40. #define IMF_STRING(name) #name
  41. #define IMF_STD_ATTRIBUTE_IMP(name,suffix,type) \
  42. \
  43. void \
  44. add##suffix (Header &header, const type &value) \
  45. { \
  46. header.insert (IMF_STRING (name), TypedAttribute<type> (value)); \
  47. } \
  48. \
  49. bool \
  50. has##suffix (const Header &header) \
  51. { \
  52. return header.findTypedAttribute <TypedAttribute <type> > \
  53. (IMF_STRING (name)) != 0; \
  54. } \
  55. \
  56. const TypedAttribute<type> & \
  57. name##Attribute (const Header &header) \
  58. { \
  59. return header.typedAttribute <TypedAttribute <type> > \
  60. (IMF_STRING (name)); \
  61. } \
  62. \
  63. TypedAttribute<type> & \
  64. name##Attribute (Header &header) \
  65. { \
  66. return header.typedAttribute <TypedAttribute <type> > \
  67. (IMF_STRING (name)); \
  68. } \
  69. \
  70. const type & \
  71. name (const Header &header) \
  72. { \
  73. return name##Attribute(header).value(); \
  74. } \
  75. \
  76. type & \
  77. name (Header &header) \
  78. { \
  79. return name##Attribute(header).value(); \
  80. }
  81. #include "ImfNamespace.h"
  82. using namespace IMATH_NAMESPACE;
  83. using namespace std;
  84. OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
  85. IMF_STD_ATTRIBUTE_IMP (chromaticities, Chromaticities, Chromaticities)
  86. IMF_STD_ATTRIBUTE_IMP (whiteLuminance, WhiteLuminance, float)
  87. IMF_STD_ATTRIBUTE_IMP (adoptedNeutral, AdoptedNeutral, V2f)
  88. IMF_STD_ATTRIBUTE_IMP (renderingTransform, RenderingTransform, string)
  89. IMF_STD_ATTRIBUTE_IMP (lookModTransform, LookModTransform, string)
  90. IMF_STD_ATTRIBUTE_IMP (xDensity, XDensity, float)
  91. IMF_STD_ATTRIBUTE_IMP (owner, Owner, string)
  92. IMF_STD_ATTRIBUTE_IMP (comments, Comments, string)
  93. IMF_STD_ATTRIBUTE_IMP (capDate, CapDate, string)
  94. IMF_STD_ATTRIBUTE_IMP (utcOffset, UtcOffset, float)
  95. IMF_STD_ATTRIBUTE_IMP (longitude, Longitude, float)
  96. IMF_STD_ATTRIBUTE_IMP (latitude, Latitude, float)
  97. IMF_STD_ATTRIBUTE_IMP (altitude, Altitude, float)
  98. IMF_STD_ATTRIBUTE_IMP (focus, Focus, float)
  99. IMF_STD_ATTRIBUTE_IMP (expTime, ExpTime, float)
  100. IMF_STD_ATTRIBUTE_IMP (aperture, Aperture, float)
  101. IMF_STD_ATTRIBUTE_IMP (isoSpeed, IsoSpeed, float)
  102. IMF_STD_ATTRIBUTE_IMP (envmap, Envmap, Envmap)
  103. IMF_STD_ATTRIBUTE_IMP (keyCode, KeyCode, KeyCode)
  104. IMF_STD_ATTRIBUTE_IMP (timeCode, TimeCode, TimeCode)
  105. IMF_STD_ATTRIBUTE_IMP (wrapmodes, Wrapmodes, string)
  106. IMF_STD_ATTRIBUTE_IMP (framesPerSecond, FramesPerSecond, Rational)
  107. IMF_STD_ATTRIBUTE_IMP (multiView, MultiView, StringVector)
  108. IMF_STD_ATTRIBUTE_IMP (worldToCamera, WorldToCamera, M44f)
  109. IMF_STD_ATTRIBUTE_IMP (worldToNDC, WorldToNDC, M44f)
  110. IMF_STD_ATTRIBUTE_IMP (deepImageState, DeepImageState, DeepImageState)
  111. IMF_STD_ATTRIBUTE_IMP (originalDataWindow, OriginalDataWindow, Box2i)
  112. IMF_STD_ATTRIBUTE_IMP (dwaCompressionLevel, DwaCompressionLevel, float)
  113. OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT