[cairo-commit] svg2pdf/src Makefile.am, 1.1.1.1, 1.2 svg2pdf.c,
1.1.1.1, 1.2
Carl Worth
commit at pdx.freedesktop.org
Fri Jun 17 23:11:26 PDT 2005
Committed by: cworth
Update of /cvs/cairo/svg2pdf/src
In directory gabe:/tmp/cvs-serv6275/src
Modified Files:
Makefile.am svg2pdf.c
Log Message:
* src/Makefile.am: Fix to compile the renamed files.
* src/svg2pdf.c: (render_to_pdf): Port to actually create a PDF
file.
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/svg2pdf/src/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.am 18 Jun 2005 00:56:22 -0000 1.1.1.1
+++ Makefile.am 18 Jun 2005 06:11:24 -0000 1.2
@@ -1,9 +1,9 @@
-bin_PROGRAMS = svg2png
+bin_PROGRAMS = svg2pdf
-svg2png_SOURCES = \
+svg2pdf_SOURCES = \
args.c \
args.h \
- svg2png.c
+ svg2pdf.c
-AM_CFLAGS = $(SVG2PNG_CFLAGS)
-svg2png_LDFLAGS = $(SVG2PNG_LIBS)
+AM_CFLAGS = $(SVG2PDF_CFLAGS)
+svg2pdf_LDFLAGS = $(SVG2PDF_LIBS)
Index: svg2pdf.c
===================================================================
RCS file: /cvs/cairo/svg2pdf/src/svg2pdf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- svg2pdf.c 18 Jun 2005 00:56:22 -0000 1.1.1.1
+++ svg2pdf.c 18 Jun 2005 06:11:24 -0000 1.2
@@ -1,6 +1,7 @@
/* svg2pdf - Render an SVG image to a PNG image (using cairo)
*
- * Copyright © 2002 USC/Information Sciences Institute
+ * Copyright © 2002 USC/Information Sciences Institute
+ * Copyright © 2005 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -28,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <errno.h>
#include <cairo.h>
@@ -103,19 +105,6 @@
}
static svg_cairo_status_t
-write_surface_to_pdf_file (cairo_surface_t *surface, FILE *file)
-{
- cairo_status_t status;
-
- status = cairo_surface_write_to_pdf_stream (surface, write_callback, file);
-
- if (status)
- return SVG_CAIRO_STATUS_IO_ERROR;
- else
- return SVG_CAIRO_STATUS_SUCCESS;
-}
-
-static svg_cairo_status_t
render_to_pdf (FILE *svg_file, FILE *pdf_file,
double scale, int width, int height)
{
@@ -155,13 +144,18 @@
dy = (height - (int) (svg_height * scale + 0.5)) / 2;
}
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+ /* XXX: This puts 1pixel==1point, (eg. 72.0 DPI), but we probably
+ * want a command-line option to change that. */
+ surface = cairo_pdf_surface_create_for_stream (write_callback, pdf_file,
+ width, height);
cr = cairo_create (surface);
+/*
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_restore (cr);
+*/
cairo_translate (cr, dx, dy);
cairo_scale (cr, scale, scale);
@@ -171,9 +165,10 @@
status = svg_cairo_render (svgc, cr);
- status = write_surface_to_pdf_file (surface, pdf_file);
- cairo_surface_destroy (surface);
+ cairo_show_page (cr);
+
cairo_destroy (cr);
+ cairo_surface_destroy (surface);
if (status)
return status;
More information about the cairo-commit
mailing list