HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_FileFilter.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_FileFilterFlip ( IMG Library, C++)
7  *
8  * COMMENTS:
9  *
10  * This is the base class for all filters that support IMG_File.
11  * A filter transforms the image data in some way during the load/save
12  * process. Some filters are read/write, while others only affect one.
13  *
14  */
15 
16 #pragma once
17 
18 #ifndef IMG_FILE_FILTER_H
19 #define IMG_FILE_FILTER_H
20 
21 #include "IMG_File.h"
22 
24 {
25 public:
26  IMG_FileFilter(IMG_File *file_to_filter);
27  virtual ~IMG_FileFilter();
28 
29  // All filters are pass through. None of the image formats are.
30  //
31  virtual bool isPassThrough() const { return true; }
32  virtual int isTopFirst() const { return myFileToFilter->isTopFirst(); }
33  virtual int isLeftFirst() const { return myFileToFilter->isLeftFirst(); }
34 
35  virtual IMG_File *getBaseFile() const { return myFileToFilter; }
36 
37  virtual void randomReadAccessRequired();
38 
39  void setFileToFilter(IMG_File *file) { myFileToFilter = file; }
40 
41  virtual void computeCommonData()
43 
44  virtual int getDeepPixelSamples(int x, int y);
45  virtual bool getDeepPixelPlaneData(int x, int y,
46  const IMG_Plane &plane,
47  float *data);
48  virtual bool getDeepPixelData(int x, int y, float * const *data);
49  virtual bool readDeepPixelData(int x, int y,
51  virtual bool writeDeepPixelData(int x, int y,
52  const PXL_DeepSampleListPtr &p);
53 
54  protected:
55  // called when the user calls closeFile().
56  //
57  virtual int finishFilter() { return 1; }
58 
59  // Don't override these methods; override the read/writePlaneScanline()
60  // methods instead.
61  //
62  virtual int readScanline(int scanline, void *data);
63  virtual int writeScanline(int scanline, const void *data);
64 
65  virtual void checkpoint();
66  virtual int closeFile();
67 
68  // Utility functions for filters.
69  const IMG_Stat &getInputStat() const { return myFileToFilter->getStat(); }
70  IMG_Stat &getInputStat() { return myFileToFilter->getStat(); }
71 
72  const void * fetchScanline(int y, const IMG_Plane &pi);
73  bool writeToScanline(int y, const void *data,
74  const IMG_Plane &pi);
75 
76  void *fetchWriteScanline(int y, const IMG_Plane &pi);
77 
78  virtual void getAdditionalInfo(UT_String &text)
79  { myFileToFilter->getAdditionalInfo(text); }
80 
81  /// @{
82  /// Image texture options
84  virtual void clearImageTextureOptions();
85  virtual bool setImageTextureOptions(const UT_Options &options);
86  virtual void setWriteTag(const char *tag, int n, const char *const *v);
87  /// @}
88 private:
89  IMG_File *myFileToFilter;
90 
91 };
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 #endif
virtual bool writeDeepPixelData(int x, int y, const PXL_DeepSampleListPtr &pixel)
IMG_Stat & getInputStat()
virtual bool isPassThrough() const
virtual int isTopFirst() const
virtual void computeCommonData()
const GLdouble * v
Definition: glcorearb.h:836
virtual bool getDeepPixelPlaneData(int x, int y, const IMG_Plane &plane, float *data)
virtual int readScanline(int scanline, void *data)=0
virtual int closeFile()=0
virtual bool getDeepPixelData(int x, int y, float *const *data)
virtual UT_SharedPtr< UT_Options > imageTextureOptions() const
GLint y
Definition: glcorearb.h:102
virtual int writeScanline(int scanline, const void *data)=0
virtual IMG_File * getBaseFile() const
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:44
virtual void setWriteTag(const char *tagname, int num_values, const char *const *values)
virtual int isLeftFirst() const
If 0, scanlines are right-to-left. Default is 1 (left-to-right).
#define IMG_API
Definition: IMG_API.h:10
GLdouble n
Definition: glcorearb.h:2007
virtual void checkpoint()
virtual int finishFilter()
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
const IMG_Stat & getInputStat() const
void setFileToFilter(IMG_File *file)
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
virtual void clearImageTextureOptions()
A map of string to various well defined value types.
Definition: UT_Options.h:42
virtual int getDeepPixelSamples(int x, int y)
friend class IMG_FileFilter
Definition: IMG_File.h:643
virtual bool setImageTextureOptions(const UT_Options &options)
GLint GLenum GLint x
Definition: glcorearb.h:408
virtual void randomReadAccessRequired()
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Definition: IMG_Stat.h:40
virtual void computeCommonData()
virtual void getAdditionalInfo(UT_String &text)
virtual bool readDeepPixelData(int x, int y, PXL_DeepSampleList &pixel)
Read a deep pixel.