From 4c05a1f09003e7a082bb4731ddf68f364ecb9c70 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 14 Nov 2007 09:33:04 -0800 Subject: [PATCH] Convert svg2pdf into svg2png --- .gitignore | 2 +- Makefile | 6 +++--- svg2pdf.c => svg2png.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) rename svg2pdf.c => svg2png.c (91%) 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 similarity index 91% rename from svg2pdf.c rename to 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 #include -#include +#include #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); -- 2.43.0