/src/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 164 lines · 28 code · 25 blank · 111 comment · 0 complexity · 52af2693d7e2b24ad2cf06f4411a8fa5 MD5 · raw file

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2007, Weta Digital Ltd
  4. //
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are
  9. // met:
  10. // * Redistributions of source code must retain the above copyright
  11. // notice, this list of conditions and the following disclaimer.
  12. // * Redistributions in binary form must reproduce the above
  13. // copyright notice, this list of conditions and the following disclaimer
  14. // in the documentation and/or other materials provided with the
  15. // distribution.
  16. // * Neither the name of Weta Digital nor the names of
  17. // its contributors may be used to endorse or promote products derived
  18. // from this software without specific prior written permission.
  19. //
  20. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. //
  32. ///////////////////////////////////////////////////////////////////////////
  33. #ifndef INCLUDED_IMF_MULTIVIEW_H
  34. #define INCLUDED_IMF_MULTIVIEW_H
  35. #include <ImfChannelList.h>
  36. #include <ImfStringVectorAttribute.h>
  37. //-----------------------------------------------------------------------------
  38. //
  39. // Functions related to accessing channels and views in multi-view
  40. // OpenEXR files.
  41. //
  42. // A multi-view image file contains two or more views of the same
  43. // scene, as seen from different viewpoints, for example, a left-eye
  44. // and a right-eye view for stereo displays. Each view has its own
  45. // set of image channels. A naming convention identifies the channels
  46. // that belong to a given view.
  47. //
  48. // A "multiView" attribute in the file header lists the names of the
  49. // views in an image (see ImfStandardAttributes.h), and channel names
  50. // of the form
  51. //
  52. // layer.view.channel
  53. //
  54. // allow channels to be matched with views.
  55. //
  56. // For compatibility with singe-view images, the first view listed in
  57. // the multiView attribute is the "default view", and channels that
  58. // have no periods in their names are considered part of the default
  59. // view.
  60. //
  61. // For example, if a file's multiView attribute lists the views
  62. // "left" and "right", in that order, then "left" is the default
  63. // view. Channels
  64. //
  65. // "R", "left.Z", "diffuse.left.R"
  66. //
  67. // are part of the "left" view; channels
  68. //
  69. // "right.R", "right.Z", "diffuse.right.R"
  70. //
  71. // are part of the "right" view; and channels
  72. //
  73. // "tmp.R", "right.diffuse.R", "diffuse.tmp.R"
  74. //
  75. // belong to no view at all.
  76. //
  77. //-----------------------------------------------------------------------------
  78. namespace Imf {
  79. //
  80. // Return the name of the default view given a multi-view string vector,
  81. // that is, return the first element of the string vector. If the string
  82. // vector is empty, return "".
  83. //
  84. std::string defaultViewName (const StringVector &multiView);
  85. //
  86. // Given the name of a channel, return the name of the view to
  87. // which it belongs. Returns the empty string ("") if the channel
  88. // is not a member of any named view.
  89. //
  90. std::string viewFromChannelName (const std::string &channel,
  91. const StringVector &multiView);
  92. //
  93. // Return whether channel1 and channel2 are the same channel but
  94. // viewed in different views. (Return false if either channel
  95. // belongs to no view or if both channels belong to the same view.)
  96. //
  97. bool areCounterparts (const std::string &channel1,
  98. const std::string &channel2,
  99. const StringVector &multiView);
  100. //
  101. // Return a list of all channels belonging to view viewName.
  102. //
  103. ChannelList channelsInView (const std::string &viewName,
  104. const ChannelList &channelList,
  105. const StringVector &multiView);
  106. //
  107. // Return a list of channels not associated with any view.
  108. //
  109. ChannelList channelsInNoView (const ChannelList &channelList,
  110. const StringVector &multiView);
  111. //
  112. // Given the name of a channel, return a list of the same channel
  113. // in all views (for example, given X.left.Y return X.left.Y,
  114. // X.right.Y, X.centre.Y, etc.).
  115. //
  116. ChannelList channelInAllViews (const std::string &channame,
  117. const ChannelList &channelList,
  118. const StringVector &multiView);
  119. //
  120. // Given the name of a channel in one view, return the corresponding
  121. // channel name for view otherViewName. Return "" if no corresponding
  122. // channel exists in view otherViewName, or if view otherViewName doesn't
  123. // exist.
  124. //
  125. std::string channelInOtherView (const std::string &channel,
  126. const ChannelList &channelList,
  127. const StringVector &multiView,
  128. const std::string &otherViewName);
  129. //
  130. // Given a channel name that does not include a view name, insert
  131. // multiView[i] into the channel name at the appropriate location.
  132. // If i is zero and the channel name contains no periods, then do
  133. // not insert the view name.
  134. //
  135. std::string insertViewName (const std::string &channel,
  136. const StringVector &multiView,
  137. int i);
  138. } // namespace Imf
  139. #endif