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

ie_impGraphic_GdkPixbuf.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
00002 
00003 /* AbiWord Graphic importer employing GdkPixbuf
00004  * Copyright (C) 2001 Martin Sevior
00005  * Copyright (C) 2002 Dom Lachowicz
00006  * Copyright (C) 2005 Marc Maurer
00007  * Copyright (C) 2009 Hubert Figuiere
00008  *
00009  * Portions from GdkPixBuf Library
00010  * Copyright (C) 1999 The Free Software Foundation
00011  *
00012  * This program is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU General Public License
00014  * as published by the Free Software Foundation; either version 2
00015  * of the License, or (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00025  * 02111-1307, USA.
00026  */
00027 
00028 #include <string.h>
00029 
00030 #include <string>
00031 
00032 #include <glib.h>
00033 #include <gdk-pixbuf/gdk-pixbuf.h>
00034 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
00035 #include <gdk-pixbuf/gdk-pixbuf-io.h>
00036 
00037 #include "ut_debugmsg.h"
00038 #include "ut_types.h"
00039 #include "ut_vector.h"
00040 #include "ut_string.h"
00041 #include "xap_Module.h"
00042 #include "ie_impGraphic.h"
00043 #include "fg_GraphicRaster.h"
00044 #include <png.h>
00045 
00046 #ifndef IE_IMPGRAPHIC_GDKPIXBUF_H
00047 #define IE_IMPGRAPHIC_GDKPIXBUF_H
00048 
00049 class ABI_EXPORT IE_ImpGraphic_GdkPixbuf : public IE_ImpGraphic
00050 {
00051 public:
00052 
00053     IE_ImpGraphic_GdkPixbuf();
00054     virtual ~IE_ImpGraphic_GdkPixbuf();
00055 
00056     virtual UT_Error importGraphic(UT_ByteBuf * pBB, FG_Graphic ** ppfg);
00057 
00058 private:
00059 
00060     GdkPixbuf * pixbufForByteBuf (UT_ByteBuf * pBB, std::string & mimetype);
00061     void _createPNGFromPixbuf(GdkPixbuf * pixbuf);
00062     UT_Error _png_write(GdkPixbuf * pixbuf);
00063 
00064     GdkPixbuf * _loadXPM(UT_ByteBuf * pBB);
00065     UT_Error Initialize_PNG(void);
00066 
00067     // PNG structures used
00068     png_structp m_pPNG;             // libpng structure for the PNG Object
00069     png_infop   m_pPNGInfo;         // libpng structure for info on the PNG Object
00070     UT_ByteBuf*  m_pPngBB;          // pBB Converted to PNG File
00071     bool m_bIsXPM;
00072 };
00073 
00074 class ABI_EXPORT IE_ImpGraphicGdkPixbuf_Sniffer : public IE_ImpGraphicSniffer
00075 {
00076 public:
00077     IE_ImpGraphicGdkPixbuf_Sniffer();
00078     virtual ~IE_ImpGraphicGdkPixbuf_Sniffer();
00079 
00080     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00081     virtual const IE_MimeConfidence * getMimeConfidence ();
00082     virtual UT_Confidence_t recognizeContents(const char * szBuf, UT_uint32 iNum);
00083     virtual bool getDlgLabels(const char ** pszDesc,
00084                               const char ** pszSuffixList,
00085                               IEGraphicFileType * ft);
00086     virtual UT_Error constructImporter(IE_ImpGraphic **ppieg);
00087 };
00088 
00089 #endif // IE_IMPGRAPHIC_GDKPIXBUF_H
00090 

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1