[cairo] Strange bug (?) when painting/cropping recording surface to PDF surface

Guillaume Ayoub guillaume.ayoub at kozea.fr
Sun Apr 10 09:07:59 UTC 2016


Hi,

It really looks like a bug reported a long time ago:
https://lists.cairographics.org/archives/cairo/2013-May/024301.html
http://lists.cairographics.org/archives/cairo/2013-June/024406.html

Good news, there's a patch for it!
http://lists.cairographics.org/archives/cairo/2016-January/027185.html

Best regards,
-- 
Guillaume

Le dim. 10 avril 2016 à 9:28, Adrian Johnson <ajohnson at redneon.com> a 
écrit :
> On 10/04/16 03:25, Bernhard R. Fischer wrote:
>>  Hi!
>> 
>>  _Background_
>>  In my project a record all drawing operations to a recording 
>> surface.
>>  Finally, to output files I create surfaces of specific backends 
>> (PNG,
>>  PDF, and SVG) and "crop" (the final surface is smaller than the
>>  recording source surface), rotate, and paint the recording surface 
>> to it.
>> 
>> 
>>  _Strange Behavior_
>>  When using PDF as backend, not everything is painted from the source
>>  (recording) surface to the PDF surface. On PNG and SVG it works as 
>> expected.
>> 
>> 
>>  _Examples_
>>  There is a PNG and PDF example to show the behavior. Look at the 
>> right
>>  lower corner: right of the string "015°30" the short black lines 
>> in the
>>  axis are missing compared to the PNG.
>>  http://www.abenteuerland.at/download/eagle/output.pdf
>>  http://www.abenteuerland.at/download/eagle/output.png
>> 
>> 
>>  _Trigger_
>>  I observed, that this behavior is triggered as soon as the PDF 
>> surface
>>  is smaller than the recording surface.
>> 
>> 
>>  _Code Snippet_
>>  The following code snippets shows how I create the PDF and PNG 
>> surface
>>  from the recording surface (sfc_).
>> 
>> 
>>  	/* create PDF from sfc_ */
>>  	sfc = cairo_pdf_surface_create("output.pdf", width*.7, height*1.3);
>>  	dst = cairo_create(sfc);
>>  	cairo_rotate(dst, DEG2RAD(15));
>>  	cairo_set_source_surface(dst, sfc_, 0, 0);
>>          cairo_paint(dst);
>>          cairo_show_page(dst);
>>          cairo_destroy(dst);
>>          cairo_surface_destroy(sfc);
>> 
>> 
>>  	/* create PNG from sfc_ */
>>           sfc = cairo_image_surface_create(CAIRO_FORMAT_RGB24, 
>> width*.7,
>>  height*1.3);
>>           dst = cairo_create(sfc);
>>           cairo_rotate(dst, DEG2RAD(15));
>>           cairo_set_source_surface(dst, sfc_, 0, 0);
>>           cairo_paint(dst);
>>           cairo_show_page(dst);
>>           cairo_destroy(dst);
>>           cairo_surface_write_to_png(sfc, "output.png");
>>           cairo_surface_destroy(sfc);
>> 
>> 
>>  Any hints appreciated.
> 
> If you can provide a simple test case that reproduces the bug with the
> current version of cairo I can look into it.
> 
>> 
>>  Best regards,
>>  Bernhard
>> 
> 
> --
> cairo mailing list
> cairo at cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list