00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXIMAGECONVERTER_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXIMAGECONVERTER_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044
00045 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00046
00047 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00048 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00049
00050 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00051
00052 class KFbxSdkManager;
00053
00054 const int ColorSpaceRGB = 0;
00055 const int ColorSpaceYUV = 1;
00056 const int FileToBuffer = 0;
00057 const int BufferToFile = 1;
00058
00062 class KFBX_DLL ImageConverterBuffer
00063 {
00064 private:
00065 int mWidth;
00066 int mHeight;
00067 int mColorSpace;
00068 int mPixelSize;
00069 kByte *mData;
00070
00071 bool mOriginalFormat;
00072 KString mOriginalFileName;
00073
00074 bool mValid;
00075 bool mUseDataBuffer;
00076
00077
00078 public:
00083
00085 ImageConverterBuffer();
00087 ~ImageConverterBuffer();
00089
00093 bool IsValid() { return mValid; }
00094
00098 bool UseDataBuffer() { return mUseDataBuffer; }
00099
00103 int GetWidth() { return mWidth; }
00104
00108 int GetHeight() { return mHeight; }
00109
00113 int GetColorSpace() { return mColorSpace; }
00114
00118 char GetPixelSize() { return (char) mPixelSize; }
00119
00123 kByte* GetData() { return mData; }
00124
00128 bool GetOriginalFormat() { return mOriginalFormat; }
00129
00136 KString GetOriginalFileName() { return mOriginalFileName; }
00137
00147 void Init(int pWidth, int pHeight, bool pUseDataBuffer, int pColorSpace = ColorSpaceRGB, char pPixelSize = 4);
00148
00152 void SetOriginalFormat(bool pState);
00153
00157 void SetOriginalFileName(KString pFilename);
00158 };
00159
00160
00161
00162 typedef int (*ImageConverterFunction)(int pDirection, KString& pFileName, ImageConverterBuffer& pBuffer);
00163
00164
00166 class KFBX_DLL KFbxImageConverter : public KFbxObject
00167 {
00168 KFBXOBJECT_DECLARE(KFbxImageConverter,KFbxObject);
00169
00170 public:
00171
00179 void RegisterConverterFunction(KString pFileExt, ImageConverterFunction pFct);
00180
00184 void UnregisterConverterFunction(ImageConverterFunction pFct);
00185
00192 bool Convert(int pDirection, KString& pFileName, ImageConverterBuffer& pBuffer);
00193
00195
00196
00197
00198
00199
00200
00202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00203
00204 protected:
00205
00206 virtual KFbxObject* Clone( KFbxObject* pContainer, KFbxObject::ECloneType pCloneType ) const;
00207 KFbxImageConverter(KFbxSdkManager& pManager,char const *pName);
00208 ~KFbxImageConverter();
00209
00210 KFbxImageConverter& operator=( const KFbxImageConverter& pOther );
00211
00212 KCharPtrSet* mConverterFunctions;
00213 KFbxSdkManager* mManager;
00214
00215 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00216
00217 };
00218
00219
00220 KFBX_DLL bool IsCompressedTif(KString pFile);
00221 KFBX_DLL bool ReadFromTif(KString pFile, ImageConverterBuffer& pBuffer, bool deleteFile);
00222 KFBX_DLL bool WriteToTif(KString pFile, bool pCompressed, ImageConverterBuffer& pBuffer);
00223
00224 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00225
00226 #endif // FBXFILESDK_KFBXPLUGINS_KFBXIMAGECONVERTER_H
00227