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