• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ie_impGraphic_Win32Native.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
00002 
00003 /* AbiWord
00004  *
00005  * Copyright (C) 2003 Jordi Mas i Hernàndez
00006  * Copyright (C) 2003 Dom Lachowicz
00007  * Win32 native plugin based on win32 IPicture interface *
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation; either version 2
00012  * of the License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022  * 02110-1301 USA.
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   // PNG structures used
00060   png_structp m_pPNG;               // libpng structure for the PNG Object
00061   png_infop   m_pPNGInfo;           // libpng structure for info on the PNG Object
00062 
00063   // BMP File Header Data
00064   UT_uint16 m_iFileType;        // type - 'BM' for Bitmaps
00065   UT_uint32 m_iFileSize;        // file size in bytes
00066   UT_uint16 m_iXHotspot;        // 0 or x hotspot
00067   UT_uint16 m_iYHotspot;        // 0 or y hotspot
00068   UT_uint32 m_iOffset;          // Offset to BMP image
00069 
00070   // BMP Header Data
00071   UT_uint32 m_iHeaderSize;      // Size of Header Data
00072   UT_sint32 m_iWidth;           // Image Width in pixels
00073   UT_sint32 m_iHeight;          // Image Height in pixels
00074   UT_uint16 m_iPlanes;          // Number of Planes == 1
00075   UT_uint16 m_iBitsPerPlane;    // Bit per pixel
00076   UT_uint32 m_iCompression;     // compression flag
00077   UT_uint32 m_iImageSize;       // Image size in bytes
00078   UT_uint32 m_iXResolution;     // Horizontal Resolution (Pels/Meter)
00079   UT_uint32 m_iYResolution;     // Vertical Resolution (Pels/Meter)
00080   UT_uint32 m_iClrUsed;         // Color Table Size
00081   UT_uint32 m_iClrImportant;    // Important Color Count
00082   UT_uint16 m_iResolutionUnits; // Units of Measure
00083   UT_uint16 m_iPadding;         // Reserved
00084   UT_uint16 m_iOrigin;          // Recording Algorithm
00085   UT_uint16 m_iHalfToning;      // Halftoning Algorithm
00086   UT_uint32 m_iHalfToningParam1;// Size Value 1
00087   UT_uint32 m_iHalfToningParam2;// Size Value 2
00088   UT_uint32 m_iClrEncoding;     // Color Encoding
00089   UT_uint32 m_iIdentifier;      //
00090 
00091   // BMP Utility Data
00092   UT_uint32   m_iBytesRead;     // Number of Bytes Read
00093   bool      m_bOldBMPFormat;    // Older smaller file type
00094   bool      m_bHeaderDone;      // Check to see if finshed Reading Header
00095 
00096   UT_ByteBuf*  m_pBB;               // pBB Converted to PNG File
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

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1