开发者

Drawing SVG images in wxWidgets

I need to be able to draw SVG images (with the ability to scale, and rotate the images by 90,180 and 270 degrees).

I also wa开发者_如何学Gont the ability of instead of rendering the images to a bitmap (e.g. for displaying), to be able to draw them into a new SVG image (exporting the "document" to SVG).

wxWidgets does not seem to have any built in SVG capabilities, so I'm not sure how to proceed on adding such functionality.


The cairo library website has examples on drawing SVG using librsvg.

Both the cairo and librsvg libraries should be sufficiently cross-platform to do what you need, and with wxcairo it should be possible to dock them onto wxWidgets.

That is the first idea I would research when faced with the task of drawing SVG into wxWidgets.

Also, drawing to SVG files with cairo is quite easy when you are doing all your drawing with cairo anyway, and the drawing model cairo uses is quite similar to SVG.


You can render into a file in SVG format using wxSVGFileDC (http://docs.wxwidgets.org/trunk/classwx_s_v_g_file_d_c.html) but there is no support for drawing SVG images, you will need to use an SVG rendering library and integrate it with wx (how to do this is platform-dependent).

Notice that wxSVGFileDC is in contrib, i.e. an additional library which needs to be built independently, in wx 2.8 but is in the main library itself in 2.9.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜