HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IMG_FormatPassThru.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_FormatPassThru.h ( IMG Library, C++)
7  *
8  * COMMENTS: Creates a format which is used for creating a pass-thru image
9  * format. For example a flip or scale format which gets
10  * information from the parent format.
11  *
12  * !!grep virtual IMG_Format.h
13  virtual ~IMG_Format();
14  virtual const char *getFormatName() const = 0;
15  virtual const char *getFormatLabel() const;
16  virtual const char *getFormatDescription() const;
17  virtual bool isPassThrough() const { return false; }
18  virtual const char *getDefaultExtension() const;
19  virtual const char *getFormatLocation() const { return myLocation; }
20  virtual int checkExtension(const char *filename) const = 0;
21  virtual int checkMagic(unsigned int) const;
22  virtual int checkMagicSeekable(UT_IStream &is) const;
23  virtual int checkDevice(const char *) const;
24  virtual IMG_DataType getAllowedTypes() const;
25  virtual IMG_ColorModel getColorModel() const;
26  virtual unsigned getMaxImages() const = 0;
27  virtual void getMaxResolution(unsigned &x,
28  virtual int isReadRandomAccess() const;
29  virtual int isWriteRandomAccess() const;
30  virtual int isTopFirst() const;
31  virtual const IMG_FileOptionList *getOptions() const;
32  virtual IMG_File *createFile() const = 0;
33  virtual int isFormatOk(const IMG_Stat &stat) const;
34  */
35 
36 #ifndef __IMG_FormatPassThru__
37 #define __IMG_FormatPassThru__
38 
39 #include "IMG_API.h"
40 #include "IMG_Format.h"
41 
42 #include <stddef.h> // For NULL
43 
45 public:
46  // Ensure we pass through to the non-list based img format so
47  // we don't have to remove ourselves from the list.
48  // This also avoids threading problems if we create pass throughs
49  // in a multi-threaded environment as the list isn't locked.
50  IMG_FormatPassThru(const IMG_File *parent_file) : IMG_Format(false)
51  {
52  myParent = parent_file;
53  }
54 
55  virtual ~IMG_FormatPassThru() {}
56 
57  virtual const char *getFormatName() const
58  { return getParent()->getFormatName(); }
59  virtual const char *getFormatLabel() const
60  { return getParent()->getFormatLabel(); }
61  virtual const char *getFormatDescription() const
62  { return getParent()->getFormatDescription(); }
63  virtual const char *getDefaultExtension() const
64  { return getParent()->getDefaultExtension(); }
65  virtual const char *getFormatLocation() const
66  { return getParent()->getFormatLocation(); }
67 
68  virtual int checkExtension(const char *filename) const
69  { return getParent()->checkExtension(filename); }
70  virtual int checkMagic(unsigned int magic) const
71  { return getParent()->checkMagic(magic); }
72  virtual int checkMagicSeekable(UT_IStream &is) const
73  { return getParent()->checkMagicSeekable(is); }
74 
75  virtual bool isPassThrough() const { return true; }
76 
77  virtual int checkDevice(const char *filename) const
78  { return getParent()->checkDevice(filename); }
79 
81  { return getParent()->getSupportedTypes(); }
83  { return getParent()->getSupportedColorModels(); }
84  virtual void getMaxResolution(unsigned &x,
85  unsigned &y) const
86  { getParent()->getMaxResolution( x, y ); }
87 
88 
89  virtual int isReadRandomAccess() const
90  { return getParent()->isReadRandomAccess(); }
91  virtual int isWriteRandomAccess() const
92  { return getParent()->isWriteRandomAccess(); }
93  virtual int isTopFirst() const
94  { return getParent()->isTopFirst(); }
95  virtual int isLeftFirst() const
96  { return getParent()->isLeftFirst(); }
97 
98  virtual bool isDataWindowSupported() const
99  { return getParent()->isDataWindowSupported(); }
100  virtual bool isDataWindowStreakSupported() const
101  { return getParent()->isDataWindowStreakSupported(); }
102 
103  virtual bool isDeepRasterSupported() const
104  { return getParent()->isDeepRasterSupported(); }
105 
106  virtual bool isDataInterleaved() const
107  { return getParent()->isDataInterleaved(); }
108 
109  virtual bool canPlaneTypesDiffer() const
110  { return getParent()->canPlaneTypesDiffer(); }
111 
112  virtual const IMG_FileOptionList *getOptions() const
113  { return getParent()->getOptions(); }
114 
116  { return getParent()->formatColorSpace(); }
118  { return getParent()->formatColorSpaceGamma(); }
119  virtual bool formatStoresColorSpace() const
120  { return getParent()->formatStoresColorSpace();}
121 
122 protected:
123 
124  virtual IMG_File *createFile() const
125  { return NULL; }
126  virtual int isFormatOk(const IMG_Stat &) const
127  { return 0; }
128 
129  const IMG_Format *getParent() const
130  { return myParent->getBaseFile()->getFormat(); }
131 
133 
134 private:
135  // Forbid the plain declaration of this class as we want to always
136  // invoked IMG_Format(false).
137  IMG_FormatPassThru() { }
138 };
139 
140 #endif
virtual int checkMagicSeekable(UT_IStream &is) const
virtual const char * getFormatName() const
virtual bool formatStoresColorSpace() const
Return true if the image format can store the colorspace.
virtual bool isDataWindowSupported() const
does this format support a data window or sub-area.
virtual PXL_ColorSpace formatColorSpace() const
virtual void getMaxResolution(unsigned &x, unsigned &y) const
GLint y
Definition: glcorearb.h:102
virtual IMG_File * createFile() const
virtual int isReadRandomAccess() const
virtual int checkExtension(const char *filename) const
static const IMG_Format * getFormat(int idx)
Access to the list of currently installed image formats.
virtual IMG_DataType getSupportedTypes() const
Returns a bitfield of data types supported by this format.
#define IMG_API
Definition: IMG_API.h:10
virtual int isFormatOk(const IMG_Stat &) const
virtual const char * getFormatDescription() const
IMG_DataType
Definition: IMG_FileTypes.h:17
const IMG_File * myParent
virtual int checkMagic(unsigned int magic) const
virtual const IMG_FileOptionList * getOptions() const
virtual IMG_ColorModel getSupportedColorModels() const
virtual bool isDataInterleaved() const
virtual int checkDevice(const char *filename) const
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:54
const IMG_Format * getParent() const
virtual bool canPlaneTypesDiffer() const
virtual int isTopFirst() const
virtual fpreal formatColorSpaceGamma() const
virtual int isWriteRandomAccess() const
double fpreal
Definition: SYS_Types.h:269
virtual int isLeftFirst() const
PXL_ColorSpace
Definition: PXL_Common.h:42
virtual bool isPassThrough() const
IMG_ColorModel
Definition: IMG_FileTypes.h:53
GLint GLenum GLint x
Definition: glcorearb.h:408
virtual const char * getFormatLabel() const
virtual bool isDataWindowStreakSupported() const
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 const char * getFormatLocation() const
Describes how the format was loaded (i.e. DSO or internal formats)
IMG_FormatPassThru(const IMG_File *parent_file)
virtual const char * getDefaultExtension() const
virtual bool isDeepRasterSupported() const