HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfImageLevel.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2014, 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 #ifndef INCLUDED_IMF_IMAGE_LEVEL_H
36 #define INCLUDED_IMF_IMAGE_LEVEL_H
37 
38 //----------------------------------------------------------------------------
39 //
40 // class ImageLevel
41 //
42 // For an explanation of images, levels and channels,
43 // see the comments in header file Image.h.
44 //
45 //----------------------------------------------------------------------------
46 
47 #include <ImfImageChannel.h>
49 #include <ImathBox.h>
50 #include <string>
51 #include "ImfExport.h"
52 
54 
55 class Image;
56 
57 
59 {
60  public:
61 
62  //
63  // Access to the image to which the level belongs.
64  //
65 
66  Image & image () {return _image;}
67  const Image & image () const {return _image;}
68 
69 
70  //
71  // Access to the level number and the data window of this level.
72  //
73 
74  int xLevelNumber () const {return _xLevelNumber;}
75  int yLevelNumber () const {return _yLevelNumber;}
76 
77  const IMATH_NAMESPACE::Box2i & dataWindow () const {return _dataWindow;}
78 
79 
80  protected:
81 
82  friend class Image;
83 
85  int xLevelNumber,
86  int yLevelNumber);
87 
88  virtual ~ImageLevel ();
89 
90  virtual void resize (const IMATH_NAMESPACE::Box2i& dataWindow);
91 
92  virtual void shiftPixels (int dx, int dy);
93 
94  virtual void insertChannel (const std::string& name,
96  int xSampling,
97  int ySampling,
98  bool pLinear) = 0;
99 
100  virtual void eraseChannel (const std::string& name) = 0;
101 
102  virtual void clearChannels () = 0;
103 
104  virtual void renameChannel (const std::string &oldName,
105  const std::string &newName) = 0;
106 
107  virtual void renameChannels (const RenamingMap &oldToNewNames) = 0;
108 
109  IMF_EXPORT void throwChannelExists(const std::string& name) const;
110  IMF_EXPORT void throwBadChannelName(const std::string& name) const;
112 
113  private:
114 
115  ImageLevel (const ImageLevel &); // not implemented
116  ImageLevel & operator = (const ImageLevel &); // not implemented
117 
118  Image & _image;
119  int _xLevelNumber;
120  int _yLevelNumber;
121  IMATH_NAMESPACE::Box2i _dataWindow;
122 };
123 
124 
126 
127 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
int yLevelNumber() const
Definition: ImfImageLevel.h:75
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
int xLevelNumber() const
Definition: ImfImageLevel.h:74
ImageLevel(Image &image, int xLevelNumber, int yLevelNumber)
virtual void clearChannels()=0
virtual void shiftPixels(int dx, int dy)
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER typedef std::map< std::string, std::string > RenamingMap
IMF_EXPORT void throwBadChannelNameOrType(const std::string &name) const
Image & image()
Definition: ImfImageLevel.h:66
Box< V2i > Box2i
Definition: ImathBox.h:133
virtual void renameChannel(const std::string &oldName, const std::string &newName)=0
PixelType
Definition: ImfPixelType.h:51
const Image & image() const
Definition: ImfImageLevel.h:67
IMF_EXPORT void throwChannelExists(const std::string &name) const
#define IMF_EXPORT
Definition: ImfExport.h:59
virtual void renameChannels(const RenamingMap &oldToNewNames)=0
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual ~ImageLevel()
virtual void insertChannel(const std::string &name, PixelType type, int xSampling, int ySampling, bool pLinear)=0
virtual void resize(const IMATH_NAMESPACE::Box2i &dataWindow)
virtual void eraseChannel(const std::string &name)=0
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
IMF_EXPORT void throwBadChannelName(const std::string &name) const
const IMATH_NAMESPACE::Box2i & dataWindow() const
Definition: ImfImageLevel.h:77