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  ~IMG_FileFilter() override;
28 
29  // All filters are pass through. None of the image formats are.
30  //
31  bool isPassThrough() const override { return true; }
32  int isTopFirst() const override
33  { return myFileToFilter->isTopFirst(); }
34  int isLeftFirst() const override
35  { return myFileToFilter->isLeftFirst(); }
36 
37  IMG_File *getBaseFile() const override { return myFileToFilter; }
38 
39  void randomReadAccessRequired() override;
40 
41  void setFileToFilter(IMG_File *file) { myFileToFilter = file; }
42 
43  void computeCommonData() override
45 
46  int getDeepPixelSamples(int x, int y) override;
47  bool getDeepPixelPlaneData(int x, int y,
48  const IMG_Plane &plane,
49  float *data) override;
50  bool getDeepPixelData(int x, int y, float * const *data) override;
51  bool readDeepPixelData(int x, int y,
52  PXL_DeepSampleList &p) override;
53  bool writeDeepPixelData(int x, int y,
54  const PXL_DeepSampleListPtr &p) override;
55 
56  protected:
57  // called when the user calls closeFile().
58  //
59  virtual int finishFilter() { return 1; }
60 
61  // Don't override these methods; override the read/writePlaneScanline()
62  // methods instead.
63  //
64  int readScanline(int scanline, void *data) override;
65  int writeScanline(int scanline, const void *data) override;
66 
67  void checkpoint() override;
68  int closeFile() override;
69 
70  // Utility functions for filters.
71  const IMG_Stat &getInputStat() const { return myFileToFilter->getStat(); }
72  IMG_Stat &getInputStat() { return myFileToFilter->getStat(); }
73 
74  const void * fetchScanline(int y, const IMG_Plane &pi);
75  bool writeToScanline(int y, const void *data,
76  const IMG_Plane &pi);
77 
78  void *fetchWriteScanline(int y, const IMG_Plane &pi);
79 
80  void getAdditionalInfo(UT_String &text) override
81  { myFileToFilter->getAdditionalInfo(text); }
82 
83  /// @{
84  /// Image texture options
86  imageTextureOptions() const override;
87  void clearImageTextureOptions() override;
88  bool setImageTextureOptions(const UT_Options &options) override;
89  void setWriteTag(const char *tag,
90  int n, const char *const *v) override;
91  /// @}
92 private:
93  IMG_File *myFileToFilter;
94 
95 };
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 #endif
virtual bool writeDeepPixelData(int x, int y, const PXL_DeepSampleListPtr &pixel)
IMG_Stat & getInputStat()
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
void getAdditionalInfo(UT_String &text) override
virtual int writeScanline(int scanline, const void *data)=0
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:45
virtual void setWriteTag(const char *tagname, int num_values, const char *const *values)
int isTopFirst() const override
GLint GLenum GLint x
Definition: glcorearb.h:408
#define IMG_API
Definition: IMG_API.h:10
virtual void checkpoint()
virtual int finishFilter()
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:30
const GLdouble * v
Definition: glcorearb.h:836
const IMG_Stat & getInputStat() const
GLfloat GLfloat p
Definition: glew.h:16656
void setFileToFilter(IMG_File *file)
void computeCommonData() override
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:56
virtual void clearImageTextureOptions()
GLdouble n
Definition: glcorearb.h:2007
int isLeftFirst() const override
If 0, scanlines are right-to-left. Default is 1 (left-to-right).
GLboolean * data
Definition: glcorearb.h:130
A map of string to various well defined value types.
Definition: UT_Options.h:84
virtual int getDeepPixelSamples(int x, int y)
friend class IMG_FileFilter
Definition: IMG_File.h:664
virtual bool setImageTextureOptions(const UT_Options &options)
bool isPassThrough() const override
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
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:118
IMG_File * getBaseFile() const override
virtual void computeCommonData()
GLint y
Definition: glcorearb.h:102
virtual bool readDeepPixelData(int x, int y, PXL_DeepSampleList &pixel)
Read a deep pixel.