Mako 8.2.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
iimagecodec.h
Go to the documentation of this file.
1/*
2* Copyright (C) 2007-2025 Global Graphics Software Ltd. All rights reserved.
3*/
4
10
11#ifndef IIMAGECODEC_H
12#define IIMAGECODEC_H
13
14#include <edl/edlfwd.h>
15#include <edl/idomcolorspace.h>
16#include <edl/isession.h>
17#include <edl/edlstream.h>
18#include <edl/edlgeom.h>
19#include <edl/iedlobject.h>
20#include <edl/idomresources.h>
21#include <edl/edlsimplebuffer.h>
22
24
25
40
46class IImageFrame : public IEDLObject
47{
48 public:
49 virtual ~IImageFrame ()
50 {}
51
56 virtual uint32 getWidth () const = 0;
57
62 virtual uint32 getHeight () const = 0;
63
68 virtual uint8 getBPS () const = 0;
69
70
75 virtual IDOMColorSpacePtr getColorSpace () const = 0;
76
77
83
84
89 virtual uint8 getNumExtraChannels () const
90 {
92
93 return (channelType == eIECNone) ? 0 : 1;
94 }
95
96
101 virtual uint8 getNumChannels () const
102 {
103 return getNumExtraChannels () + getColorSpace()->getNumComponents();
104 }
105
106
111
112 virtual bool getHasAlphaChannel () const
113 {
114 return (getExtraChannelType () == eIECAlpha ||
116 }
117
118
119#ifdef SWIG
120 %apply bool &OUTPUT { bool &isNoisy };
121#endif
127 virtual bool getHasMask (bool &isNoisy) const
128 {
129 isNoisy = false;
130 switch (getExtraChannelType())
131 {
132 case eIECNoisyMask:
133 isNoisy = true;
134 return true;
135 case eIECMask:
136 return true;
137 default:
138 return false;
139 }
140 }
141#ifdef SWIG
142 %clear bool &isNoisy;
143#endif
144
145
150 virtual double getXResolution () const = 0;
151
156 virtual double getYResolution () const = 0;
157
162 virtual uint32 getRawBytesPerRow () const = 0;
163
164#ifdef SWIG
165#if SWIGCSHARP
166 %apply char *ARRAY_OUTPUT_SIZEINDEX_1 { void *pRow };
167#endif
168#if SWIGJAVA
169 %apply signed char *INOUT {void *pRow};
170#endif
171#if SWIGPYTHON
172 %apply char INOUT[] {void *pRow};
173#endif
174#endif
181 virtual void readScanLine (void *pRow, size_t bufferSize) = 0;
182#ifdef SWIG
183 %clear void *pRow;
184#endif
185
191 virtual void skipScanLines (uint32 skipCount)
192 {
193 CEDLSimpleBuffer scanlineBuffer(getRawBytesPerRow());
194 for (uint32 r = 0; r < skipCount; r++)
195 {
196 readScanLine(&scanlineBuffer[0], scanlineBuffer.size());
197 }
198 }
199
205 virtual bool getEfficientlySkippable() const = 0;
206};
208#define edlobj2IImageFrame(src) edl_cast((IDOM *)NULL, src)
209
210
217{
218 public:
221 {
222 }
223
226 {}
227 public:
228
229#ifdef SWIG
230#if SWIGCSHARP
231 %apply unsigned char INPUT[] {const void *pScanLine};
232#endif
233#if SWIGJAVA
234 %apply signed char *INOUT {const void *pScanLine};
235#endif
236#if SWIGPYTHON
237 %apply char INPUT[] {const void *pScanLine};
238#endif
239#endif
244 virtual void writeScanLine (const void *pScanLine) = 0;
245#ifdef SWIG
246 %clear const void *pScanLine;
247#endif
248
253 virtual void setWidth (uint32 width) = 0;
254
259 virtual void setHeight (uint32 height) = 0;
260
265 virtual void setBPS (uint8 bps) = 0;
266
271 virtual void setImageExtraChannelType (eImageExtraChannelType extraChannelType) = 0;
272
277 virtual void setXResolution (double xRes) = 0;
278
283 virtual void setYResolution (double yRes) = 0;
284
289 virtual void setColorSpace (const IDOMColorSpacePtr &colorSpace) = 0;
290
291#ifdef SWIG
292#if SWIGCSHARP
293 %apply char *ARRAY_OUTPUT_SIZEINDEX_1 { void *pRow };
294#endif
295#if SWIGJAVA
296 %apply signed char *INOUT {void *pRow};
297#endif
298#if SWIGPYTHON
299 %apply char INOUT[] {void *pRow};
300#endif
301#endif
307 virtual void readScanLine (void *pRow, size_t bufferSize) { throwEDLError(JM_ERR_UNSUPPORTED); }
308
309 #ifdef SWIG
310 %clear void *pRow;
311#endif
312
313 /* @brief Prepare the imageframe for receiving scanline data.
314 * All the other parameters must have been set already before calling
315 * this, and no calls to writeScanLine() can be made before this has
316 * occurred.
317 */
318 virtual void prepareForData () = 0;
319
324 virtual void flushData () = 0;
325
330 virtual bool getEfficientlySkippable() const
331 {
332 return false;
333 }
334};
336
337
346{
347 public:
350 {
351 }
352
355 {}
356
357 public:
358
366 virtual uint32 getNumFrames () { return 0; }
367
376 virtual IImageFramePtr getFrame (uint32 frameNo = 0) = 0;
377};
379
386{
387 public:
390 {
391 }
392
395 {}
396
397 public:
398
403 virtual IImageFrameWriterPtr createFrame () = 0;
404};
406
408
409
410#endif //IIMAGECODEC_H
411
Definition edlsimplebuffer.h:24
size_t size() const
Definition edlsimplebuffer.h:66
IEDLObject is an abstract base class that is used by all classes that are intended to be created via ...
Definition iedlobject.h:53
IImageDecoder returns IImageFrame objects as requested by the client. This object knows about the ima...
Definition iimagecodec.h:346
virtual ~IImageDecoder()
Destructor.
Definition iimagecodec.h:354
IImageDecoder()
Constructor.
Definition iimagecodec.h:349
virtual uint32 getNumFrames()
Returns the number of frames in this image file. Mako does not currently support reading extra frames...
Definition iimagecodec.h:366
virtual IImageFramePtr getFrame(uint32 frameNo=0)=0
Get the frame from the decoder for the image. Mako does not currently support reading extra frames in...
IImageEncoder accepts IImageFrame objects and streams it out to an image format.
Definition iimagecodec.h:386
IImageEncoder()
Constructor.
Definition iimagecodec.h:389
virtual IImageFrameWriterPtr createFrame()=0
Create a frame to write images from this encoder.
virtual ~IImageEncoder()
Destructor.
Definition iimagecodec.h:394
IImageFrame encapsulates an EDL image with its details.
Definition iimagecodec.h:47
virtual void skipScanLines(uint32 skipCount)
Skips the given number of scanline rows, which may be fast for some image types.
Definition iimagecodec.h:191
virtual double getXResolution() const =0
Gets the resolution of the image in the X direction.
virtual eImageExtraChannelType getExtraChannelType() const =0
Gets the type of information contained in the extra channel.
virtual bool getHasMask(bool &isNoisy) const
Indicates if the image has a mask (i.e. a binary alpha channel)
Definition iimagecodec.h:127
virtual uint8 getNumExtraChannels() const
Gets the number of image extra channels (for example an alpha or mask)
Definition iimagecodec.h:89
virtual void readScanLine(void *pRow, size_t bufferSize)=0
Gets an image row scanline (of size given by getRawBytesPerRow())
virtual uint8 getBPS() const =0
Gets the bits per sample of the image.
virtual bool getHasAlphaChannel() const
Indicates if the image has an alpha mask.
Definition iimagecodec.h:112
virtual IDOMColorSpacePtr getColorSpace() const =0
Gets the color space.
virtual uint8 getNumChannels() const
Gets the total number of image channels (including extra channels)
Definition iimagecodec.h:101
virtual uint32 getRawBytesPerRow() const =0
Gets the image row size in bytes, which may include padding space.
virtual double getYResolution() const =0
Gets the resolution of the image in the Y direction.
virtual bool getEfficientlySkippable() const =0
Determine if the image may be efficiently skipped via skipScanLines (rather than having to decode eve...
virtual uint32 getWidth() const =0
Gets the width of the image.
virtual ~IImageFrame()
Definition iimagecodec.h:49
virtual uint32 getHeight() const =0
Gets the height of the image.
IImageFrameWriter writes an image from an imageframe.
Definition iimagecodec.h:217
virtual void setXResolution(double xRes)=0
Set the resolution of the frame in the X direction.
virtual void setYResolution(double yRes)=0
Set the resolution of the frame in the Y direction.
virtual void setHeight(uint32 height)=0
Set the height of the frame in pixels.
IImageFrameWriter()
Constructor.
Definition iimagecodec.h:220
virtual void prepareForData()=0
virtual void readScanLine(void *pRow, size_t bufferSize)
It is not possible to read a scanline from an image frame writer.
Definition iimagecodec.h:307
virtual void setImageExtraChannelType(eImageExtraChannelType extraChannelType)=0
Set the type of the extra image channel, if present.
virtual void writeScanLine(const void *pScanLine)=0
Writes an image row into the image frame.
virtual void setWidth(uint32 width)=0
Set the width of the frame in pixels.
virtual ~IImageFrameWriter()
Destructor.
Definition iimagecodec.h:225
virtual void flushData()=0
Finish the image and flush. Must be called after the last scanline has been written.
virtual bool getEfficientlySkippable() const
Skipping is not possible when writing images.
Definition iimagecodec.h:330
virtual void setColorSpace(const IDOMColorSpacePtr &colorSpace)=0
Set the color space of the frame's pixels.
virtual void setBPS(uint8 bps)=0
Set the bits per sample/components of the frame.
EDL_API void throwEDLError(uint32 errorcode)
Utility - Throw an IEDLError exception with the given error code.
#define _BEGIN_EDL_NAMESPACE
Definition edlnamespaces.h:75
#define _END_EDL_NAMESPACE
Definition edlnamespaces.h:76
Simple buffer class which preserves the allocation context where the buffers were created.
unsigned int uint32
Definition edltypes.h:34
unsigned char uint8
Definition edltypes.h:32
@ JM_ERR_UNSUPPORTED
An attempt was made to use an unsupported, unimplemented feature.
Definition edlerrors.h:51
eImageExtraChannelType
Type used to uniquely identify the type of extra image channel.
Definition iimagecodec.h:32
IDOMResources interface.
@ eIECPremultipliedAlpha
Extra channel is an alpha, and the color samples have been premultiplied.
Definition iimagecodec.h:35
@ eIECNoisyMask
Definition iimagecodec.h:37
@ eIECAlpha
Extra channel is an alpha mask.
Definition iimagecodec.h:34
@ eIECNone
No extra channel present.
Definition iimagecodec.h:33
@ eIECMask
Extra channel is an binary mask.
Definition iimagecodec.h:36
#define DECL_SMART_PTR(cls)
Definition smartptr.h:211