Re: cairo linear gradient with BUG?

Chris Wilson <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Mon, Jun 17, 2013 at 07:34:36PM +0800, 丹青(Hishop) wrote:
>    Hello, this is google translation, sorry!
>    I realize SWF To bitmap conversion is found a problem, the code is as
>    follows (using C # call cairo.dll,v1.12.14)
>      Cairo.Context c = new Context (new ImageSurface (Format.ARGB32, 150,
>    150));
>                 Matrix m1 = new Matrix ();
>                 m1.Scale (0.1, 0.1);
>                 / / m1.Scale (0.5, 0.5);
>                 / / m1.Scale (1, 1);
>                 c.Matrix = m1;
>                 Cairo.LinearGradient lg = new LinearGradient (-16384, 0,
>    16384, 0);
>                 Cairo.Matrix m2 = new Matrix ();
>                 m2.Scale (0.01220703125, 0.01220703125);
>                 m2.Translate (3896.0, 0);
>                 m2.Invert ();
>                 lg.Extend = Extend.Repeat;
>                 lg.Matrix = m2;
>                 lg.AddColorStop (0, new Cairo.Color (0, 0, 0));
>                 lg.AddColorStop (0.4, new Cairo.Color (1, 0, 0));
>                 lg.AddColorStop (0.8, new Cairo.Color (1, 1, 0));
>                 lg.AddColorStop (1, new Cairo.Color (1, 1, 1));
>                 c.Pattern = lg;
>                 c.MoveTo (0, 0);
>                 c.LineTo (4096, 0);
>                 c.LineTo (4096, 4096);
>                 c.LineTo (0, 4096);
>                 c.LineTo (0, 0);
>                 c.ClosePath ();
>                 c.FillPreserve ();
>                 c.Color = new Cairo.Color (0, 0, 0, 1);
>                 c.Stroke ();
>                 c.Target.WriteToPng (@ "c: \ test.png");
>                 c.Target.Dispose ();
>    In the above code, if you use m1.Scale (1, 1); m1.Scale (0.5, 0.5);
>    gradient effect with the normal output picture, but if you use m1.Scale
>    (0.1,0.1); or low scaling, such as m1.Scale (0.05,0.05), the picture
>    output is blank.
>    I do not know whether this is a BUG, please test it yourself and give
>    back. Thank you!

It is a known failure due to the limited precision we use in the
gradient walker. Different backends will have different failure modes and
lifting the limits will require some careful analysis of the precision.
-Chris


-- 
Chris Wilson, Intel Open Source Technology Centre
-- 
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.