[cairo] Loading a SVG file and displaying it on SDL

Carl Worth cworth at cworth.org
Fri Mar 9 14:20:44 PST 2007

On Fri, 9 Mar 2007 11:15:25 -0300, André Wagner wrote:
> 	cairo_scale(cr, width, height);
> 	h = rsvg_handle_new_from_file("closedbox.svg", &e);

Is your SVG file designed to cope with that kind of scale? That is,
is it designed such that it only has coordinates from 0.0 to 1.0 ? If
not, you might be simply scaling the image entirely off the
surface. So maybe try again without the cairo_scale in there and see
what happens, (which should draw the SVG file such that one unit in
the SVG file corresponds to one pixel).

> What am I doing wrong? It displays a white window, so I know
> (suppose) the transference from cairo to SDL is working.

Well, white's not all that reliable of a color. Maybe try something

	cairo_set_source_rgb (cr, 0.0, 1.0, 1.0); /* cyan */


> I'm using Win32, BTW (I hope this isn't the stupid mistke ;-)

I won't comment on whether it's a mistake or not, but cairo is
supposed to function on that platform.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070309/681e2cec/attachment.pgp

More information about the cairo mailing list