Nice functionaliy, may be you are willing to extend it a little bit:
I'm struggeling with the Moon Phase Widget ( https://github.com/espruino/BangleApps/tree/master/apps/widmp ) to add "the dark side of the moon". Currently it is drawn with a filled circle overlaid by a rectangle to clear it half.
I'm thinking about using your code to draw a half filled circle, for this it would be nice to add a parameter to disable the rounding of one or several edge(s).
I know that there are easier ways to draw a half filled circle but with a small modification this function (when hopefully added to the graphics library) will be "more universal".
My proposal is:
function drawRoundedRect (x1,y1, x2,y2, r, edgeMask)
where edgeMask is a bit coded parameter to disable the rounding of an edge (1,2,4,8 - in clockwise order):
edgeMask = (e.g.)
0x00 -> (_)
0x06 -> (_]
0x09 -> [_)
0x0F -> [_]
© Espruino, powered by microcosm.
Report a problem