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