Reputation: 59
My requirement is to load image from SVG file, resize it to smaller/bigger image and save it in same file.
I need to achieve this in C++ using GdiPlus or MFC or Win32 API or Microsoft's C++ libraries?
I should not use any third party libraries.
I googled but I could not get any samples.
I am able to resize WMF file using GdiPlus. Is it possible to convert SVG file to WMF file and vice-versa using GdiPlus or MFC or Win32 API or Microsoft's C++ libraries?
Upvotes: 1
Views: 1049
Reputation: 6556
SVG is just an XML-based format. So you can use MSXML parser to read it. The MSXML parser is capable of reading/writing any XML DOM document. After that you just need to change the viewBox
attribute of SVG document.
The GDI+ supports EMF/WMF vector formats only and does not support rendering of SVG out of the box. So you'll have to use 3rd party libraries like http://svgpp.org. This header-only library works with RapidXML parser to read/write SVG and GDI+ to render it.
You can also use CHtmlView
class to display SVG. The CHtmlView
is basically a wrapper class around IE COM object.
Upvotes: 1