I'm working on a project that needs to display SVG files so to that end, I've been trying to use the Magick++ API to read in the SVG file and then get the raw pixel data as RGBA and stuff it into a buffer to later display on the screen. This is what I've figured out I need so far:
Code: Select all
using namespace Magick;
Image svgImage("test.svg");
Geometry geom = svgImage.size();
svgImage.modifyImage();
Pixels svgPixels(svgImage);
PixelPacket* pixels = svgPixels.get(0, 0, geom.width(), geom.height());
unsigned char* pixelBuffer = new unsigned char[geom.width() * geom.height() * 4];
svgImage.writePixels(RGBAQuantum, pixelBuffer);
So basically, does anyone have any tips on using the Magick++ API to handle SVGs?