diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-30 11:05:50 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-07-02 14:50:15 +0200 |
commit | 1e1f4fd0920cb2b0882137b4cc500dcbae42d2dc (patch) | |
tree | 57b1cc0808cd371f4f88f418c36728e6c1c2c338 | |
parent | 700a555d194a20c00df69b963cdc5b6153e162a4 (diff) |
[test] Use poppler_page_render with a transparent surface
Instead of using an opaque surface filled in white, use a transparent
surface and fill it in white by using CAIRO_OPERATOR_DEST_OVER after
rendering.
-rw-r--r-- | test/any2ppm.c | 9 | ||||
-rw-r--r-- | test/pdf2png.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/test/any2ppm.c b/test/any2ppm.c index 4800b545..31dd0eb4 100644 --- a/test/any2ppm.c +++ b/test/any2ppm.c @@ -332,15 +332,16 @@ _poppler_render_page (const char *filename, poppler_page_get_size (page, &width, &height); - surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create (surface); - cairo_set_source_rgb (cr, 1., 1., 1.); - cairo_paint (cr); - poppler_page_render (page, cr); g_object_unref (page); + cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER); + cairo_set_source_rgb (cr, 1., 1., 1.); + cairo_paint (cr); + status = cairo_status (cr); cairo_destroy (cr); diff --git a/test/pdf2png.c b/test/pdf2png.c index fc4390b0..f60170cc 100644 --- a/test/pdf2png.c +++ b/test/pdf2png.c @@ -74,16 +74,17 @@ int main (int argc, char *argv[]) poppler_page_get_size (page, &width, &height); - surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create (surface); cairo_surface_destroy (surface); - cairo_set_source_rgb (cr, 1., 1., 1.); - cairo_paint (cr); - poppler_page_render (page, cr); g_object_unref (page); + cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER); + cairo_set_source_rgb (cr, 1., 1., 1.); + cairo_paint (cr); + status = cairo_surface_write_to_png (cairo_get_target (cr), output_filename); cairo_destroy (cr); |