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