[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.
This commit is contained in:
Carlos Garcia Campos 2009-06-30 11:05:50 +02:00
parent 700a555d19
commit 1e1f4fd092
2 changed files with 10 additions and 8 deletions

View file

@ -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);

View file

@ -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);