Basically: For every Y value, a start and end X coordinate is calculated. Espruino then fills in using those coordinates.
It means that if there are separate areas that needed to be filled on a row of pixels, they'll just be filled between.
As a result:
XX
XXX XXX XXXXX
X XX X X XX XXXXXXXXXXXXXX
X XX X XX X XXXX
XX XX X X X XXXX
X XXXX XX X XX
X XX X X XXX
X X X XXXX
X X X XXX
X X X XXXXXXXX
X XX XX XXXXX
X XXXXXXXXXXXX XXXX
XXXXX
Renders fine
Doesn't render
correctly
I guess maybe at some point someone might like to improve the algorithm so it can handle that first case ;) There are slightly more complex ways of rendering polygons that would work better.
could it mean implementing the tweeing fcns in E.compiledC & passing two Uint8Arrays as fcn args ?
Yes - that's probably the most sensible option - maybe 4 arguments: destination,source1,source2,data_length+tween_amount<<16
If you need a hand with that let me know and I can do some code.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, not explained well! Espruino's polygon drawing works in a pretty basic way: https://github.com/espruino/Espruino/blob/master/libs/graphics/graphics.c#L385
Basically: For every Y value, a start and end X coordinate is calculated. Espruino then fills in using those coordinates.
It means that if there are separate areas that needed to be filled on a row of pixels, they'll just be filled between.
As a result:
I guess maybe at some point someone might like to improve the algorithm so it can handle that first case ;) There are slightly more complex ways of rendering polygons that would work better.
Yes - that's probably the most sensible option - maybe 4 arguments:
destination,source1,source2,data_length+tween_amount<<16
If you need a hand with that let me know and I can do some code.