Re: Horizontal artifacts rendering to an image surface

"Floyd May" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
I've been able to boil this down to a reproducible, small case.
Basically, two four-point polygons where one edge from each is
collinear.  Using even-odd rendering, I'm getting these artifacts:

http://imagebin.org/222354

Again, this is based on v 1.10.2, on Windows (both x86 and x64 exhibit
the issue), based on a recent download of GTK+ binaries.

Here is C# source (using Mono.Cairo; should be able to adapt to C code
relatively easily):

    class Program
    {
        static void Main(string[] args)
        {
            var records = new Cairo.PointD[][]{
                new Cairo.PointD[]{
                    new Cairo.PointD(448.948314981535,
264.938083162531),
                    new Cairo.PointD(448.51546072308, 220.797386273742),
                    new Cairo.PointD(530, 220),
                    new Cairo.PointD(561.332719124854,
261.581040261313),
                },
                new Cairo.PointD[]{
                    new Cairo.PointD(339.794010419399,
236.296868257225),
                    new Cairo.PointD(346.503195904195,
229.764422696084),
                    new Cairo.PointD(448.474225856364,
216.590856667608),
                    new Cairo.PointD(448.948314981535, 264.938083162531)
                },
            };
            
            using (var surface = new
Cairo.ImageSurface(Cairo.Format.Argb32, 1024, 1024))
            {
                using (var ctx = new Cairo.Context(surface))
                {
                    ctx.FillRule = Cairo.FillRule.EvenOdd;

                    foreach (var ring in records)
                    {
                        ctx.MoveTo(ring.First());

                        foreach (var pt in ring.Skip(1))
                        {
                            ctx.LineTo(pt);
                        }

                        ctx.ClosePath();
                    }

                    ctx.SetSourceColor(0, 0.5, 1);
                    ctx.FillPreserve();
                    ctx.SetSourceColor(0, 0, 0);
                    ctx.Stroke();
                }

                surface.Flush();

                surface.WriteToPng("image.png");
            }
        }
    }

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.