HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfImageChannel.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_CHANNEL_H
36 #define INCLUDED_IMF_IMAGE_CHANNEL_H
37 
38 //----------------------------------------------------------------------------
39 //
40 // class ImageChannel
41 //
42 // For an explanation of images, levels and channels,
43 // see the comments in header file Image.h.
44 //
45 //----------------------------------------------------------------------------
46 
47 #include "ImfUtilExport.h"
48 
49 #include <ImfPixelType.h>
50 #include <ImfFrameBuffer.h>
51 #include <ImfChannelList.h>
52 #include <ImathBox.h>
53 #include <half.h>
54 
56 
57 class ImageLevel;
58 
59 //
60 // Image channels:
61 //
62 // An image channel holds the pixel data for a single channel of one level
63 // of an image. Separate classes for flat and deep channels are derived
64 // from the ImageChannel base class.
65 //
66 
67 class ImageLevel;
68 
70 {
71  public:
72 
73  //
74  // The OpenEXR pixel type of this channel (HALF, FLOAT or UINT).
75  //
76 
77  virtual PixelType pixelType () const = 0;
78 
79  //
80  // Generate an OpenEXR channel for this image channel.
81  //
82 
84  Channel channel () const;
85 
86 
87  //
88  // Access to x and y sampling rates, "perceptually linear" flag,
89  // and the number of pixels that are stored in this channel.
90  //
91 
92  int xSampling () const {return _xSampling;}
93  int ySampling () const {return _ySampling;}
94  bool pLinear () const {return _pLinear;}
95  int pixelsPerRow () const {return _pixelsPerRow;}
96  int pixelsPerColumn () const {return _pixelsPerColumn;}
97  size_t numPixels () const {return _numPixels;}
98 
99 
100  //
101  // Access to the image level to which this channel belongs.
102  //
103 
104  ImageLevel & level () {return _level;}
105  const ImageLevel & level () const {return _level;}
106 
107  protected:
108 
111  int xSampling,
112  int ySampling,
113  bool pLinear);
114 
116  virtual ~ImageChannel();
117 
119  virtual void resize ();
120 
122  void boundsCheck(int x, int y) const;
123 
124  private:
125 
126  ImageChannel (const ImageChannel &); // not implemented
127  ImageChannel & operator = (const ImageChannel &); // not implemented
128 
129  ImageLevel & _level;
130  int _xSampling;
131  int _ySampling;
132  bool _pLinear;
133  int _pixelsPerRow;
134  int _pixelsPerColumn;
135  size_t _numPixels;
136 };
137 
138 
140 
141 #endif
ImageLevel & level()
IMFUTIL_EXPORT ImageChannel(ImageLevel &level, int xSampling, int ySampling, bool pLinear)
int pixelsPerColumn() const
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
int pixelsPerRow() const
int ySampling() const
virtual PixelType pixelType() const =0
virtual IMFUTIL_EXPORT ~ImageChannel()
size_t numPixels() const
#define IMFUTIL_EXPORT
Definition: ImfUtilExport.h:44
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
PixelType
Definition: ImfPixelType.h:51
bool pLinear() const
const ImageLevel & level() const
int xSampling() const
virtual IMFUTIL_EXPORT void resize()
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108
IMFUTIL_EXPORT void boundsCheck(int x, int y) const
IMFUTIL_EXPORT Channel channel() const
GLint level
Definition: glew.h:1252