summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-11-14 09:33:04 -0800
committerCarl Worth <cworth@cworth.org>2007-11-14 09:33:04 -0800
commit4c05a1f09003e7a082bb4731ddf68f364ecb9c70 (patch)
tree809b4106511f781a56a1e776a0e9cb846b506ef1
parent301dd488294668ff29fec9d106c87368860620e6 (diff)
Convert svg2pdf into svg2png
-rw-r--r--.gitignore2
-rw-r--r--Makefile6
-rw-r--r--svg2png.c (renamed from svg2pdf.c)10
3 files changed, 9 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 815f21e..6407aec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
*~
-svg2pdf
+svg2png
diff --git a/Makefile b/Makefile
index 4420818..9143522 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
diff --git a/svg2pdf.c b/svg2png.c
index 6d586c3..abb0ea0 100644
--- a/svg2pdf.c
+++ b/svg2png.c
@@ -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);