HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_ImageLayer.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_ImageLayer_h__
10 #define __HOM_ImageLayer_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_BinaryString.h"
14 #include "HOM_BoundingRect.h"
15 #include "HOM_Defines.h"
16 #include "HOM_Errors.h"
17 #include "HOM_IterableList.h"
18 #include "HOM_EnumModules.h"
19 #include "HOM_Matrix4.h"
20 #include <UT/UT_Tuple.h>
21 #include <vector>
22 #include <string>
23 
24 SWIGOUT(%rename(ImageLayer) HOM_ImageLayer;)
25 // Force SWIG to output an __init__ method even though it determines this
26 // class is abstract.
27 SWIGOUT(%feature("notabstract") HOM_ImageLayer;)
28 
30 {
31 public:
32 #ifdef SWIG
33 %extend
34 {
36  { return HOM().newImageLayer(layer); }
37 }
38 #else
40  { HOM_CONSTRUCT_OBJECT(this) }
42  { HOM_CONSTRUCT_OBJECT(this) }
43 #endif
44  virtual ~HOM_ImageLayer()
45  { HOM_DESTRUCT_OBJECT(this) }
46 
47  virtual std::string __repr__() = 0;
48 
49  virtual HOM_ImageLayer *__enter__() { return this; }
50 
51 #ifdef SWIG
52 %extend
53 {
54  // We can ignore the type, value, and traceback Python objects.
55  SWIGOUT(virtual void __exit__(
56  InterpreterObject type, InterpreterObject value,
57  InterpreterObject traceback)
58  { self->close(); };)
59 }
60 #endif
61 
62  virtual void close() = 0;
63 
64  virtual HOM_EnumValue &storageType() const = 0;
65  virtual HOM_EnumValue &border() const = 0;
66  virtual HOM_EnumValue &typeInfo() const = 0;
67 
68  virtual void setStorageType(HOM_EnumValue &storagetype) = 0;
69  virtual void setBorder(HOM_EnumValue &storagetype) = 0;
70  virtual void setTypeInfo(HOM_EnumValue &storagetype) = 0;
71 
72  virtual int channelCount() const = 0;
73  virtual void setChannelCount(int chan) = 0;
74 
75  virtual std::vector<int> bufferResolution() const = 0;
76 
77  virtual bool onCPU() const = 0;
78  virtual bool onGPU() const = 0;
79  virtual bool isConstant() const = 0;
80  virtual bool storesIntegers() const = 0;
81 
82  virtual void makeConstant(std::vector<double> val) = 0;
83 
84  virtual HOM_BoundingRect dataWindow() const = 0;
85  virtual HOM_BoundingRect displayWindow() const = 0;
86  virtual double pixelAspectRatio() const = 0;
87  virtual std::vector<double> pixelScale() const = 0;
88 
89  virtual void setDataWindow(int x, int y, int w, int h) = 0;
90  virtual void setDisplayWindow(double x, double y, double w, double h) = 0;
91  virtual void setPixelAspectRatio(double aspect) = 0;
92  virtual void setPixelScale(std::vector<double> scale) = 0;
93 
94  /// Camera parameters
95  virtual HOM_EnumValue &projection() const = 0;
96  virtual double aperture() const = 0;
97  virtual double focalLength() const = 0;
98  virtual std::vector<double> cameraPosition() const = 0;
99  virtual double fStop() const = 0;
100  virtual std::vector<double> clippingRange() const = 0;
101  virtual double focusDistance() const = 0;
102  virtual std::vector<double> shutter() const = 0;
103 
104  virtual void setProjection(HOM_EnumValue &projection) = 0;
105  virtual void setAperture(double aperture) = 0;
106  virtual void setFocalLength(double focal) = 0;
107  virtual void setCameraPosition(std::vector<double> pos) = 0;
108  virtual void setFStop(double fstop) = 0;
109  virtual void setClippingRange(std::vector<double> range) = 0;
110  virtual void setFocusDistance(double focus) = 0;
111  virtual void setShutter(std::vector<double> shutter) = 0;
112 
113  virtual HOM_Matrix4 projectionTransform() const = 0;
114  virtual HOM_Matrix4 imageToWorldTransform() const = 0;
115 
116  virtual std::vector<double> imageToPixelScale() const = 0;
117  virtual std::vector<double> imageToPixelTranslate() const = 0;
118  virtual std::vector<double> imageToBufferScale() const = 0;
119  virtual std::vector<double> imageToBufferTranslate() const = 0;
120 
121  virtual std::vector<double> bufferToPixelScale() const = 0;
122  virtual std::vector<double> bufferToPixelTranslate() const = 0;
123 
124  virtual std::vector<double> textureToBufferScale() const = 0;
125  // Zero:
126  //virtual std::vector<double> textureToBufferTranslate() const = 0;
127 
128  // Space conversions
129  virtual std::vector<double> imageToPixel(std::vector<double> p) const = 0;
130  virtual std::vector<double> imageToBuffer(std::vector<double> p) const = 0;
131  virtual std::vector<double> imageToTexture(std::vector<double> p) const = 0;
132  virtual std::vector<double> pixelToImage(std::vector<double> p) const = 0;
133  virtual std::vector<double> pixelToBuffer(std::vector<double> p) const = 0;
134  virtual std::vector<double> pixelToTexture(std::vector<double> p) const = 0;
135  virtual std::vector<double> bufferToPixel(std::vector<double> p) const = 0;
136  virtual std::vector<double> bufferToImage(std::vector<double> p) const = 0;
137  virtual std::vector<double> bufferToTexture(std::vector<double> p) const = 0;
138  virtual std::vector<double> textureToPixel(std::vector<double> p) const = 0;
139  virtual std::vector<double> textureToImage(std::vector<double> p) const = 0;
140  virtual std::vector<double> textureToBuffer(std::vector<double> p) const = 0;
141  virtual std::vector<double> worldToBuffer(std::vector<double> p) const = 0;
142 
143  // retrieve pixel data
144 
145  virtual std::vector<float> bufferIndexV4(int x, int y) const = 0;
146  virtual int bufferIndexI(int x, int y) const = 0;
147  virtual hboost::any bufferIndex(int x, int y) const = 0;
148  virtual HOM_BinaryString bufferIndexRaw(int x, int y) const = 0;
149 
150  SWIGOUT(%newobject freeze;)
151  virtual HOM_ImageLayer *freeze() const = 0;
152  virtual bool isFrozen() const = 0;
153 
154  virtual std::map<std::string, hboost::any> attributes() const = 0;
155  virtual void setAttributes(const std::map<std::string, hboost::any> &p) = 0;
156  virtual void updateAttributes(const std::map<std::string, hboost::any> &p) = 0;
157 
158  virtual HOM_BinaryString allBufferElements() const = 0;
159  virtual HOM_BinaryString allBufferElements(HOM_EnumValue &storagetype, int channels) const = 0;
160 
161 #ifdef SWIG
162 %extend
163 {
164  void setAllBufferElements(InterpreterObject values)
165  {
166  HOM_PyBuffer buffer(values);
167  self->opaqueSetAllBufferElements(
168  (const char *)buffer.myData, buffer.myLength);
169  }
170 }
171 #endif
172 
173 #ifdef SWIG
174 %extend
175 {
176  void setAllBufferElements(InterpreterObject values, HOM_EnumValue &storagetype, int channels)
177  {
178  HOM_PyBuffer buffer(values);
179  self->opaqueSetAllBufferElements(
180  (const char *)buffer.myData, buffer.myLength,
181  storagetype, channels);
182  }
183 }
184 #endif
185 
186  SWIGOUT(%ignore opaqueSetAllBufferElements);
187  virtual void opaqueSetAllBufferElements(const char *values, int64 length,
188  HOM_EnumValue &storagetype, int channels) = 0;
189 
190  SWIGOUT(%ignore opaqueSetAllBufferElements);
191  virtual void opaqueSetAllBufferElements(const char *values, int64 length) = 0;
192 
193 };
194 
195 #endif
virtual HOM_ImageLayer * newImageLayer(HOM_ImageLayer *layer=nullptr)=0
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1343
GLenum GLint * range
Definition: glcorearb.h:1925
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
GLint y
Definition: glcorearb.h:103
HOM_ImageLayer(const HOM_ImageLayer &)
void close() override
GLuint buffer
Definition: glcorearb.h:660
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
GA_API const UT_StringHolder scale
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
bool any(const vbool4 &v)
Definition: simd.h:3600
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1342
long long int64
Definition: SYS_Types.h:116
virtual ~HOM_ImageLayer()
HUSD_API const char * pixelAspectRatio()
GLint GLenum GLint x
Definition: glcorearb.h:409
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
GLint GLint GLsizei GLint border
Definition: glcorearb.h:108
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
GLuint GLfloat * val
Definition: glcorearb.h:1608
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GLuint bufferIndex
Definition: glcorearb.h:2221
HOM_API HOM_Module & HOM()
virtual HOM_ImageLayer * __enter__()
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)