Question: How do I rasterize an SVG to a BitmapEx

Thorsten Behrens thb at documentfoundation.org
Mon Feb 27 01:30:49 PST 2012


Andrew Higginson wrote:
> I can see there are various classes (i.e. vcl::SVGReader and
> vcl::RenderGraphicRasterizer) which may do the job, however I need to
> rasterize it to a specific resolution (pretty much what
> vcl::RenderGraphicRasterizer::Rasterize does) however I don't want to
> duplicate any code.
> 
Hi Andrew,

this should do:

 const ::vcl::RenderGraphicRasterizer aRaster( 
     "image/svg+xml",
     aSvgData.getLength(),
     aSvgData.getConstArray() );

 BitmapEx aBmpEx = aRaster.Rasterize( Size(200,300) );

(with your desired size filled in above, of course)

HTH,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120227/7102a9c1/attachment.pgp>


More information about the LibreOffice mailing list