[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [Gnash-commit] gnash/server shape.cpp
From: |
Udo Giacomozzi |
Subject: |
Re[2]: [Gnash-commit] gnash/server shape.cpp |
Date: |
Mon, 5 Mar 2007 23:01:35 +0100 |
Hello strk,
Monday, March 5, 2007, 1:17:20 PM, you wrote:
s> So, shape_character_def should find closed paths itself... being
s> closed path sequences with *all* paths having either a left a fill
specified.
s> Sounds as we'd need more testcases for this.
Yes, in theory it should work similarly to the "path" version, but
walking all edges in all paths.
I think it should be relatively simple:
- being X and Y the coordinates of the desired point (transformed by
the reverse matrix, i.e. normalized to the character coordinates!):
- for each path:
- for each edge in the path:
- find X1 := the edge X coordinate crossing Y
- go to next edge if no crossing
- when matchX < X1 < X:
- set matchX := X1
- choose m_fill0 if edge goes upward or m_fill1 if edge goes
downward
- temporary function result is true when choosen fill style is
not zero
- next edge
- next path
Note the "matchX" way avoids sorting of all X coordinates since we
must walk all edges anyway.
There are some tricky parts:
- calculation of curve crossings (a bit of math, should be already
implemented in the current point_test()
- a curve may cross the imaginary ray at two points:
...
. .
------.-----------.-------
. .
It that case both points must be tested and m_fill0 be used for one
crossing and m_fill1 for the other.
Basically the algorithm says: The point is inside the shape when the
rightmost edge (in that line), which is still at the left of the test
point, has a fill style at it's right side. For a line that goes from
bottom to top, that's m_fill1. For a line that goes from top to
bottom, that's m_fill0.
Udo