HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
13 #ifndef __IMG_FormatPassThru__
14 #define __IMG_FormatPassThru__
15 
16 #include "IMG_API.h"
17 #include "IMG_Format.h"
18 
19 #include <stddef.h> // For NULL
20 
22 public:
23  // Ensure we pass through to the non-list based img format so
24  // we don't have to remove ourselves from the list.
25  // This also avoids threading problems if we create pass throughs
26  // in a multi-threaded environment as the list isn't locked.
27  IMG_FormatPassThru(const IMG_File *parent_file) : IMG_Format(false)
28  {
29  myParent = parent_file;
30  }
31 
32  ~IMG_FormatPassThru() override {}
33 
34  const char *getFormatName() const override
35  { return getParent()->getFormatName(); }
36  const char *getFormatLabel() const override
37  { return getParent()->getFormatLabel(); }
38  const char *getFormatDescription() const override
39  { return getParent()->getFormatDescription(); }
40  const char *getDefaultExtension() const override
41  { return getParent()->getDefaultExtension(); }
42  const char *getFormatLocation() const override
43  { return getParent()->getFormatLocation(); }
44 
45  int checkExtension(const char *filename) const override
46  { return getParent()->checkExtension(filename); }
47  int checkMagic(unsigned int magic) const override
48  { return getParent()->checkMagic(magic); }
49  int checkMagicSeekable(UT_IStream &is) const override
50  { return getParent()->checkMagicSeekable(is); }
51 
52  bool isPassThrough() const override { return true; }
53 
54  int checkDevice(const char *filename) const override
55  { return getParent()->checkDevice(filename); }
56 
58  { return getParent()->getSupportedTypes(); }
60  { return getParent()->getSupportedColorModels(); }
61  void getMaxResolution(unsigned &x,
62  unsigned &y) const override
63  { getParent()->getMaxResolution( x, y ); }
64 
65 
66  int isReadRandomAccess() const override
67  { return getParent()->isReadRandomAccess(); }
68  int isWriteRandomAccess() const override
69  { return getParent()->isWriteRandomAccess(); }
70  int isTopFirst() const override
71  { return getParent()->isTopFirst(); }
72  int isLeftFirst() const override
73  { return getParent()->isLeftFirst(); }
74 
75  bool isDataWindowSupported() const override
76  { return getParent()->isDataWindowSupported(); }
77  bool isDataWindowStreakSupported() const override
78  { return getParent()->isDataWindowStreakSupported(); }
79 
80  bool isDeepRasterSupported() const override
81  { return getParent()->isDeepRasterSupported(); }
82 
83  bool isDataInterleaved() const override
84  { return getParent()->isDataInterleaved(); }
85 
86  bool canPlaneTypesDiffer() const override
87  { return getParent()->canPlaneTypesDiffer(); }
88 
89  const IMG_FileOptionList *getOptions() const override
90  { return getParent()->getOptions(); }
91 
93  { return getParent()->formatColorSpace(); }
94  fpreal formatColorSpaceGamma() const override
95  { return getParent()->formatColorSpaceGamma(); }
96  bool formatStoresColorSpace() const override
97  { return getParent()->formatStoresColorSpace();}
98 
99 protected:
100 
101  IMG_File *createFile() const override
102  { return NULL; }
103  int isFormatOk(const IMG_Stat &) const override
104  { return 0; }
105 
106  const IMG_Format *getParent() const
107  { return myParent->getBaseFile()->getFormat(); }
108 
110 
111 private:
112  // Forbid the plain declaration of this class as we want to always
113  // invoked IMG_Format(false).
114  IMG_FormatPassThru() { }
115 };
116 
117 #endif
IMG_File * createFile() const override
int checkExtension(const char *filename) const override
GT_API const UT_StringHolder filename
bool isDeepRasterSupported() const override
void getMaxResolution(unsigned &x, unsigned &y) const override
const char * getFormatLabel() const override
fpreal formatColorSpaceGamma() const override
bool isDataWindowStreakSupported() const override
const char * getFormatLocation() const override
Describes how the format was loaded (i.e. DSO or internal formats)
PXL_ColorSpace formatColorSpace() const override
static const IMG_Format * getFormat(int idx)
Access to the list of currently installed image formats.
~IMG_FormatPassThru() override
bool canPlaneTypesDiffer() const override
bool isDataInterleaved() const override
#define IMG_API
Definition: IMG_API.h:10
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
bool formatStoresColorSpace() const override
Return true if the image format can store the colorspace.
int checkDevice(const char *filename) const override
IMG_DataType
Definition: IMG_FileTypes.h:17
GU_API GA_Offset getParent(GU_Detail *gdp, const GA_Offset &node)
const IMG_File * myParent
IMG_ColorModel getSupportedColorModels() const override
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:55
bool isDataWindowSupported() const override
does this format support a data window or sub-area.
int checkMagic(unsigned int magic) const override
const IMG_Format * getParent() const
int checkMagicSeekable(UT_IStream &is) const override
int isFormatOk(const IMG_Stat &) const override
const char * getDefaultExtension() const override
int isTopFirst() const override
bool isPassThrough() const override
int isLeftFirst() const override
const char * getFormatDescription() const override
fpreal64 fpreal
Definition: SYS_Types.h:277
int isWriteRandomAccess() const override
PXL_ColorSpace
Definition: PXL_Common.h:68
IMG_DataType getSupportedTypes() const override
Returns a bitfield of data types supported by this format.
IMG_ColorModel
Definition: IMG_FileTypes.h:53
const char * getFormatName() const override
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Definition: IMG_Stat.h:40
IMG_FormatPassThru(const IMG_File *parent_file)
const IMG_FileOptionList * getOptions() const override
int isReadRandomAccess() const override