[cairo] Loading SVG from memory using RSVG

Simon Flannery simon_flannery at yahoo.com.au
Sun Dec 3 15:37:47 PST 2006


Hi,

Loading and rendering a SVG from a file was error free, but how do you load and render a SVG from a chunk of memory?

For example:

..
const unsigned char* data = (const unsigned char*) "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"><desc>Simple Polygon Test</desc><polygon fill=\"#69c2d4\" stroke=\"#facd2d\" stroke-width=\"7\" points=\"119,0 148,86 238,86 166,140 192,226 119,175 46,226 72,140 0,86 90,86\" /></svg>"; // should render a star.
..
g_my_svg = rsvg_handle_new_from_data(data, sizeof(data), &pError);
MessageBox(NULL, pError->message, "Error", 0); // Always says "Error parsing XML data"
..

I can load the exact same XML / SVG from a file and get cario to render it, but no luck from memory. Any Ideas, Help?

Thanks in advance,

Simon

Send instant messages to your online friends http://au.messenger.yahoo.com 


More information about the cairo mailing list