00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: IMG_FormatPassThru.h ( IMG Library, C++) 00015 * 00016 * COMMENTS: Creates a format which is used for creating a pass-thru image 00017 * format. For example a flip or scale format which gets 00018 * information from the parent format. 00019 * 00020 * !!grep virtual IMG_Format.h 00021 virtual ~IMG_Format(); 00022 virtual const char *getFormatName() const = 0; 00023 virtual const char *getFormatLabel() const; 00024 virtual const char *getFormatDescription() const; 00025 virtual bool isPassThrough() const { return false; } 00026 virtual const char *getDefaultExtension() const; 00027 virtual const char *getFormatLocation() const { return myLocation; } 00028 virtual int checkExtension(const char *filename) const = 0; 00029 virtual int checkMagic(unsigned int) const; 00030 virtual int checkMagicSeekable(UT_IStream &is) const; 00031 virtual int checkDevice(const char *) const; 00032 virtual IMG_DataType getAllowedTypes() const; 00033 virtual IMG_ColorModel getColorModel() const; 00034 virtual unsigned getMaxImages() const = 0; 00035 virtual void getMaxResolution(unsigned &x, 00036 virtual int isReadRandomAccess() const; 00037 virtual int isWriteRandomAccess() const; 00038 virtual int isTopFirst() const; 00039 virtual const IMG_FileOptionList *getOptions() const; 00040 virtual IMG_File *createFile() const = 0; 00041 virtual int isFormatOk(const IMG_Stat &stat) const; 00042 */ 00043 00044 #ifndef __IMG_FormatPassThru__ 00045 #define __IMG_FormatPassThru__ 00046 00047 #include "IMG_API.h" 00048 #include "IMG_Format.h" 00049 00050 class IMG_API IMG_FormatPassThru : public IMG_Format { 00051 public: 00052 // Ensure we pass through to the non-list based img format so 00053 // we don't have to remove ourselves from the list. 00054 // This also avoids threading problems if we create pass throughs 00055 // in a multi-threaded environment as the list isn't locked. 00056 IMG_FormatPassThru(const IMG_File *parent_file) : IMG_Format(false) 00057 { 00058 myParent = parent_file; 00059 } 00060 00061 virtual ~IMG_FormatPassThru() {} 00062 00063 virtual const char *getFormatName() const 00064 { return getParent()->getFormatName(); } 00065 virtual const char *getFormatLabel() const 00066 { return getParent()->getFormatLabel(); } 00067 virtual const char *getFormatDescription() const 00068 { return getParent()->getFormatDescription(); } 00069 virtual const char *getDefaultExtension() const 00070 { return getParent()->getDefaultExtension(); } 00071 virtual const char *getFormatLocation() const 00072 { return getParent()->getFormatLocation(); } 00073 00074 virtual int checkExtension(const char *filename) const 00075 { return getParent()->checkExtension(filename); } 00076 virtual int checkMagic(unsigned int magic) const 00077 { return getParent()->checkMagic(magic); } 00078 virtual int checkMagicSeekable(UT_IStream &is) const 00079 { return getParent()->checkMagicSeekable(is); } 00080 00081 virtual bool isPassThrough() const { return true; } 00082 00083 virtual int checkDevice(const char *filename) const 00084 { return getParent()->checkDevice(filename); } 00085 00086 virtual IMG_DataType getSupportedTypes() const 00087 { return getParent()->getSupportedTypes(); } 00088 virtual IMG_ColorModel getSupportedColorModels() const 00089 { return getParent()->getSupportedColorModels(); } 00090 virtual void getMaxResolution(unsigned &x, 00091 unsigned &y) const 00092 { getParent()->getMaxResolution( x, y ); } 00093 00094 00095 virtual int isReadRandomAccess() const 00096 { return getParent()->isReadRandomAccess(); } 00097 virtual int isWriteRandomAccess() const 00098 { return getParent()->isWriteRandomAccess(); } 00099 virtual int isTopFirst() const 00100 { return getParent()->isTopFirst(); } 00101 virtual int isLeftFirst() const 00102 { return getParent()->isLeftFirst(); } 00103 00104 virtual bool isDataWindowSupported() const 00105 { return getParent()->isDataWindowSupported(); } 00106 virtual bool isDataWindowStreakSupported() const 00107 { return getParent()->isDataWindowStreakSupported(); } 00108 00109 virtual bool isDeepRasterSupported() const 00110 { return getParent()->isDeepRasterSupported(); } 00111 00112 virtual bool isDataInterleaved() const 00113 { return getParent()->isDataInterleaved(); } 00114 00115 virtual bool canPlaneTypesDiffer() const 00116 { return getParent()->canPlaneTypesDiffer(); } 00117 00118 virtual const IMG_FileOptionList *getOptions() const 00119 { return getParent()->getOptions(); } 00120 00121 protected: 00122 00123 virtual IMG_File *createFile() const 00124 { return NULL; } 00125 virtual int isFormatOk(const IMG_Stat &) const 00126 { return 0; } 00127 00128 const IMG_Format *getParent() const 00129 { return myParent->getBaseFile()->getFormat(); } 00130 00131 const IMG_File *myParent; 00132 00133 private: 00134 // Forbid the plain declaration of this class as we want to always 00135 // invoked IMG_Format(false). 00136 IMG_FormatPassThru() { } 00137 }; 00138 00139 #endif
1.5.9