Re: Strange bug (?) when painting/cropping recording surface to PDF surface
Guillaume Ayoub <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thanks for your simple example. The patch seems to fix the problem. -- Guillaume Le lun. 11 avril 2016 à 7:49, Bernhard R. Fischer <[email protected]> a écrit : > On 2016-04-10 09:28, Adrian Johnson wrote: >> 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. >> > > Hi! > > Please find attached a simple test program which demonstrates it. > I tested it on Cairo 1.14.6 and 1.14.0. > > > Bernhard > > > -- > cairo mailing list > [email protected] > https://lists.cairographics.org/mailman/listinfo/cairo -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo