|
From: Ethan A M. <me...@uw...> - 2023-06-13 22:43:46
|
New information:
I found a chunk of code in cairo terminal driver from way back when
that was intended to deal with an old version of the cairo library
(2010 or earlier).
good news:
The one line patch below fixes or at least improves the banding
artifact in pdf output for almost all plots I have tried.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/term/cairo.trm b/term/cairo.trm
index 9df11cc79..8ab9698cb 100644
--- a/term/cairo.trm
+++ b/term/cairo.trm
@@ -775,7 +775,7 @@ void cairotrm_init()
/* disable OPERATOR_SATURATE, not implemented in cairo pdf backend.
* Unfortunately the can result in noticeable seams between adjacent
* polygons. */
- plot.polygons_saturate = FALSE;
+ plot.polygons_saturate = TRUE;
/* Empirical correction to make pdf output look more like wxt and png */
plot.dashlength /= 2;
} else if (!strcmp(term->name,"pngcairo") || !strcmp(term->name, "kittycairo")) {
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bad news:
It degrades text rendering in the pdf output. I don't know why.
For at least one plot (walls.dem) it introduces a much worse artifact.
I don't know why on that one either.
There are other places in the cairo.trm code that were also
added apparently to accommodate this old cairo libary.
I will try to trace back what changed in cairo and why the
gnuplot terminal driver was trying to work around it.
The bad text rendering side effect is a show-stopper at the moment.
If I can disentangle that from the change to polygon rendering
I would be inclined to make the change in the gnuplot development
source and work on the resulting artifact in walls.dem separately.
I am dubious about the large block of code in gp_cairo.c that begins
/* this is meant to test Full-Scene-Anti-Aliasing by supersampling,
* in association with CAIRO_ANTIALIAS_NONE a few lines below
*/
Before the change to plot.polygons_saturate it was never executed for
pdf output. Now it is. Perhaps it can be replaced by something simpler?
The "supersampling" idea was never implemented, so maybe this code
never did work correctly. On the other hand it is also used by
the wxt terminal and I haven't noticed problems there, so ....?
Anyhow, if you have any ideas or can find a way to remove the
text-rendering side effect that would be great.
cheers,
Ethan
|