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 "IexBaseExc.h"
21 #include "ImfChannelList.h"
22 #include "ImfFrameBuffer.h"
23 #include "ImfPixelType.h"
24 #include <ImathBox.h>
25 #include <half.h>
26 
27 #include <cstring>
28 #include <typeinfo>
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  // The OpenEXR pixel type of this channel (HALF, FLOAT or UINT).
49  //
50 
51  virtual PixelType pixelType () const = 0;
52 
53  //
54  // Generate an OpenEXR channel for this image channel.
55  //
56 
58  Channel channel () const;
59 
60  //
61  // Access to x and y sampling rates, "perceptually linear" flag,
62  // and the number of pixels that are stored in this channel.
63  //
64 
65  int xSampling () const { return _xSampling; }
66  int ySampling () const { return _ySampling; }
67  bool pLinear () const { return _pLinear; }
68  int pixelsPerRow () const { return _pixelsPerRow; }
69  int pixelsPerColumn () const { return _pixelsPerColumn; }
70  size_t numPixels () const { return _numPixels; }
71 
72  //
73  // Access to the image level to which this channel belongs.
74  //
75 
76  ImageLevel& level () { return _level; }
77  const ImageLevel& level () const { return _level; }
78 
79 protected:
81  ImageChannel (
82  ImageLevel& level, int xSampling, int ySampling, bool pLinear);
83 
85  virtual ~ImageChannel ();
86 
88  virtual void resize ();
89 
91  void boundsCheck (int x, int y) const;
92 
93 private:
94  ImageChannel (const ImageChannel&) = delete;
95  ImageChannel& operator= (const ImageChannel&) = delete;
96  ImageChannel (ImageChannel&&) = delete;
98 
99  ImageLevel& _level;
100  int _xSampling;
101  int _ySampling;
102  bool _pLinear;
103  int _pixelsPerRow;
104  int _pixelsPerColumn;
105  size_t _numPixels;
106 };
107 
109 
110 #endif
ImageLevel & level()
int pixelsPerColumn() const
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
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:20
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)
LeafData & operator=(const LeafData &)=delete
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:80