[cairo] SVG Newbie

Ulrich Mierendorff ulrich.mierendorff at gmx.net
Thu Jun 7 03:27:14 PDT 2007


Peter Laurens <peterlaurenspublic <at> gmail.com> writes:

> 
> Hi, I am new to Cairo, and am having some trouble getting the basics  
> down about rendering SVGs.
> 
> [...]
> 
> cairo_test.c: In function 'main':
> cairo_test.c:16: error: 'svg_cairo_t' undeclared (first use in this  
> function)
> cairo_test.c:16: error: (Each undeclared identifier is reported only  
> once
> cairo_test.c:16: error: for each function it appears in.)
> cairo_test.c:16: error: 'svgc' undeclared (first use in this function)
> cairo_test.c:19: warning: implicit declaration of function  
> 'snippet_normalize'
> cairo_test.c:19: error: 'width' undeclared (first use in this function)
> cairo_test.c:19: error: 'height' undeclared (first use in this function)
> cairo_test.c:21: warning: implicit declaration of function  
> 'svg_cairo_create'
> cairo_test.c:23: warning: implicit declaration of function  
> 'svg_cairo_parse'
> cairo_test.c:24: warning: implicit declaration of function  
> 'svg_cairo_get_size'
> cairo_test.c:26: warning: implicit declaration of function  
> 'svg_cairo_render'
> cairo_test.c:28: warning: implicit declaration of function  
> 'svg_cairo_destroy'
> 
> Can anyone help advise me on what I've done wrong here - I'm also  
> unsure of my using the SVG stuff in relation to the cairo surface etc.
> 
> Any help is much appreciated,
> 
> Thanks in advance,
> 
> - Peter
> 

Hi,
Using GCC you should add the following to the command line:
`pkg-config --cflags --libs libsvg-cairo`
This includes and links the necessary libraries.

If you create the cairo_image_surface after parsing the SVG and after calling
svg_cairo_get_size() you can use this information to create a surface which has
exactly the same size as the SVG.

Kind regards
Ulrich





More information about the cairo mailing list