[cairo] Avoiding seams (again)

Timothée Lecomte timothee.lecomte at ens.fr
Wed Mar 22 13:13:56 PST 2006


Hi !

Do you remember the thread about avoiding seams between paths a months ago ?
Well, I am still facing this problem with no ideal solution.

Let me introduce the problem (again) :

I am writing a backend for gnuplot (http://www.gnuplot.info) with cairo.
Sometimes, I have to draw a lot of antialiased polygons (~10000) which
share common edges, and are of different colors.

The problem is that using cairo_fill() with CAIRO_OPERATE_OVER gives visible
seams between these polygons.

The ideal solution to this problem must be fast and preserve
the expected result (antialiasing).
Here are the solutions I know, most of them come from the previous thread :

- draw the polygons without antialiasing
 Good : fast
 Problem : I really want them antialiased !

- stroke each path
 Good : gives expected result
 Problem : very slow

- achieve FSAA manually : draw without antialiasing to a bigger surface
 Good : should give the expected result
 Problem : not very in the spirit of the rest of the drawing, and when I
tried, it seemed to me very slow, and did not give  a very good result
(I chose a surface ten times bigger)

- use CAIRO_OPERATOR_SATURATE
 Good : no seam, reasonably fast
 Problem : have to draw front-to-back to a separate context whereas
gnuplot gives me the instructions back-to-front, so it adds some overhead.
But  I also get white lines artifacts.
See : http://tipote.free.fr/wxt-saturate2.png

Do you have other ideas, or a solution to the artefacts problem with
CAIRO_OPERATOR_SATURATE ?

Thank you very much for your help, and thank you for the great library
that Cairo is.

Timothée Lecomte



More information about the cairo mailing list