[cairo] Visible lines between adjacent semi-transparent polygons

Hezekiah M. Carty hcarty at atmos.umd.edu
Tue Nov 22 10:35:40 PST 2011


On Mon, Nov 21, 2011 at 1:35 PM, Jennifer Adams <jma at cola.iges.org> wrote:
> I am working toward implementing Cairo in GrADS, an open source program for
> the analysis and display of meteorological data. My use of cairo is fairly
> basic. In a test program, I am drawing two adjacent triangles with
> transparency set to 0.50, writing out .pdf and .png formats. A faint line
> shows up along the common boundary of the two triangles (i.e., along the
> diagonal of what should be a solid rectangle). Disabling anti-aliasing makes
> the line go away in the .png file, but it persists in the .pdf. What is
> causing this and is there a remedy?

The solution used in PLplot is to fill the polygon with a cairo_fill
and cairo_stroke.

Lines 1399 - 1431:
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/drivers/cairo.c?revision=12032&view=markup

An example of the result (PNG with antialiasing enabled):
http://plplot.sourceforge.net/examples-data/demo16/x16.02.png

The cairo_stroke call is needed to avoid seams between adjacent
polygons when the polygons are antialiased (Cairo-dependent for raster
output, renderer dependent for PDF/PS output).

Somewhat off-topic - I'm looking forward to Cairo-based GrADS rendering!

Hez


More information about the cairo mailing list