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 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_IMAGE_CHANNEL_H
7 #define INCLUDED_IMF_IMAGE_CHANNEL_H
8 
9 //----------------------------------------------------------------------------
10 //
11 // class ImageChannel
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 
20 #include "ImfPixelType.h"
21 #include "ImfFrameBuffer.h"
22 #include "ImfChannelList.h"
23 #include "IexBaseExc.h"
24 #include <ImathBox.h>
25 #include <half.h>
26 
27 #include <typeinfo>
28 #include <cstring>
29 
31 
32 class ImageLevel;
33 
34 //
35 // Image channels:
36 //
37 // An image channel holds the pixel data for a single channel of one level
38 // of an image. Separate classes for flat and deep channels are derived
39 // from the ImageChannel base class.
40 //
41 
42 class ImageLevel;
43 
45 {
46  public:
47 
48  //
49  // The OpenEXR pixel type of this channel (HALF, FLOAT or UINT).
50  //
51 
52  virtual PixelType pixelType () const = 0;
53 
54  //
55  // Generate an OpenEXR channel for this image channel.
56  //
57 
59  Channel channel () const;
60 
61 
62  //
63  // Access to x and y sampling rates, "perceptually linear" flag,
64  // and the number of pixels that are stored in this channel.
65  //
66 
67  int xSampling () const {return _xSampling;}
68  int ySampling () const {return _ySampling;}
69  bool pLinear () const {return _pLinear;}
70  int pixelsPerRow () const {return _pixelsPerRow;}
71  int pixelsPerColumn () const {return _pixelsPerColumn;}
72  size_t numPixels () const {return _numPixels;}
73 
74 
75  //
76  // Access to the image level to which this channel belongs.
77  //
78 
79  ImageLevel & level () {return _level;}
80  const ImageLevel & level () const {return _level;}
81 
82  protected:
83 
86  int xSampling,
87  int ySampling,
88  bool pLinear);
89 
91  virtual ~ImageChannel();
92 
94  virtual void resize ();
95 
97  void boundsCheck(int x, int y) const;
98 
99  private:
100 
101  ImageChannel (const ImageChannel &) = delete;
102  ImageChannel & operator = (const ImageChannel &) = delete;
103  ImageChannel (ImageChannel &&) = delete;
104  ImageChannel & operator = (ImageChannel &&) = delete;
105 
106  ImageLevel & _level;
107  int _xSampling;
108  int _ySampling;
109  bool _pLinear;
110  int _pixelsPerRow;
111  int _pixelsPerColumn;
112  size_t _numPixels;
113 };
114 
115 
117 
118 #endif
ImageLevel & level()
int pixelsPerColumn() const
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:80
int pixelsPerRow() const
int ySampling() const
GLint level
Definition: glcorearb.h:108
GLint y
Definition: glcorearb.h:103
size_t numPixels() const
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER enum IMF_EXPORT_ENUM PixelType
Definition: ImfPixelType.h:22
bool pLinear() const
#define IMFUTIL_EXPORT_TYPE
Definition: ImfUtilExport.h:54
const ImageLevel & level() const
int xSampling() const
#define IMFUTIL_EXPORT
Definition: ImfUtilExport.h:51
GLint GLenum GLint x
Definition: glcorearb.h:409
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:79