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 #include <UT/UT_NonCopyable.h>
23 #include <UT/UT_UniquePtr.h>
24 
25 class IMG_API IMG_FileFilter : public IMG_File
26 {
27 public:
28  IMG_FileFilter(IMG_File *file_to_filter);
29  ~IMG_FileFilter() override;
30 
32 
33  // All filters are pass through. None of the image formats are.
34  //
35  bool isPassThrough() const override { return true; }
36  int isTopFirst() const override
37  { return myFileToFilter->isTopFirst(); }
38  int isLeftFirst() const override
39  { return myFileToFilter->isLeftFirst(); }
40 
41  IMG_File *getBaseFile() const override { return myFileToFilter; }
42 
43  void randomReadAccessRequired() override;
44 
45  void setFileToFilter(IMG_File *file) { myFileToFilter = file; }
46 
47  void computeCommonData() override
48  { IMG_File::computeCommonData(); }
49 
50  int getDeepPixelSamples(int x, int y) override;
51  bool getDeepPixelPlaneData(int x, int y,
52  const IMG_Plane &plane,
53  float *data) override;
54  bool getDeepPixelData(int x, int y, float * const *data) override;
55  bool readDeepPixelData(int x, int y,
56  PXL_DeepSampleList &p) override;
57  bool writeDeepPixelData(int x, int y,
58  const PXL_DeepSampleListPtr &p) override;
59 
60  protected:
61  // called when the user calls closeFile().
62  //
63  virtual int finishFilter() { return 1; }
64 
65  // Don't override these methods; override the read/writePlaneScanline()
66  // methods instead.
67  //
68  int readScanline(int scanline, void *data) override;
69  int writeScanline(int scanline, const void *data) override;
70 
71  void checkpoint() override;
72  int closeFile() override;
73 
74  // Utility functions for filters.
75  const IMG_Stat &getInputStat() const { return myFileToFilter->getStat(); }
76  IMG_Stat &getInputStat() { return myFileToFilter->getStat(); }
77 
78  const void * fetchScanline(int y, const IMG_Plane &pi);
79  bool writeToScanline(int y, const void *data,
80  const IMG_Plane &pi);
81 
82  void *fetchWriteScanline(int y, const IMG_Plane &pi);
83 
84  void getAdditionalInfo(UT_String &text) override
85  { myFileToFilter->getAdditionalInfo(text); }
86 
87  /// @{
88  /// Image texture options
90  imageTextureOptions() const override;
91  void clearImageTextureOptions() override;
92  bool setImageTextureOptions(const UT_Options &options) override;
93  void setWriteTag(const char *tag,
94  int n, const char *const *v) override;
95  /// @}
96 private:
97  IMG_File *myFileToFilter;
98 
99 };
100 
102 
103 #endif
IMG_Stat & getInputStat()
const GLdouble * v
Definition: glcorearb.h:837
UT_UniquePtr< IMG_FileFilter > IMG_FileFilterPtr
void getAdditionalInfo(UT_String &text) override
GLint y
Definition: glcorearb.h:103
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:48
int isTopFirst() const override
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define IMG_API
Definition: IMG_API.h:10
GLdouble n
Definition: glcorearb.h:2008
virtual int finishFilter()
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
const IMG_Stat & getInputStat() const
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
void setFileToFilter(IMG_File *file)
void computeCommonData() override
GLint GLenum GLint x
Definition: glcorearb.h:409
int isLeftFirst() const override
A map of string to various well defined value types.
Definition: UT_Options.h:84
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: NanoVDB.h:976
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Definition: IMG_Stat.h:38
IMG_File * getBaseFile() const override
Definition: format.h:895