Closed djadala closed 6 years ago
Thank you Jamil. Good catch!
It is a bug, I was able to reproduce and fix it. What happened is that there is no explicit "close open" command in the path command set. However, rather than add that as a separate command, what I was trying to do was, for the sake of simplicity, make the "close open" implicit, either when the path stops, or if a "moveto" is called while a path is open. It is the latter case that was not being handled correctly, so I needed to add another q.Stop(false) right at the beginning of the PathMoveto case in the AddTo function. If a path is currently not being drawn, Stop should not do anything. However, to make sure of that, upon reviewing my code I also added a simple Clear command to the Filler struct to be sure that a stray line is not drawn if the filler does not stop cleanly due to an error or something like that.
Specifically:
Added a Stop(false) in AddTo func of geomx.go:
func (p Path) AddTo(q Adder) {
for i := 0; i < len(p); {
switch PathCommand(p[i]) {
case PathMoveTo:
q.Stop(false) // Fixes issues #1 by described by Djadala; implict close if currently in path.
q.Start(fixed.Point26_6{p[i+1], p[i+2]})
i +=
...
Added this in filler.go in case the filler does not stop cleanly:
func (r *Filler) Clear() {
r.a = fixed.Point26_6{}
r.first = r.a
r.Scanner.Clear()
}
So, I am going to close this issue since I think this fixes it. Please let me know if it does not work for you.
-Steve
Hi, while testing rasterx, i write this example:
Note testPath.Stop(false) in GetTestPath. Result is in attached file:
i able to resolve issue by adding new PathCommand:
...
but i am not sure if this is correct fix.
Regards.