New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should g.fillPoly handle a complex path? #1710
Comments
Right now this is as expected - it's what I'd mentioned before about having a slower but more capable fillPoly implementation. The current one works on a scanline basis - filling from lowest X to highest X. |
Thanks |
Taken from the forums post |
Example algorithm posted here: http://forum.espruino.com/conversations/341492/#15015802 It looks simpler than what's there already really! |
It's simple because it doesn't work properly :/ Current code is here: https://github.com/espruino/Espruino/compare/fillPoly_irregular I had to modify it so it handled the topmost Y coordinate correctly (eg when drawing a diamond it'd miss off the top), and then also had to add a 'slope' so that it could handle the duplicate corners that would then be produced. However drawing vector fonts still results in something like this:
This is because the vector font is (currently) made out of a bunch of regular polygons, and there appear to be issues where they join |
Ok, now fixed. Looks like the code mentioned initially actually does a standard polygon fill thing, which is to not fill the top and right hand pixels so that if you put polygons against each other you don't end up with overdraw - which is why the scanline code refused to draw the top pixel My hacks will likely cause problems with more complex polygons since i'm effectively duplicating vertices at the corners :( |
Ok, fixed with 4442951 |
got some drawPoly that are not rendered like I though it should.
The text was updated successfully, but these errors were encountered: