kfbximageconverter.h
Go to the documentation of this file.00001
00004 #ifndef _FBXSDK_IMAGE_CONVERTER_H_
00005 #define _FBXSDK_IMAGE_CONVERTER_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 <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047 #include <kaydara.h>
00048
00049 #include <klib/kstring.h>
00050
00051 #ifndef MB_FBXSDK
00052 #include <kbaselib_nsuse.h>
00053 #endif
00054 #include <kbaselib_forward.h>
00055 #include <kfbxplugins/kfbxobject.h>
00056
00057 #include <fbxfilesdk_nsbegin.h>
00058
00059 class KFbxSdkManager;
00060
00061 const int ColorSpaceRGB = 0;
00062 const int ColorSpaceYUV = 1;
00063 const int FileToBuffer = 0;
00064 const int BufferToFile = 1;
00065
00066 class ImageConverterBuffer
00067 {
00068 private:
00069 int mWidth;
00070 int mHeight;
00071 int mColorSpace;
00072 int mPixelSize;
00073 kByte *mData;
00074
00075 bool mOriginalFormat;
00076 KString mOriginalFileName;
00077
00078 bool mValid;
00079 bool mUseDataBuffer;
00080
00081
00082 public:
00083 ImageConverterBuffer();
00084 ~ImageConverterBuffer();
00085
00089 bool IsValid() { return mValid; }
00090
00094 bool UseDataBuffer() { return mUseDataBuffer; }
00095
00099 int GetWidth() { return mWidth; }
00100
00104 int GetHeight() { return mHeight; }
00105
00109 int GetColorSpace() { return mColorSpace; }
00110
00114 char GetPixelSize() { return (char) mPixelSize; }
00115
00119 kByte* GetData() { return mData; }
00120
00124 bool GetOriginalFormat() { return mOriginalFormat; }
00125
00132 KString GetOriginalFileName() { return mOriginalFileName; }
00133
00143 void Init(int pWidth, int pHeight, bool pUseDataBuffer, int pColorSpace = ColorSpaceRGB, char pPixelSize = 4);
00144
00148 void SetOriginalFormat(bool pState);
00149
00153 void SetOriginalFileName(KString pFilename);
00154 };
00155
00156
00157
00158 typedef int (*ImageConverterFunction)(int pDirection, KString& pFileName, ImageConverterBuffer& pBuffer);
00159
00160
00162 class KFBX_DLL KFbxImageConverter : public KFbxObject
00163 {
00164 KFBXOBJECT_DECLARE(KFbxImageConverter);
00165
00166 public:
00167
00175 void RegisterConverterFunction(KString pFileExt, ImageConverterFunction pFct);
00176
00180 void UnregisterConverterFunction(ImageConverterFunction pFct);
00181
00188 bool Convert(int pDirection, KString& pFileName, ImageConverterBuffer& pBuffer);
00189
00190 protected:
00192
00193
00194
00195
00196
00197
00199
00200 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00201
00202 KFbxImageConverter(KFbxSdkManager& pManager,char const *pName);
00203 ~KFbxImageConverter();
00204
00205 KCharPtrSet* mConverterFunctions;
00206 KFbxSdkManager* mManager;
00207
00208 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00209
00210 };
00211
00212
00213 bool IsCompressedTif(KString pFile);
00214 bool ReadFromTif(KString pFile, ImageConverterBuffer& pBuffer, bool deleteFile);
00215 bool WriteToTif(KString pFile, bool pCompressed, ImageConverterBuffer& pBuffer);
00216
00217 #include <fbxfilesdk_nsend.h>
00218
00219 #endif // #ifndef _FBXSDK_IMAGE_CONVERTER_H_
00220
00221