[cairo] Visible lines between adjacent semi-transparent polygons

Maarten Bosmans mkbosmans at gmail.com
Mon Nov 21 12:41:09 PST 2011


2011/11/21 Jennifer Adams <jma at cola.iges.org>:
> Dear Experts,
> 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?

Well, for the PDF you're also at the mercy of the renderer. It might
very well be that it renders incorrectly.

I sometimes get better results by using a temporary surface
(push_group), drawing multiple things (with the add operator) and then
painting the surface with pop_group, paint (wiht the normal over
operator).

And of course, you could consider drawing a rectangle instead of two triangles.

Maarten


More information about the cairo mailing list