ImfFlatImageIO.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_FLAT_IMAGE_IO_H
  6. #define INCLUDED_IMF_FLAT_IMAGE_IO_H
  7. //----------------------------------------------------------------------------
  8. //
  9. // Functions to load flat images from OpenEXR files
  10. // and to save flat images in OpenEXR files.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "ImfFlatImage.h"
  14. #include "ImfImageDataWindow.h"
  15. #include "ImfUtilExport.h"
  16. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  17. //
  18. // saveFlatImage (n, h, i, d) or
  19. // saveFlatImage (n, i)
  20. //
  21. // Saves image i in an OpenEXR file with name n. The file will be
  22. // tiled if the image has more than one level, or if a header, h, is
  23. // given and contains a tile description attribute; otherwise the
  24. // file will be scan-line based.
  25. //
  26. // If header h is given, then the channel list in h is replaced with
  27. // the channel list in i, and the levelMode and the levelRounding mode
  28. // fields of the tile description are replaced with the level mode
  29. // and the levelRounding mode of i. In addition, if the data window
  30. // source flag, d, is set to USE_IMAGE_DATA_WINDOW, then the data
  31. // window in the image is copied into the header; if d is set to
  32. // USE_HEADER_DATA_WINDOW, then the data window in the header is
  33. // replaced with the intersection of the original data window in the
  34. // header and the data window in the image. The modified header then
  35. // becomes the header of the image file.
  36. //
  37. IMFUTIL_EXPORT
  38. void
  39. saveFlatImage
  40. (const std::string &fileName,
  41. const Header &hdr,
  42. const FlatImage &img,
  43. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  44. IMFUTIL_EXPORT
  45. void
  46. saveFlatImage
  47. (const std::string &fileName,
  48. const FlatImage &img);
  49. //
  50. // loadFlatImage (n, h, i) or
  51. // loadFlatImage (n, i)
  52. //
  53. // Loads flat image i from the OpenEXR file with name n.
  54. //
  55. // If header h is given, then the header of the file is copied into h.
  56. //
  57. IMFUTIL_EXPORT
  58. void
  59. loadFlatImage
  60. (const std::string &fileName,
  61. Header &hdr,
  62. FlatImage &img);
  63. IMFUTIL_EXPORT
  64. void
  65. loadFlatImage
  66. (const std::string &fileName,
  67. FlatImage &img);
  68. //
  69. // saveFlatScanLineImage (n, h, i, d) or
  70. // saveFlatScanLineImage (n, i)
  71. //
  72. // Saves image i in a scan-line based flat OpenEXR file with file name n.
  73. //
  74. // If header h is given, then the channel list in h is replaced with
  75. // the channel list in i. In addition, if the data window source flag, d,
  76. // is set to USE_IMAGE_DATA_WINDOW, then the data window in the image is
  77. // copied into the header; if d is set to USE_HEADER_DATA_WINDOW, then
  78. // the data window in the header is replaced with the intersection of
  79. // the original data window in the header and the data window in the
  80. // image. The modified header then becomes the header of the image file.
  81. //
  82. IMFUTIL_EXPORT
  83. void
  84. saveFlatScanLineImage
  85. (const std::string &fileName,
  86. const Header &hdr,
  87. const FlatImage &img,
  88. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  89. IMFUTIL_EXPORT
  90. void
  91. saveFlatScanLineImage
  92. (const std::string &fileName,
  93. const FlatImage &img);
  94. //
  95. // loadFlatScanLineImage (n, h, i) or
  96. // loadFlatScanLineImage (n, i)
  97. //
  98. // Loads image i from a scan-line based flat OpenEXR file with file name n.
  99. // If header h is given, then the header of the file is copied into h.
  100. //
  101. IMFUTIL_EXPORT
  102. void
  103. loadFlatScanLineImage
  104. (const std::string &fileName,
  105. Header &hdr,
  106. FlatImage &img);
  107. IMFUTIL_EXPORT
  108. void
  109. loadFlatScanLineImage
  110. (const std::string &fileName,
  111. FlatImage &img);
  112. //
  113. // saveFlatTiledImage (n, h, i, d) or
  114. // saveFlatTiledImage (n, i)
  115. //
  116. // Saves image i in a tiled flat OpenEXR file with file name n.
  117. //
  118. // If header h is given, then the channel list in h is replaced with
  119. // the channel list i, and the levelMode and the levelRounding mode
  120. // fields of the tile description are replaced with the level mode
  121. // and the levelRounding mode of i. In addition, if the data window
  122. // source flag, d, is set to USE_IMAGE_DATA_WINDOW, then the data
  123. // window in the image is copied into the header; if d is set to
  124. // USE_HEADER_DATA_WINDOW, then the data window in the header is
  125. // replaced with the intersection of the original data window in the
  126. // header and the data window in the image. The modified header then
  127. // becomes the header of the image file.
  128. //
  129. // Note: USE_HEADER_DATA_WINDOW can only be used for images with
  130. // level mode ONE_LEVEL.
  131. //
  132. IMFUTIL_EXPORT
  133. void
  134. saveFlatTiledImage
  135. (const std::string &fileName,
  136. const Header &hdr,
  137. const FlatImage &img,
  138. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  139. IMFUTIL_EXPORT
  140. void
  141. saveFlatTiledImage
  142. (const std::string &fileName,
  143. const FlatImage &img);
  144. //
  145. // loadFlatTiledImage (n, h, i) or
  146. // loadFlatTiledImage (n, i)
  147. //
  148. // Loads image i from a tiled flat OpenEXR file with file name n.
  149. // If header h is given, then the header of the file is copied into h.
  150. //
  151. IMFUTIL_EXPORT
  152. void
  153. loadFlatTiledImage
  154. (const std::string &fileName,
  155. Header &hdr,
  156. FlatImage &img);
  157. IMFUTIL_EXPORT
  158. void
  159. loadFlatTiledImage
  160. (const std::string &fileName,
  161. FlatImage &img);
  162. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  163. #endif