Does wxWidgets support .svg file now?

874 views
Skip to first unread message

James Smith

unread,
Oct 28, 2015, 7:49:21 AM10/28/15
to wx-users
I wrote a little program a couple years ago for my personal use to display images, and was surprised to find out that it now can display .svg files too, though it pops up a warning message saying "No handler found for image type." I checked my code, pretty sure that this one doesn't use any other libraries such as GraphicMagick. It apparently is a pure wxWidgets application. The question is: is the ability supported by a wxImageHandler, something like wxPNGHandler? and how to disable the warning message? Thanks.

Eric Jensen

unread,
Oct 28, 2015, 8:15:43 AM10/28/15
to James Smith
Hello James,

Wednesday, October 28, 2015, 12:49:20 PM, you wrote:

JS> I wrote a little program a couple years ago for my personal use
JS> to display images, and was surprised to find out that it now can
JS> display .svg files too, though it pops up a warning message saying
JS> "No handler found for image type." I checked my code, pretty sure
JS> that this one doesn't use any other libraries such as
JS> GraphicMagick. It apparently is a pure wxWidgets application. The
JS> question is: is the ability supported by a wxImageHandler,
JS> something like wxPNGHandler? and how to disable the warning message? Thanks.

If there was SVG support, it would not be for wxImage as it's a vector
format (as you probably know).

Your best option is wxSVG, but it requires Cairo under Windows.
http://sourceforge.net/projects/wxsvg/

Eric


--

James Smith

unread,
Oct 28, 2015, 2:07:42 PM10/28/15
to wx-users, m...@j-dev.de
Thanks for the replay, Eric. I'm currently not very interested in manipulating svg. I'm just wondering how to disable the warning messages, and curious about which mysterious mechanism in wxWidgets provides the ability to display svg. Yes, wxWidgets can now display svg just like any other bitmap formats it supports. I accidentally discovered this, while opening many image files with glob *.*, and some of them are svg. My little program was supposed to display bitmap files only, but now, thanks to wxWidgets, it gained extra ability. LOL. And to be honest, the svg image it shows is more accurate than gm, a utility that came with GraphicsMagick. gm always messes up the background color.

Regards,
James

Eric Jensen

unread,
Oct 28, 2015, 3:20:35 PM10/28/15
to James Smith
Hello James,

Wednesday, October 28, 2015, 7:07:42 PM, you wrote:

JS> Thanks for the replay, Eric. I'm currently not very interested in
JS> manipulating svg. I'm just wondering how to disable the warning
JS> messages, and curious about which mysterious mechanism in
JS> wxWidgets provides the ability to display svg. Yes, wxWidgets can
JS> now display svg just like any other bitmap formats it supports. I
JS> accidentally discovered this, while opening many image files with
JS> glob *.*, and some of them are svg. My little program was supposed
JS> to display bitmap files only, but now, thanks to wxWidgets, it
JS> gained extra ability. LOL.

I'm very confused. I'm 100% sure there is no SVG reading/rendering
capability in wxWidgets.

Eric

Reply all
Reply to author
Forward
0 new messages