// This actually creates our FG_Graphic object for a PNG UT_Error IE_ImpGraphic_Win32Native::importGraphic(UT_ByteBuf* pBB, FG_Graphic ** ppfg) { std::string mimetype; UT_Error err = _convertGraphic(pBB, mimetype); if (err != UT_OK) return err; /* Send Data back to AbiWord as PNG */ FG_GraphicRaster *pFGR; pFGR = new FG_GraphicRaster(); if(pFGR == NULL) return UT_IE_NOMEMORY; if (mimetype == "image/jpeg") { if(!pFGR->setRaster_JPEG(m_pBB)) { DELETEP(pFGR); return UT_IE_FAKETYPE; } } else { if(!pFGR->setRaster_PNG(m_pBB)) { DELETEP(pFGR); return UT_IE_FAKETYPE; } } *ppfg = static_cast<FG_Graphic *>(pFGR); return UT_OK; }
// This actually creates our FG_Graphic object for a PNG UT_Error IE_ImpGraphic_BMP::importGraphic(UT_ByteBuf* pBB, FG_Graphic ** ppfg) { UT_Error err = _convertGraphic(pBB); if (err != UT_OK) return err; /* Send Data back to AbiWord as PNG */ FG_GraphicRaster *pFGR; pFGR = new FG_GraphicRaster(); if(pFGR == NULL) return UT_IE_NOMEMORY; if(!pFGR->setRaster_PNG(m_pBB)) { DELETEP(pFGR); return UT_IE_FAKETYPE; } *ppfg = static_cast<FG_Graphic *>(pFGR); return UT_OK; }