From 7f083bd97474ea5cc62e78712c10dc7a13f8f744 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 18 Jan 2012 10:39:10 -0500 Subject: [PATCH] output argb32 and rgb24 using pycairo --- demo/python/rundemo.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/demo/python/rundemo.py b/demo/python/rundemo.py index d71a439fb..0fda7526d 100644 --- a/demo/python/rundemo.py +++ b/demo/python/rundemo.py @@ -368,6 +368,18 @@ if HAS_PYCAIRO_MODULE and mapnik.has_pycairo(): images_.append('demo.ps') postscript_surface.finish() + image_surface = cairo.ImageSurface(cairo.FORMAT_RGB24, m.width, m.height) + mapnik.render(m, image_surface) + image_surface.write_to_png('demo_cairo_rgb24.png') + images_.append('demo_cairo_argb24.png') + image_surface.finish() + + image_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, m.width, m.height) + mapnik.render(m, image_surface) + image_surface.write_to_png('demo_cairo_argb32.png') + images_.append('demo_cairo_argb32.png') + image_surface.finish() + else: print '\n\nPycairo not available...', if mapnik.has_cairo(): @@ -379,9 +391,9 @@ else: images_.append('demo.ps') mapnik.render_to_file(m,'demo.svg') images_.append('demo.svg') - mapnik.render_to_file(m,'demo_cairo_rgb.png','RGB24') + mapnik.render_to_file(m,'demo_cairo_rgb24.png','RGB24') images_.append('demo_cairo_rgb.png') - mapnik.render_to_file(m,'demo_cairo_argb.png','ARGB32') + mapnik.render_to_file(m,'demo_cairo_argb32.png','ARGB32') images_.append('demo_cairo_argb.png') print "\n\n", len(images_), "maps have been rendered in the current directory:"