HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_File.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  * NAME: IMG_File.h ( IMG Library, C++)
7  *
8  * COMMENTS:
9  * Generic interface for loading and saving image files.
10  */
11 
12 #pragma once
13 
14 #ifndef __IMG_File__
15 #define __IMG_File__
16 
17 #include "IMG_API.h"
18 #include <iosfwd>
19 #include <SYS/SYS_Types.h>
20 #include <UT/UT_ErrorManager.h>
21 #include <UT/UT_FilterType.h>
22 #include <UT/UT_Functor.h>
23 #include <UT/UT_Rect.h>
24 #include <UT/UT_ValArray.h>
25 #include <UT/UT_BitArray.h>
26 #include <UT/UT_WorkArgs.h>
27 #include <UT/UT_SharedPtr.h>
28 #include <UT/UT_StringArray.h>
29 #include <PXL/PXL_Forward.h>
30 #include "IMG_FileParms.h"
31 #include "IMG_Error.h"
32 #include "IMG_FileTypes.h"
33 #include "IMG_Stat.h"
34 
35 class IMG_Format;
36 class UT_Options;
37 class UT_String;
38 class UT_WorkBuffer;
39 class UT_FileLUT;
40 class UT_IStream;
41 class FS_Reader;
42 class FS_Writer;
43 class IMG_FileTagList;
44 class img_ScanProgress;
45 class PXL_Raster;
46 class PXL_DeepSampleList;
47 
49 
50 /// @brief Generic interface for reading and writing image files.
51 /// This class handles the reading and writing of all image formats that Houdini
52 /// supports. Use the static open() or create() methods to get an IMG_File
53 /// instance to read to or write from. Deleting this instance will close the
54 /// file.
56 {
57 public:
58  virtual ~IMG_File();
59 
60  virtual int64 getMemoryUsage(bool inclusive) const;
61 
62  // The following methods are a public interface which is not dependent on
63  // the format of the image. Users of the library should use these methods
64  // to do the loading and saving of the data.
65 
66  /// @brief Open an image file using a filename
67  /// Open an image file for reading by specifying the filename and path of
68  /// the file. An optional IMG_FileParms class may be passed to convert it
69  /// into a specific image type (8bit, specific resolution, etc). An optional
70  /// format may also be passed, which forces the library to assume the image
71  /// file is of that particular format.
72  /// This method returns a new IMG_File object which you read the image data
73  /// from, or NULL if an error occurred.
74  static IMG_File *open(const char *filename,
75  const IMG_FileParms *options = nullptr,
76  const IMG_Format *fmt = nullptr);
77 
78  /// @brief Open an image file from a stream
79  /// Open an image file for reading given a stream. This is useful for
80  /// embedded images in a file. An optional IMG_FileParms class may be
81  /// passed to convert it into a specific image type (8bit, specific
82  /// resolution, etc). An optional format may also be passed, which forces
83  /// the library to assume the image file is of that particular format.
84  /// If 'steal_stream' is true, the image library assumes ownership of the
85  /// stream and closes it when it's finished reading the file. If the stream
86  /// is not seekable (cannot jump around in the file, such as with a pipe),
87  /// set 'streamIsSeekable' to false.
88  /// This method returns a new IMG_File object which you read the image data
89  /// from, or NULL if an error occurred.
90  static IMG_File *open(UT_IStream &is,
91  const IMG_FileParms *options = nullptr,
92  const IMG_Format *fmt=nullptr,
93  int steal_stream = 0,
94  bool streamIsSeekable = true);
95 
96  /// @brief Create a new image file
97  /// Create a new image file with the pathname 'filename' according to the
98  /// parameters specified in 'stat'. You can supply an optional 'options'
99  /// class to translate the image before being written (scale, flip, etc).
100  /// You can also specify an optional 'format' parameter to force the file
101  /// to be written as a specific image format (regardless of the extension
102  /// found in 'filename').
103  /// NULL may be returned if the file could not be created for any reason.
104  static IMG_File *create(const char *filename,
105  const IMG_Stat &stat,
106  const IMG_FileParms *options = nullptr,
107  const IMG_Format *fmt = nullptr);
108 
109 
110  /// @brief Write an image file to an existing stream
111  /// Writes a new image file to the stream 'os' according to the
112  /// parameters specified in 'stat'. You can supply an optional 'options'
113  /// class to translate the image before being written (scale, flip, etc).
114  /// You can also specify an optional 'format' parameter to force the file
115  /// to be written as a specific image format (regardless of the extension
116  /// found in 'filename').
117  /// If 'steal_stream' is true, the image library assumes ownership of the
118  /// stream and closes it when it's finished writing the file. If the stream
119  /// is not seekable (cannot jump around in the file, such as with a pipe),
120  /// set 'streamIsSeekable' to false.
121  /// NULL may be returned if the file could not be created in the stream.
122  static IMG_File *create(std::ostream &os,
123  const IMG_Stat &stat,
124  const IMG_FileParms *options = nullptr,
125  const IMG_Format *fmt = nullptr,
126  int steal_stream = 0,
127  bool streamIsSeekable = true);
128 
129  /// @{
130  /// @brief Writes a PXL_Raster to an image file.
131  /// Convenience method to write an image stored in a PXL_Raster to a disk
132  /// file.
133  static bool saveRasterAsFile(const char *filename,
134  const PXL_Raster *raster,
135  const IMG_SaveRastersToFilesParms &parms);
136  static bool saveRasterAsFile(const char *filename,
137  const PXL_Raster *raster,
138  const IMG_FileParms *fparms = nullptr,
139  const IMG_Format *format = nullptr);
140  /// @}
141 
142  /// @brief Writes PXL_Raster's to image files.
143  /// Convenience method to write images stored in PXL_Raster's to disk
144  /// files. The @c linear_planes parameter specifies a pattern of planes
145  /// which should be written to in linear space.
146  static bool saveRastersAsFiles(const char *filename,
147  const IMG_SaveRastersToFilesParms &parms);
148 
149  /// @brief Copies an existing image file to another image file.
150  /// Convenience method to copy an image file from one file to another.
151  /// The image date may be altered if the formats of the two files are
152  /// not the same (based on filename extension), or if an optional 'options'
153  /// class is passed.
154  static bool copyToFile(const char *sourcename,
155  const char *destname,
156  const IMG_FileParms *options = nullptr);
157 
158  static bool copyToFileFormat(const char *sourcename,
159  const char *formatname,
160  UT_String *destname = nullptr,
161  const IMG_FileParms *options = nullptr);
162 
163  /// @brief Copies an existing image file to a stream
164  /// Convenience method to copy an image file to a stream. The image data
165  /// may be altered if an optional 'options' class is passed, or if the
166  /// optional image 'format' parameter does not match the format of the
167  /// source image file.
168  static bool copyToStream(const char *sourcename,
169  std::ostream &deststream,
170  const IMG_FileParms *options = nullptr,
171  const IMG_Format *format = nullptr);
172 
173  virtual const char *className() const { return "IMG_File"; }
174 
175  /// Closes the file. Called by the destructor if needed , so 'delete file'
176  /// will often take the place of this call. However, you won't receive any
177  /// error information in that case, so you can call it directly.
178  int close();
179 
180  /// Returns 1 if we are reading, 0 if writing.
181  int getReadMode() const;
182 
183  /// @{
184  /// Returns the image type of the format we just opened.
185  IMG_ImageType getImageType() const;
186  /// @}
187 
188  /// @{
189  /// Retrieve the file format description of the file. The format contains
190  /// all information that is general to all files of this format type.
191  const IMG_Format *getFormat() const { return myFormat; }
192  void setFormat(const IMG_Format *f) { myFormat = f; }
193  /// @}
194 
195  /// Get the image description of the current image file (resolution, data
196  /// format, etc). The returned class can be queried for all of the current
197  /// image file's statistics.
198  /// @{
199  const IMG_Stat &getStat() const;
200  IMG_Stat &getStat();
201  /// @}
202 
203  /// Get additional image information about the file that is specific
204  /// to a particular format. Some formats do not have additional information.
205  /// The information returned is human-readable in 'text'.
206  virtual void getAdditionalInfo(UT_String &text);
207 
208  /// returns the value of an image option passed in through IMG_FileParms.
209  /// Image options are specific to formats. Returns NULL if the option
210  /// does not exist on the format.
211  const char *getOption(const char *name) const;
212 
213  /// Access to the list of file options this file was saved with.
214  /// @{
215  int getNumOptions() const;
216  const char *getOptionName(int i) const;
217  const char *getOptionValue(int i) const;
218  /// @}
219 
220  /// @brief read a single scanline.
221  /// read() returns a pointer to the scanline data
222  /// in an internal buffer. Do not delete it.
223  const void *read(int scan, const IMG_Plane *from_plane = nullptr);
224 
225  /// @brief Reads the scanline into a buffer that you supply.
226  /// The buffer passed must be big enough to fit the plane passed.
227  /// getStat().bytesPerPlaneScan() will return the proper size.
228  /// Returns 0 on failure.
229  bool readIntoBuffer(int scan, void *buffer,
230  const IMG_Plane *from_plane = nullptr);
231 
232  /// @brief Write a scanline to the file.
233  /// You don't need to write scanlines in order, nor do you need to write
234  /// planes in order; the data may be cached however. Returns 0 if
235  /// there was an error during the write. You should immediately stop
236  /// writing if a failure occurred (many formats will behave unpredictably
237  /// otherwise).
238  bool write(int scan, const void *data,
239  const IMG_Plane *to_plane = nullptr);
240 
241  /// allocates a buffer large enough to hold the biggest plane's scanline
242  /// in the file. Free this buffer with free(). (This will not hold all
243  /// the planes' scanlines, only one at a time!)
244  void * allocScanlineBuffer() const;
245 
246  /// @deprecated
247  /// The following methods read/write a whole raster. Unless the scanline
248  /// increment is passed in, the stat structure will be used to determine the
249  /// scanline size. Beware if you're using translators...
250  /// Use readImages() and writeImages() instead.
251  ///@{
252  bool readImage(void *data, int flip=0, int scaninc=0);
253  /// @deprecated
254  bool writeImage(void *data, int flip=0, int scaninc=0);
255  ///@}
256 
257  /// @brief Reads all the image data into a list of PXL_Rasters.
258  /// reads the image data into a a series of rasters. The array should be
259  /// empty, as this method creates and fills the rasters for you.
260  ///
261  /// Note: You must delete the rasters returned by this method.
262  bool readImages(UT_Array<PXL_Raster *> &images,
263  const char *scope = nullptr);
264 
265  /// @{
266  /// @brief Writes all PXL_Rasters to the image format.
267  /// This method takes a raster per IMG_Plane in the stat. The
268  /// data format, color model and res of the raster must match the
269  /// corresponding IMG_Plane. If the format is not a deep raster format,
270  /// not all images may be written.
271  /// if 'freerasters' is true, it will free the rasters for you.
272  bool writeImages(const UT_Array<const PXL_Raster *> &imgs);
273  bool writeImages(UT_Array<PXL_Raster *> &images,
274  bool freerasters = false);
275  /// @}
276 
277  /// @deprecated
278  /// For image files that contain more than one image, such as a
279  /// movie file, jump to a particular frame in the movie and reset
280  /// for reading the scanlines of the new frame
281  virtual bool jumpToFrame(int frame);
282 
283  /// When writing an image, call if interrupted or you encounter an
284  /// non-image-file error and cannot complete the file write.
285  virtual void abortWrite();
286 
287  ///@{
288  /// orientation of the current file or format. Some formats support multiple
289  /// orientations specified in the image files themselves, others simply
290  /// have a fixed orientation. Call these methods rather than querying the
291  /// orientation from the format, in case the format supports multiple
292  /// orientations.
293  virtual int isTopFirst() const;
294  /// If 0, scanlines are right-to-left. Default is 1 (left-to-right).
295  virtual int isLeftFirst() const;
296  ///@}
297 
298  /// call this if you won't be reading the scanlines in order, or if
299  /// you'll be reading all the scanlines for a single plane first.
300  virtual void randomReadAccessRequired();
301  /// @private
302  bool randomReadsForced() const
303  { return myForceRandomReads; }
304 
305  /// @{
306  /// This is a tile interface for reading files. To use it, you must pass an
307  /// IMG_FileParms object to open() with IMG_FileParms::useTileInterface()
308  /// called. Otherwise, this will just return false. The x-y coords of the
309  ///tile is in pixels.
310  virtual bool readTile(const UT_InclusiveRect &tile, void *data,
311  const IMG_Plane *plane=0);
312 
313  /// this is a tile interface for writing files. To use it, you must pass an
314  /// IMG_FileParms object to open() with IMG_FileParms::useTileInterface()
315  /// called. Otherwise, this will just return false. The x-y coords of the
316  ///tile is in pixels.
317  virtual bool writeTile(const UT_InclusiveRect &tile,
318  const void *data,
319  const IMG_Plane *plane=0);
320  /// @}
321 
322  /// When writing an image, the checkpoint() method can be used to
323  /// checkpoint data (see TIFFCheckpointDirectory() for an example).
324  /// Generally, this writes the image data currently passed and this results
325  /// in a usable, partially written file.
326  /// By default, nothing is done.
327  virtual void checkpoint();
328 
329  /// This method converts the "standard" bit depth option to an IMG_DataType.
330  /// This is used by the -b option in mantra as well as many other places.
331  /// When dealing with floating point arguments, there's an optional flag to
332  /// "denormalize" the floating point values when writing. This basically
333  /// removes tiny precision errors. It's up to the user to deal with the
334  /// denormalization.
335  /// - char, byte, 8 = uint8
336  /// - short, 16 = uint16
337  /// - int = uint32
338  /// - FLOAT = fpreal32 (denormalize=true)
339  /// - HALF = fpreal16 (denormalize=true)
340  /// - float, 32 = fpreal32
341  /// - half = fpreal16
342  static IMG_DataType mapStorageOption(const char *option,
343  bool *denormalize_flag = nullptr);
344 
345  /// Turns error reporting on or off. Returns the previous setting.
346  /// Errors are reported to the error manager, which will either show up
347  /// in the node information or the Houdini status bar (if not loaded within
348  /// a node).
349  ///
350  static int doErrors( int newDoErrors );
351  static void imgError( int code, const char *msg = nullptr );
352  static void imgWarning( int code, const char *msg = nullptr );
353 
354  bool hasError() const
355  { return getBaseFile() ? (getBaseFile()->hasError() ||
356  myErrorFlag) :myErrorFlag; }
357 
358  /// Returns information about the alpha channel if the IMG_FileParms passed
359  /// to open() had detectAlphaDetails() specified.
360  virtual IMG_FileAlphaInfo getAlphaInfo(float &) const
361  { return IMG_ALPHA_VARYING; }
362 
363  /// returns the raw file at the top of the filter stack.
364  IMG_File *getUnfilteredFile();
365  const IMG_File *getUnfilteredFile() const;
366  virtual IMG_File *getBaseFile() const { return 0; }
367 
368  /// Copy the texture image options from another IMG_File
369  bool copyImageTextureOptions(const IMG_File &src,
370  bool clear_existing);
371 
372  /// Some image formats support "texture" options. Formats which do not
373  /// support options should return a NULL pointer.
374  /// This method calls @c getImageTextureOptions() by default
375  virtual UT_SharedPtr<UT_Options> imageTextureOptions() const;
376 
377  /// This method is deprecated. Please implement @c imageTextureOptions()
378  SYS_DEPRECATED(12.0) virtual const UT_Options *getImageTextureOptions() const;
379 
380  /// For image formats which support texture options, this will clear out
381  /// all texture options.
382  virtual void clearImageTextureOptions();
383 
384  /// For image formats which support texture options, merge the UT_Options
385  /// into the current options.
386  virtual bool setImageTextureOptions(const UT_Options &options);
387 
388  /// When being created through a tile device (i.e. rendering, etc.), the
389  /// writer may send additional information to the file writer after the
390  /// image has been created.
391  virtual void setWriteTag(const char *tagname,
392  int num_values,
393  const char *const *values);
394 
395  /// Read the image options (@see getOption()) to extract the world to
396  /// camera transform. If the data isn't available, this method returns
397  /// false. This will likely only work when the image is being created from
398  /// mantra.
399  bool getWorldToCamera(UT_Matrix4D &xform) const;
400 
401  /// Read the image options (@see getOption()) to extract the camera to NDC
402  /// transform. If the data isn't available in the options, this method
403  /// returns false. This will likely only work when the image is being
404  /// created from mantra.
405  /// If the @c fit_z option is true, the near/far range will be set to
406  /// (0,1). This will not be possible if the "camera:clip" setting wasn't
407  /// passed in the options.
408  bool getCameraToNDC(UT_Matrix4D &xform, int xres, int yres, bool
409  fit_z = true) const;
410  /// Read the image options (@see getOption()) to extract the world to NDC
411  /// transform. If the data isn't available in the options, this method
412  /// returns false. This will likely only work when the image is being
413  /// created from mantra.
414  /// If the @c fit_z option is true, the near/far range will be set to
415  /// (0,1). This will not be possible if the "camera:clip" setting wasn't
416  /// passed in the options.
417  bool getWorldToNDC(UT_Matrix4D &xform, int xres, int yres, bool
418  fit_z = true) const;
419 
420 
421  // API for raw deep pixel access. Methods will fail if the image is not
422  // a deep pixel image. The deep pixel functions can be accessed from
423  // multiple threads simultaneously.
424 
425  // Returns the number of deep pixel samples for the given pixel location.
426  // Returns -1 if the sample count cannot be read, or if the image is not
427  // a deep pixel image.
428  virtual int getDeepPixelSamples(int x, int y);
429 
430  // Read the deep pixel samples for the given plane. The size of the data
431  // array should be at least the same size as the number of samples returned
432  // by getDeepPixelSamples multiplied by the component count of the plane
433  // given by IMG_Plane::getComponentCount.
434  // Returns false if the data cannot be read, or if the image is not a deep
435  // pixel image.
436  virtual bool getDeepPixelPlaneData(int x, int y,
437  const IMG_Plane &plane,
438  float *data);
439 
440  // Read the deep pixel samples for all components at a given pixel location.
441  // The length of the pointer array should at least be the same as the
442  // number of samples returned from getDeepPixelSamples(). The size of
443  // each array pointed to should be at least the same size as the number
444  // of components returned from getDeepPixelComponentCount().
445  // Returns false if the data cannot be read, of if the image is not a deep
446  // pixel image.
447  virtual bool getDeepPixelData(int x, int y, float * const *data);
448 
449  /// Read a deep pixel
450  virtual bool readDeepPixelData(int x, int y,
451  PXL_DeepSampleList &pixel);
452 
453  /// @{
454  /// A method to write deep pixel data for all channels, at a given pixel
455  /// location. The function should be given an array of pointers to float
456  /// arrays, where each float array contains the value of all image
457  /// components for a given sample level.
458  ///
459  /// Returns false if the data cannot be written, or if the image is not
460  /// a deep pixel image.
461  virtual bool writeDeepPixelData(int x, int y,
462  const PXL_DeepSampleListPtr &pixel);
463  /// @}
464 
465 
466  /// users of IMG_File can select only certain planes to read using
467  /// IMG_FileParms::selectPlane..(). Call selectPlanesToRead() first,
468  /// usually at the end of open(), and then call isPlaneSelected() to
469  /// determine if the plane was selected for read.
470  /// @{
471  void selectPlanesToRead();
472  bool isPlaneSelected(const IMG_Plane &plane) const;
473  /// @}
474 
475  static void setFileCreateCB(UT_Functor1<int, const UT_StringRef &> cb);
476 
477 protected:
478  IMG_File(); /// Only called by format class
479 
480  // If the check_magic flag is 0, then the first 4 bytes of the file have
481  // alread. They are passed in as the magic number for verification.
482  virtual int open();
483  virtual int openPostMagic();
484  virtual int openFile(const char *filename);
485 
486  virtual int readScanline(int scanline, void *data) = 0;
487  virtual const void *readPlaneScanline(int y, const IMG_Plane &pi);
488 
489  // Create an image
490  virtual int createFile(const char *filename,const IMG_Stat &stat);
491  virtual int create(const IMG_Stat &stat);
492 
493  virtual int writeScanline(int scanline, const void *data) = 0;
494  virtual int writePlaneScanline(const void *data, int y,
495  const IMG_Plane &pi);
496 
497  virtual int closeFile() = 0;
498 
499  /// Run after the output stream has been closed.
500  /// Be careful, since some things have been destructed.
501  virtual void postCloseAction();
502 
503  // add any image flips, scales, data translations, etc. Returns the
504  // end of the filter chain.
505  //
506  virtual bool isPassThrough() const { return false; }
507 
508  IMG_File *makeReadFilters(const IMG_FileParms &parms);
509  IMG_File *makeWriteFilters(const IMG_FileParms &parms);
510 
511 
512  // if you override this, you must call this class's version.
513  virtual void computeCommonData();
514 
515  void *getScanlineBuffer(int y);
516  void *getPlaneBuffer(int y, const IMG_Plane &pi);
517 
518  virtual void finishedScanline(int scan);
519 
520  static void setOptions(const IMG_FileParms *options,
521  IMG_File *file);
522 
523  /// @{
524  /// Set option to control behaviour of the file. For example, the
525  /// compression level when creating the image.
526  int setOption(const char *token, const char *value);
527  int setOption(const char *token, fpreal64 val);
528  int setOption(const char *token, int64 val);
529  int setOption(const char *option, int value)
530  { return setOption(option, (int64)value); }
531  /// @}
532 
533  bool canWriteStatWithoutConversion() const;
534 
535  // Access to input and output streams
536  // peekByte() will peek at the next input byte. -1 returned on EOF
537  // readSomeBytes() will read data into the buffer specified. The number
538  // of bytes actually read is returned.
539  // writeSomeBytes() will write data from the buffer. The number
540  // of bytes actually written is returned.
541  // flushBytes() will flush the output stream
542  // readBytes() is a convenience method when all data needs to be read
543  // writeBytes() is a convenience method when all data needs to be written
544  //
545  int peekByte();
546  int readSomeBytes(void *buffer, int size);
547  int writeSomeBytes(const void *buffer, int size);
548  bool flushBytes();
549 
550  bool readBytes(void *buffer, int size)
551  { return readSomeBytes(buffer, size) == size; }
552  bool writeBytes(const void *buffer, int size)
553  { return writeSomeBytes(buffer, size) == size; }
554 
555 
556  // For the odd format which requires data to be read as ASCII lines, this
557  // method exists.
558  bool readAsciiLine(UT_WorkBuffer &wbuf);
559 
560  // Seeks the stream to the start + offset. Returns true if successful
561  // and false otherwise.
562  bool seekFromBeginning(int64 offset);
563  bool seekFromCurrent(int64 offset);
564  bool seekFromEnd(int64 offset);
565  int64 tellCurrentPosition();
566 
567  // Copies our input stream to the given stream.
568  void copyInputToStream(std::ostream &os);
569 
570  // Deletes our input stream.
571  void deleteStream();
572 
573  /////////////////////////////////////////////////////////////////////////
574  // Do not use these methods. They are for special cases only.
575  UT_IStream *getUTIStream() { return myIStream; }
576  void setIStream(UT_IStream *is) { myIStream = is; }
577  /////////////////////////////////////////////////////////////////////////
578 
579  // Image description.
582  std::ostream *myOS;
585  unsigned myCreateIStream:1,
586  myCreateOStream:1,
587  myForceRandomReads:1,
588  myHasRandomReads:1,
589  myFileOpen:1,
590  myErrorFlag:1,
591  myContinueOnErrorFlag:1;
592 
593 private:
594  class img_ScanProgress
595  {
596  public:
597  img_ScanProgress()
598  : myNumPlanes(0)
599  {
600  }
601  void init(const IMG_Stat &stat);
602  int64 getMemoryUsage(bool inclusive) const;
603  void processed(int scan, const IMG_Plane *plane);
604  void processAll(int scan);
605  bool isComplete(int scan, const IMG_Plane *plane) const;
606  bool isComplete(int scan) const;
607  int remaining(int scan) const;
608  int numScans() const { return myCounts.entries(); }
609  private:
610  int bitIndex(int scan, int plane) const;
611  private:
612  int myNumPlanes;
613  UT_BitArray myProcessed;
614  UT_ValArray<int> myCounts;
615  };
616 
617 private:
618  // Initialize tags to default values
619  void initializeTags();
620  void makeScanlineBuffers();
621  void deallocScanlineBuffer(int scan);
622  const void *returnErrorScan(int scan, const IMG_Plane &pi);
623 
624  IMG_File *makeDataConversion(const IMG_FileParms &parms,
625  IMG_File *file);
626  IMG_File *makeFlip(const IMG_FileParms &parms,
627  IMG_File *file);
628 
629 
630  const IMG_Format *myFormat;
631  IMG_FileTagList *myTagList;
632  void *myScanlineBuffer;
633  int myCurrentImageScanline;
634 
635  img_ScanProgress myScanProgress;
636  UT_ValArray<void *> myImageScanline;
637  UT_BitArray mySelectPlane;
638 
639 
640  FS_Reader *myReader;
641  FS_Writer *myWriter;
642  UT_IStream *myIStream;
643 
644  // only IMG_Format can call initializeTags().
645  friend class IMG_Format;
646  friend class IMG_FileFilter;
647  friend class IMG_GZip;
648  friend class IMG_FileBuffer;
649  friend class MV_ReadPRISMS;
650 };
651 
652 #endif
653 
Class for reading files.
Definition: FS_Reader.h:33
const IMG_Format * getFormat() const
Definition: IMG_File.h:191
GT_API const UT_StringHolder filename
IMG_Stat myStat
Definition: IMG_File.h:580
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
int setOption(const char *option, int value)
Definition: IMG_File.h:529
#define SYS_DEPRECATED(__V__)
GLuint const GLchar * name
Definition: glew.h:1814
bool writeBytes(const void *buffer, int size)
Definition: IMG_File.h:552
IMG_ImageType
Type of image we want to create or have opened.
GLuint const GLfloat * val
Definition: glew.h:2794
GLint GLsizei const GLuint64 * values
Definition: glew.h:3612
GLuint GLenum option
Definition: glew.h:3288
virtual IMG_File * getBaseFile() const
Definition: IMG_File.h:366
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1254
void close() override
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:45
void read(T &in, bool &v)
Definition: ImfXdr.h:611
double fpreal64
Definition: SYS_Types.h:201
#define IMG_API
Definition: IMG_API.h:10
GLclampf f
Definition: glew.h:3499
int open(float queuesize) override
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
virtual const char * className() const
Definition: IMG_File.h:173
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
GLuint buffer
Definition: glew.h:1680
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
IMG_DataType
Definition: IMG_FileTypes.h:17
UT_IStream * getUTIStream()
Definition: IMG_File.h:575
Class for writing files.
Definition: FS_Writer.h:26
long long int64
Definition: SYS_Types.h:116
void setIStream(UT_IStream *is)
Definition: IMG_File.h:576
bool myReadMode
Definition: IMG_File.h:581
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:55
bool hasError() const
Definition: IMG_File.h:354
IMG_FileAlphaInfo
A map of string to various well defined value types.
Definition: UT_Options.h:84
std::ostream * myOS
Definition: IMG_File.h:582
Base Integer Rectangle class.
ImageBuf OIIO_API flip(const ImageBuf &src, ROI roi={}, int nthreads=0)
bool readBytes(void *buffer, int size)
Definition: IMG_File.h:550
void setFormat(const IMG_Format *f)
Definition: IMG_File.h:192
File options for manipulating image data on load or save. This class allows you to modify the incomin...
Definition: IMG_FileParms.h:34
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Definition: IMG_Stat.h:40
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:81
Parameters for the saveRaster[s]AsFile[s]() methods of IMG_File.
#define const
Definition: zconf.h:214
void write(T &out, bool v)
Definition: ImfXdr.h:332
int64 myStreamStartPos
Definition: IMG_File.h:583
virtual IMG_FileAlphaInfo getAlphaInfo(float &) const
Definition: IMG_File.h:360
GLsizei const GLfloat * value
Definition: glew.h:1849
int64 myStreamLength
Definition: IMG_File.h:584
GLintptr offset
Definition: glew.h:1682