[cairo] Win + Cario + SVG

Simon Flannery simon_flannery at yahoo.com.au
Sun Nov 19 14:09:49 PST 2006


Thanks, ok, so I read it, but not sure how or if it helps me.

If I write the following snippet of code:

#include <cairo-win32.h>
#include <cairo-svg.h>
#include <rsvg.h>
#include <rsvg-cairo.h>

void draw(HDC hdc, long width, long height)
{
   cairo_surface_t* surface = cairo_win32_surface_create(hdc);
   cairo_t* cr = cairo_create(surface);

/* draw the entire context white. */
// cairo_set_source_rgba(cr, 1, 1, 1, 1);
   cairo_paint(cr);

/* Remove this form the rendering loop!!! It is only for testing!!! */
   RsvgHandle* h = rsvg_handle_new_from_file("test.svg", &error);
/* Do it. */
   rsvg_handle_render_cairo(h, cr);
/* Clean up. */
   rsvg_handle_free(h);

/* Force pipeline out. */
   cairo_surface_flush(surface);

/* More clean up. */
   cairo_destroy(cr);
   cairo_surface_destroy(surface);
   return;
}

RsvgHandle is an undefined type and rsvg_handle_new_from_file is an undefined function. They ARE defined in "rsvg-cairo.h" AND I have added "C:\GTK\include\librsvg-2\librsvg" as a search path to my list of "include" directories.

What are the correct header files to #include?

The bottom line: Can Cario load and render a SVG format graphic? If yes, then where are the documented and working examples? If no, then what other graphic API would you recommend to do this simple task? (Sorry if this is sounds blunt.)

Thanks in advance,

Simon

----- Original Message ----
From: Daniel Amelang <daniel.amelang at gmail.com>
To: Simon Flannery <simon_flannery at yahoo.com.au>
Cc: Carl Worth <cworth at cworth.org>; cairo at cairographics.org
Sent: Friday, 17 November, 2006 5:36:05 PM
Subject: Re: [cairo] Win + Cario + SVG


On 11/16/06, Simon Flannery <simon_flannery at yahoo.com.au> wrote:
> Thanks for the prompt reply.
>
> I download and installed the GTK-dev from gladewin32.sourceforge.net/modules/news, version 2.10.6, which has all of cario, librsvg, etc as told from cariographics.org/download. I would like like to know how, and if it is possible, to render a SVG file to the sreen, then scale it etc... Has someone done this before? Any further advice? What am I missing?

Yes, just last month this came up. Check out this thread:

http://lists.freedesktop.org/archives/cairo/2006-October/008150.html

Dan

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


More information about the cairo mailing list