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 
21 {
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  const char *getFormatName() const override
33  { return getParent()->getFormatName(); }
34  const char *getFormatLabel() const override
35  { return getParent()->getFormatLabel(); }
36  const char *getFormatDescription() const override
37  { return getParent()->getFormatDescription(); }
38  const char *getDefaultExtension() const override
39  { return getParent()->getDefaultExtension(); }
40  const char *getFormatLocation() const override
41  { return getParent()->getFormatLocation(); }
42 
43  int checkExtension(const char *filename) const override
44  { return getParent()->checkExtension(filename); }
45  int checkMagic(unsigned int magic) const override
46  { return getParent()->checkMagic(magic); }
47  int checkMagicSeekable(UT_IStream &is) const override
48  { return getParent()->checkMagicSeekable(is); }
49 
50  bool isPassThrough() const override { return true; }
51 
52  int checkDevice(const char *filename) const override
53  { return getParent()->checkDevice(filename); }
54 
56  { return getParent()->getSupportedTypes(); }
58  { return getParent()->getSupportedColorModels(); }
59  void getMaxResolution(unsigned &x,
60  unsigned &y) const override
61  { getParent()->getMaxResolution( x, y ); }
62 
63 
64  int isReadRandomAccess() const override
65  { return getParent()->isReadRandomAccess(); }
66  int isWriteRandomAccess() const override
67  { return getParent()->isWriteRandomAccess(); }
68  int isTopFirst() const override
69  { return getParent()->isTopFirst(); }
70  int isLeftFirst() const override
71  { return getParent()->isLeftFirst(); }
72 
73  bool isDataWindowSupported() const override
74  { return getParent()->isDataWindowSupported(); }
75  bool isDataWindowStreakSupported() const override
76  { return getParent()->isDataWindowStreakSupported(); }
77 
78  bool isDeepRasterSupported() const override
79  { return getParent()->isDeepRasterSupported(); }
80 
81  bool isDataInterleaved() const override
82  { return getParent()->isDataInterleaved(); }
83 
84  bool canPlaneTypesDiffer() const override
85  { return getParent()->canPlaneTypesDiffer(); }
86 
87  const IMG_FileOptionList *getOptions() const override
88  { return getParent()->getOptions(); }
89  const IMG_MetadataOptions &formatMetadata() const override
90  { return getParent()->formatMetadata(); }
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 nullptr; }
103  int isFormatOk(const IMG_Stat &) const override
104  { return 0; }
105 
106  const IMG_Format *getParent() const
107  { return myParent->getBaseFile()->getFormat(); }
108 
109  const IMG_File *myParent;
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
const IMG_MetadataOptions & formatMetadata() const override
Returns list of well known metadata for the format.
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
GLint y
Definition: glcorearb.h:103
const char * getFormatLocation() const override
Describes how the format was loaded (i.e. DSO or internal formats)
PXL_ColorSpace formatColorSpace() const override
GU_API GA_Offset getParent(const GU_Detail *gdp, const GA_Offset &node)
static const IMG_Format * getFormat(int idx)
Access to the list of currently installed image formats.
bool canPlaneTypesDiffer() const override
bool isDataInterleaved() const override
#define IMG_API
Definition: IMG_API.h:10
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
const IMG_File * myParent
IMG_ColorModel getSupportedColorModels() const override
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
GLint GLenum GLint x
Definition: glcorearb.h:409
int isFormatOk(const IMG_Stat &) const override
const char * getDefaultExtension() const override
A list of well-known metdata that a format understands. The list is ordered.
Definition: IMG_Metadata.h:370
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:72
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:38
IMG_FormatPassThru(const IMG_File *parent_file)
const IMG_FileOptionList * getOptions() const override
int isReadRandomAccess() const override