diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-02-02 02:13:08 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-02-02 02:13:08 +0000 |
commit | e2a2ac7947f8763fe1270d0f5f42602e59d84c0a (patch) | |
tree | eebbf706bde5321c2319e9c273e09607b7f875af /examples/cairoview.c | |
parent | b69dea4155ec9a51617f727e8bd0c6ff74d15570 (diff) | |
download | pango-e2a2ac7947f8763fe1270d0f5f42602e59d84c0a.tar.gz |
AC_DEFINE (HAVE_CAIRO_PNG).
2006-02-01 Behdad Esfahbod <behdad@gnome.org>
* configure.in: AC_DEFINE (HAVE_CAIRO_PNG).
* examples/cairoview.c: Save to PNG if cairo has PNG support and
--output is given.
Diffstat (limited to 'examples/cairoview.c')
-rw-r--r-- | examples/cairoview.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/cairoview.c b/examples/cairoview.c index e677bcd7..8e43a56a 100644 --- a/examples/cairoview.c +++ b/examples/cairoview.c @@ -21,6 +21,8 @@ * Boston, MA 02111-1307, USA. */ +#include <config.h> + #include "renderdemo.h" #include "viewer-x.h" @@ -141,7 +143,6 @@ do_render (Display *display, width, height); cr = cairo_create (surface); - cairo_surface_destroy (surface); transform_callback (context, NULL, cr); @@ -152,5 +153,17 @@ do_render (Display *display, cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); do_output (context, render_callback, transform_callback, cr, NULL, NULL, show_borders); +#ifdef HAVE_CAIRO_PNG + if (opt_output && *opt_output) + { + cairo_status_t status; + + status = cairo_surface_write_to_png (surface, opt_output); + if (status != CAIRO_STATUS_SUCCESS) + g_printerr ("could not save PNG to '%s'\n", opt_output); + } +#endif + + cairo_surface_destroy (surface); cairo_destroy (cr); } |