ImfImageLevel.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_IMAGE_LEVEL_H
  6. #define INCLUDED_IMF_IMAGE_LEVEL_H
  7. //----------------------------------------------------------------------------
  8. //
  9. // class ImageLevel
  10. //
  11. // For an explanation of images, levels and channels,
  12. // see the comments in header file Image.h.
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "ImfUtilExport.h"
  16. #include "ImfImageChannel.h"
  17. #include "ImfImageChannelRenaming.h"
  18. #include <ImathBox.h>
  19. #include <string>
  20. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  21. class Image;
  22. class IMFUTIL_EXPORT_TYPE ImageLevel
  23. {
  24. public:
  25. //
  26. // Access to the image to which the level belongs.
  27. //
  28. Image & image () {return _image;}
  29. const Image & image () const {return _image;}
  30. //
  31. // Access to the level number and the data window of this level.
  32. //
  33. int xLevelNumber () const {return _xLevelNumber;}
  34. int yLevelNumber () const {return _yLevelNumber;}
  35. const IMATH_NAMESPACE::Box2i & dataWindow () const {return _dataWindow;}
  36. protected:
  37. friend class Image;
  38. IMFUTIL_EXPORT
  39. ImageLevel (Image& image,
  40. int xLevelNumber,
  41. int yLevelNumber);
  42. IMFUTIL_EXPORT
  43. virtual ~ImageLevel ();
  44. IMFUTIL_EXPORT
  45. virtual void resize (const IMATH_NAMESPACE::Box2i& dataWindow);
  46. IMFUTIL_EXPORT
  47. virtual void shiftPixels (int dx, int dy);
  48. virtual void insertChannel (const std::string& name,
  49. PixelType type,
  50. int xSampling,
  51. int ySampling,
  52. bool pLinear) = 0;
  53. virtual void eraseChannel (const std::string& name) = 0;
  54. virtual void clearChannels () = 0;
  55. virtual void renameChannel (const std::string &oldName,
  56. const std::string &newName) = 0;
  57. virtual void renameChannels (const RenamingMap &oldToNewNames) = 0;
  58. IMFUTIL_EXPORT
  59. void throwChannelExists(const std::string& name) const;
  60. IMFUTIL_EXPORT
  61. void throwBadChannelName(const std::string& name) const;
  62. IMFUTIL_EXPORT
  63. void throwBadChannelNameOrType (const std::string& name) const;
  64. private:
  65. ImageLevel (const ImageLevel &); // not implemented
  66. ImageLevel & operator = (const ImageLevel &); // not implemented
  67. Image & _image;
  68. int _xLevelNumber;
  69. int _yLevelNumber;
  70. IMATH_NAMESPACE::Box2i _dataWindow;
  71. };
  72. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  73. #endif