Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IE_IMPGRAPHICS_WIN32NATIVE_H__
00026 #define IE_IMPGRAPHICS_WIN32NATIVE_H__
00027
00028 #include <png.h>
00029
00030 #include "ie_impGraphic.h"
00031
00032 class UT_ByteBuf;
00033 class FG_Graphic;
00034
00035 class ABI_EXPORT IE_ImpGraphic_Win32Native : public IE_ImpGraphic
00036 {
00037 public:
00038 virtual UT_Error importGraphic(const UT_ConstByteBufPtr & pBB,
00039 FG_ConstGraphicPtr &pfg);
00040 private:
00041 UT_Error _convertGraphic(UT_ByteBuf * pBB, std::string& mimetype);
00042 UT_Error Read_BMP_Header(UT_ByteBuf* pBB);
00043 UT_Error Initialize_PNG();
00044 UT_Error Convert_BMP_Palette(UT_ByteBuf* pBB);
00045 UT_Error Convert_BMP(UT_ByteBuf* pBB);
00046
00047 UT_Byte ReadByte (UT_ByteBuf* pBB,
00048 UT_uint32 offset);
00049 UT_uint16 Read2Bytes(UT_ByteBuf* pBB,
00050 UT_uint32 offset);
00051 UT_uint32 Read4Bytes(UT_ByteBuf* pBB,
00052 UT_uint32 offset);
00053 UT_uint32 ReadBytes(UT_ByteBuf* pBB,
00054 UT_uint32 offset,
00055 UT_uint32 num_bytes);
00056 void InitializePrivateClassData();
00057
00058
00059
00060 png_structp m_pPNG;
00061 png_infop m_pPNGInfo;
00062
00063
00064 UT_uint16 m_iFileType;
00065 UT_uint32 m_iFileSize;
00066 UT_uint16 m_iXHotspot;
00067 UT_uint16 m_iYHotspot;
00068 UT_uint32 m_iOffset;
00069
00070
00071 UT_uint32 m_iHeaderSize;
00072 UT_sint32 m_iWidth;
00073 UT_sint32 m_iHeight;
00074 UT_uint16 m_iPlanes;
00075 UT_uint16 m_iBitsPerPlane;
00076 UT_uint32 m_iCompression;
00077 UT_uint32 m_iImageSize;
00078 UT_uint32 m_iXResolution;
00079 UT_uint32 m_iYResolution;
00080 UT_uint32 m_iClrUsed;
00081 UT_uint32 m_iClrImportant;
00082 UT_uint16 m_iResolutionUnits;
00083 UT_uint16 m_iPadding;
00084 UT_uint16 m_iOrigin;
00085 UT_uint16 m_iHalfToning;
00086 UT_uint32 m_iHalfToningParam1;
00087 UT_uint32 m_iHalfToningParam2;
00088 UT_uint32 m_iClrEncoding;
00089 UT_uint32 m_iIdentifier;
00090
00091
00092 UT_uint32 m_iBytesRead;
00093 bool m_bOldBMPFormat;
00094 bool m_bHeaderDone;
00095
00096 UT_ByteBuf* m_pBB;
00097
00098 };
00099
00100
00101 class ABI_EXPORT IE_ImpGraphicWin32Native_Sniffer : public IE_ImpGraphicSniffer
00102 {
00103 public:
00104
00105 const IE_MimeConfidence * getMimeConfidence ();
00106 const IE_SuffixConfidence * getSuffixConfidence ();
00107 virtual UT_Confidence_t recognizeContents (const char * szBuf,
00108 UT_uint32 iNumbytes);
00109 virtual bool getDlgLabels (const char ** pszDesc,
00110 const char ** pszSuffixList,
00111 IEGraphicFileType * ft);
00112 virtual UT_Error constructImporter (IE_ImpGraphic ** ppieg);
00113 };
00114
00115
00116 #endif