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

fg_GraphicRaster.h

Go to the documentation of this file.
00001 /* AbiWord -- Embedded graphics for layout
00002  * Copyright (C) 1999 Matt Kimball
00003  * Copyright (C) 2009 Hubert Figuiere
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018  * 02110-1301 USA.
00019  */
00020 
00021 #ifndef FG_GRAPHICRASTER_H
00022 #define FG_GRAPHICRASTER_H
00023 
00024 #include "fg_Graphic.h"
00025 #include "ut_bytebuf.h"
00026 #include "ut_types.h"
00027 
00028 //  An implementation of the FG_Graphic interface for raster files.  The
00029 //  internal file format happens to be PNG OR JPEG
00030 class ABI_EXPORT FG_GraphicRaster : public FG_Graphic
00031 {
00032 public:
00033     enum Format {
00034         PNG_FORMAT = 0,
00035         JPEG_FORMAT
00036     };
00037     static FG_GraphicPtr    createFromChangeRecord(const fl_ContainerLayout *pFL,
00038                                                const PX_ChangeRecord_Object* pcro);
00039     static FG_GraphicPtr createFromStrux(const fl_ContainerLayout *pFL);
00040 
00041     FG_GraphicRaster();
00042     virtual ~FG_GraphicRaster();
00043 
00044     virtual FGType      getType(void) const;
00045     virtual const std::string & getMimeType() const;
00046     virtual FG_ConstGraphicPtr clone(void) const;
00047     virtual double      getWidth(void) const;
00048     virtual double      getHeight(void) const;
00049     virtual const char * getDataId(void) const;
00050     virtual const char * createDataItem(PD_Document *pDoc, const char * szName) const;
00051     virtual GR_Image*   regenerateImage(GR_Graphics* pG);
00052     virtual GR_Image*   generateImage(GR_Graphics* pG,
00053                           const PP_AttrProp * pSpanAP,
00054                           UT_sint32 maxW, UT_sint32 maxH);
00055 
00056     virtual UT_Error    insertIntoDocument(PD_Document* pDoc, UT_uint32 res,
00057                                            UT_uint32 iPos, const char* szName) const;
00058     virtual UT_Error    insertAtStrux(PD_Document* pDoc,
00059                                       UT_uint32 res,
00060                                       UT_uint32 iPos,
00061                                       PTStruxType iStruxType,
00062                                       const char* szName) const;
00063 
00064     bool            setRaster_PNG(const UT_ConstByteBufPtr & pBB);
00065     bool                    setRaster_JPEG(const UT_ConstByteBufPtr & pBB);
00066     virtual const UT_ConstByteBufPtr &  getBuffer() const;
00067     Format              getFormat() const
00068     {
00069         return m_format;
00070     }
00071 
00072     virtual const char * getWidthProp(void);
00073     virtual const char * getHeightProp(void);
00074 
00075 protected:
00076     Format            m_format;
00077     UT_ConstByteBufPtr m_pbb;
00078 
00079     UT_sint32 m_iWidth, m_iHeight;
00080     UT_sint32 m_iMaxW;
00081     UT_sint32 m_iMaxH;
00082     const PP_AttrProp* m_pSpanAP;
00083     const gchar* m_pszDataID;
00084 };
00085 
00086 typedef std::unique_ptr<FG_GraphicRaster> FG_GraphicRasterPtr;
00087 // no Const since we use FG_ConstGraphicPtr.
00088 
00089 #endif /* FG_GRAPHICRASTER_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1