[cairo] patch for svg2png

Bryce Harrington bryce at osdl.org
Mon Aug 16 16:47:36 PDT 2004


Hi Carl,

Here's a quick patch for svg2png to fix some of the compile errors.
There's still a couple errors remaining, but I'm uncertain how they
should be fixed since the corresponding functions are not (no longer?)
in cairo.  Anyway, hope this helps.  If you can give me hints for the
other errors I could have a shot at fixing them too.

svg2png.o(.text+0x193): In function `render_to_png':
/home/bryce/src/Cairo/svg2png/src/svg2png.c:98: undefined reference to
`svg_cairo_create'
svg2png.o(.text+0x1ad):/home/bryce/src/Cairo/svg2png/src/svg2png.c:104:
undefined reference to `cairo_parse_file'
svg2png.o(.text+0x1d5):/home/bryce/src/Cairo/svg2png/src/svg2png.c:108:
undefined reference to `cairo_get_size'
svg2png.o(.text+0x2ec):/home/bryce/src/Cairo/svg2png/src/svg2png.c:135:
undefined reference to `cairo_render'
collect2: ld returned 1 exit status


Bryce


Index: svg2png.c
===================================================================
RCS file: /cvs/cairo/svg2png/src/svg2png.c,v
retrieving revision 1.4
diff -u -p -r1.4 svg2png.c
--- svg2png.c	11 Jun 2004 12:49:59 -0000	1.4
+++ svg2png.c	16 Aug 2004 23:44:23 -0000
@@ -31,13 +31,13 @@
 #include <png.h>
 #include <errno.h>

-#include <svg-cairo.h>
+#include <cairo.h>

 #include "args.h"

 #define MIN(a, b)     (((a) < (b)) ? (a) : (b))

-static svg_cairo_status_t
+static cairo_status_t
 render_to_png (FILE *svg_file, FILE *png_file, double scale, int width, int height);

 int
@@ -46,7 +46,7 @@ main (int argc, char **argv)
     args_t args;
     args_parse (&args, argc, argv);
     FILE *svg_file, *png_file;
-    svg_cairo_status_t status;
+    cairo_status_t status;

     if (strcmp (args.svg_filename, "-") == 0) {
 	svg_file = stdin;
@@ -84,14 +84,14 @@ main (int argc, char **argv)
     return 0;
 }

-static svg_cairo_status_t
+static cairo_status_t
 render_to_png (FILE *svg_file, FILE *png_file, double scale, int width, int height)
 {
     int svg_width, svg_height;

-    svg_cairo_status_t status;
+    cairo_status_t status;
     cairo_t *cr;
-    svg_cairo_t *svgc;
+    cairo_t *svgc;

     cr = cairo_create ();

@@ -101,11 +101,11 @@ render_to_png (FILE *svg_file, FILE *png
 	exit(1);
     }

-    status = svg_cairo_parse_file (svgc, svg_file);
+    status = cairo_parse_file (svgc, svg_file);
     if (status)
 	return status;

-    svg_cairo_get_size (svgc, &svg_width, &svg_height);
+    cairo_get_size (svgc, &svg_width, &svg_height);

     if (width < 0 && height < 0) {
 	width = (svg_width * scale + 0.5);
@@ -132,11 +132,11 @@ render_to_png (FILE *svg_file, FILE *png
     /* XXX: This probably doesn't need to be here (eventually) */
     cairo_set_rgb_color (cr, 1, 1, 1);

-    svg_cairo_render (svgc, cr);
+    cairo_render (svgc, cr);

-    svg_cairo_destroy (svgc);
+    cairo_destroy (svgc);

     cairo_destroy (cr);

-    return SVG_CAIRO_STATUS_SUCCESS;
+    return CAIRO_STATUS_SUCCESS;
 }




More information about the cairo mailing list