← Back to team overview

kicad-developers team mailing list archive

Re: Cairo printing

 

Le 08/10/2018 à 08:59, Maciej Sumiński a écrit :
> On 10/7/18 10:05 PM, Wayne Stambaugh wrote:
> [snip]
>> This makes me nervous.  The gdiplus library brings wxGraphicsContext
>> into play on windows.  Something from wxGraphicsContext is being pulled
>> into the kicad build which can be enabled by configuring builds with
>> -DUSE_WX_GRAPHICS_CONTEXT=ON.  I would have thought with cairo being
>> both the display and print context that gdiplus would not be required
>> for linking kicad.
> 
> Hi Wayne, Jean-Pierre,
> 
> Thank you for testing the code. I have already followed Tom's suggestion
> and added gdiplus to linked libraries in my branch.
> 
> I wanted to take advantage of wxWidgets as much as I could, so I was
> forced to work with wxDC. Otherwise I would have to go much deeper and
> deal directly with CUPS and GDI+ to invoke a printing dialog and
> actually start printing.
> 
> The only reasonable way to make wxDC and Cairo compatible is via
> wxGraphicsContext, as it uses Cairo underneath. Have a look at
> cairo_print.cpp [1] to see ugly details, but it is the only place where
> I refer to gdiplus. I have not enabled USE_WX_GRAPHICS_CONTEXT on
> purpose, as it seems to affect legacy canvases which is not needed here.
> 
> Cheers,
> Orson
> 
> 1.
> https://git.launchpad.net/~orsonmmz/kicad/tree/common/gal/cairo/cairo_print.cpp?h=cairo_printing#n70

Hi Orson,
Very good job.

I tested the Cairo printing both on Windows and Linux.

No problem on Linux.
On Windows, I have strange artifacts (see attached picture) in print
preview.
(more strange, if a zone outline includes the full board items, there
are no, or very few, artifacts)

It happens only when the opacity of any printed item is not set to 1.0

Moreover, when the opacity of any printed item is not set to 1.0, the
resulting printed picture is a bitmap (tested both using Cutepdf and a
printer using a postscript driver), not really usable.
(When all objects use a 1.0 opacity, the drawings are vectored, as expected)

Due to the fact transparency is not working very well on Cairo, and
useless when printing a board with one sheet by layer, I suggest to
force the opacity to 1.0 in any case.

-- 
Jean-Pierre CHARRAS

Attachment: print_preview_artifacts.png
Description: PNG image


Follow ups

References