[cairo] Loading SVG from memory using RSVG

Simon Flannery simon_flannery at yahoo.com.au
Sun Dec 3 16:20:43 PST 2006


And as you can see, I get more answers here! Anyway, I'm rendering my SVG using cario.

Thanks.

----- Original Message ----
From: Daniel Amelang <daniel.amelang at gmail.com>
To: Simon Flannery <simon_flannery at yahoo.com.au>
Cc: cairo at cairographics.org
Sent: Monday, 4 December, 2006 10:55:15 AM
Subject: Re: [cairo] Loading SVG from memory using RSVG


On 12/3/06, Simon Flannery <simon_flannery at yahoo.com.au> wrote:
> 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?

The rsvg list is here:

http://lists.sourceforge.net/lists/listinfo/librsvg-devel

But, for what it's worth, I think what you're looking for is rsvg_handle_write.

Dan

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


More information about the cairo mailing list