0 Replies Latest reply on Mar 3, 2010 12:24 PM by robert.dg

    corrupted display when calling beginFill after curveTo (bug?)

    robert.dg

      Hi All,

       

      I've recently started to play a bit with the Graphics.curveTo function, and have been pulling my hairs out since this afternoon because of some unexpected result:

       

      I've been able to reproduce this weird behavior to a simple case: On a canvas, I draw a curve starting at (0, 0), ending at (width, height) with some arbitrary control point (in my case it was (0, height)). After drawing the curve, I draw & fill a circle at some other point on the canvas (in my case (width / 2, height / 2) with radius 25). What I'm seeing after these commands is that the entire application area that lies to the right of the curve is colored in a color slightly darker than the application background, and that my circle ends up being partly colored black, and partly the same color as the application background.

       

      Here's the code:

       

       

      g.clear();

       

      g.lineStyle(2, 0xFF0000);

       

      g.moveTo(0, 0);

      g.curveTo(0, canvas.height, canvas.width, canvas.height);

       

      g.beginFill(0);

      g.drawCircle(canvas.width / 2, canvas.height / 2, 25);

      g.endFill();

       

       

      Here's a picture showing the result:

      oddcurve.jpg

       

      Now, the weird thing is that when adding the statement "g.moveTo(0, 0)" after the curveTo call fixes the problem:

       

      okcurve.jpg

       

      The way I'm interpreting all this is that the beginFill call after drawing the curve makes flex / flash perform some kind of fill of the curve, but I have no clue as to why it's filling to the right edge of the screen. I'm even more puzzled about why the g.moveTo(0, 0) solves the problem - I've tried moving the pen to other coordinates, and actually they all work, so it's not about moving the pen back to the beginning of the curve.

       

      Has anybody stumbled upon similar behavior or can someone explain to me what goes on inside flex'  drawing mechanisms that explains this behavior?

       

      Kind regards,

      Robert