diff options
author | Carl Worth <cworth@cworth.org> | 2007-11-14 09:33:04 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-11-14 09:33:04 -0800 |
commit | 4c05a1f09003e7a082bb4731ddf68f364ecb9c70 (patch) | |
tree | 809b4106511f781a56a1e776a0e9cb846b506ef1 | |
parent | 301dd488294668ff29fec9d106c87368860620e6 (diff) |
Convert svg2pdf into svg2png
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | svg2png.c (renamed from svg2pdf.c) | 10 |
3 files changed, 9 insertions, 9 deletions
@@ -1,2 +1,2 @@ *~ -svg2pdf +svg2png @@ -1,7 +1,7 @@ -ALL=svg2pdf +ALL=svg2png -MYCFLAGS=`pkg-config --cflags librsvg-2.0 cairo-pdf` -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -MYLDFLAGS=`pkg-config --libs librsvg-2.0 cairo-pdf` +MYCFLAGS=`pkg-config --cflags librsvg-2.0 cairo-png` -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing +MYLDFLAGS=`pkg-config --libs librsvg-2.0 cairo-png` all: $(ALL) @@ -1,4 +1,4 @@ -/* gcc `pkg-config --cflags --libs librsvg-2.0 cairo-pdf` -o svg2pdf svg2pdf.c +/* gcc `pkg-config --cflags --libs librsvg-2.0 cairo-png` -o svg2png svg2png.c * * Copyright © 2005 Red Hat, Inc. * Copyright © 2006 Red Hat, Inc. @@ -34,13 +34,11 @@ #include <librsvg/rsvg.h> #include <librsvg/rsvg-cairo.h> -#include <cairo-pdf.h> +#include <cairo.h> #define FAIL(msg) \ do { fprintf (stderr, "FAIL: %s\n", msg); exit (-1); } while (0) -#define PIXELS_PER_POINT 1 - int main (int argc, char *argv[]) { GError *error = NULL; @@ -67,7 +65,7 @@ int main (int argc, char *argv[]) width = dim.width; height = dim.height; - surface = cairo_pdf_surface_create (output_filename, width, height); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create (surface); rsvg_handle_render_cairo (handle, cr); @@ -76,6 +74,8 @@ int main (int argc, char *argv[]) if (status) FAIL (cairo_status_to_string (status)); + cairo_surface_write_to_png (surface, output_filename); + cairo_destroy (cr); cairo_surface_destroy (surface); |