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 #include <stddef.h> // For NULL 00051 00052 class IMG_API IMG_FormatPassThru : public IMG_Format { 00053 public: 00054 // Ensure we pass through to the non-list based img format so 00055 // we don't have to remove ourselves from the list. 00056 // This also avoids threading problems if we create pass throughs 00057 // in a multi-threaded environment as the list isn't locked. 00058 IMG_FormatPassThru(const IMG_File *parent_file) : IMG_Format(false) 00059 { 00060 myParent = parent_file; 00061 } 00062 00063 virtual ~IMG_FormatPassThru() {} 00064 00065 virtual const char *getFormatName() const 00066 { return getParent()->getFormatName(); } 00067 virtual const char *getFormatLabel() const 00068 { return getParent()->getFormatLabel(); } 00069 virtual const char *getFormatDescription() const 00070 { return getParent()->getFormatDescription(); } 00071 virtual const char *getDefaultExtension() const 00072 { return getParent()->getDefaultExtension(); } 00073 virtual const char *getFormatLocation() const 00074 { return getParent()->getFormatLocation(); } 00075 00076 virtual int checkExtension(const char *filename) const 00077 { return getParent()->checkExtension(filename); } 00078 virtual int checkMagic(unsigned int magic) const 00079 { return getParent()->checkMagic(magic); } 00080 virtual int checkMagicSeekable(UT_IStream &is) const 00081 { return getParent()->checkMagicSeekable(is); } 00082 00083 virtual bool isPassThrough() const { return true; } 00084 00085 virtual int checkDevice(const char *filename) const 00086 { return getParent()->checkDevice(filename); } 00087 00088 virtual IMG_DataType getSupportedTypes() const 00089 { return getParent()->getSupportedTypes(); } 00090 virtual IMG_ColorModel getSupportedColorModels() const 00091 { return getParent()->getSupportedColorModels(); } 00092 virtual void getMaxResolution(unsigned &x, 00093 unsigned &y) const 00094 { getParent()->getMaxResolution( x, y ); } 00095 00096 00097 virtual int isReadRandomAccess() const 00098 { return getParent()->isReadRandomAccess(); } 00099 virtual int isWriteRandomAccess() const 00100 { return getParent()->isWriteRandomAccess(); } 00101 virtual int isTopFirst() const 00102 { return getParent()->isTopFirst(); } 00103 virtual int isLeftFirst() const 00104 { return getParent()->isLeftFirst(); } 00105 00106 virtual bool isDataWindowSupported() const 00107 { return getParent()->isDataWindowSupported(); } 00108 virtual bool isDataWindowStreakSupported() const 00109 { return getParent()->isDataWindowStreakSupported(); } 00110 00111 virtual bool isDeepRasterSupported() const 00112 { return getParent()->isDeepRasterSupported(); } 00113 00114 virtual bool isDataInterleaved() const 00115 { return getParent()->isDataInterleaved(); } 00116 00117 virtual bool canPlaneTypesDiffer() const 00118 { return getParent()->canPlaneTypesDiffer(); } 00119 00120 virtual const IMG_FileOptionList *getOptions() const 00121 { return getParent()->getOptions(); } 00122 00123 protected: 00124 00125 virtual IMG_File *createFile() const 00126 { return NULL; } 00127 virtual int isFormatOk(const IMG_Stat &) const 00128 { return 0; } 00129 00130 const IMG_Format *getParent() const 00131 { return myParent->getBaseFile()->getFormat(); } 00132 00133 const IMG_File *myParent; 00134 00135 private: 00136 // Forbid the plain declaration of this class as we want to always 00137 // invoked IMG_Format(false). 00138 IMG_FormatPassThru() { } 00139 }; 00140 00141 #endif
1.5.9