gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [Gnash-dev] Problem with Drawing API


From: Udo Giacomozzi
Subject: Re[2]: [Gnash-dev] Problem with Drawing API
Date: Wed, 7 Nov 2007 00:47:48 +0100

Hello Sandro,

Tuesday, November 6, 2007, 2:57:31 PM, you wrote:
SS> Just committed a new drawing in the DrawingApiTest, showing
SS> two nested squares. Interestingly enough the inner one results
SS> as an hole, for both rendering and hit-test.

You might add this test to the testsuite:

------------------------------------------------------------
this.createEmptyMovieClip("test", 10);

this._x = Stage.width/2;
this._y = Stage.height/2;

function px(angle) {
        return Math.cos(angle/180*Math.PI) * 200;
}

function py(angle) {
        return Math.sin(angle/180*Math.PI) * 200;
}

test.beginFill(0xFF0000);
test.moveTo(px(0), py(0));
test.lineTo(px(360/5*2), py(360/5*2));
test.lineTo(px(360/5*4), py(360/5*4));
test.lineTo(px(360/5*6), py(360/5*6));
test.lineTo(px(360/5*8), py(360/5*8));
test.endFill();
------------------------------------------------------------


This shows that the proprietary player still uses the "even-odd"
filling rule for dynamic shapes.

Here is an explanation of the two filling rules:

The "non-zero" filling rule projects a ray from the test point (or the
rendering point) to somewhere outside the shape (infinity). A special
counter starts with zero and changes whenever the ray crosses an edge.
When the edge at the crossing goes in upward direction, 1 is added to
the counter. When the edge goes in downward direction, 1 is
subtracted from the counter. Whenever the counter is not zero we are
inside the shape, otherwise we are outside.

The "even-odd" filling rule is similar, but the direction of the edge
does not matter. Instead each crossing increases the counter and an
odd number means that the point is inside the shape.

The star in the above example is fully filled when the non-zero
filling rule is applied but has a hole (a pentagon) when the even-odd
filling rule is applied.

The latter is the case when the proprietary player renders the shape.


These filling rules are not specific to Flash shapes and I still don't
understand why they can be applied to Flash shapes at all (they can be
configured in the AGG rasterizer and make a difference).


Udo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]