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):
On the other way round, maybe r and roundMask can be added to the generic drawRect() function (with roundMask to enable rounded edges) but I don't know how Javascript reacts when function parameters are missing.
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.
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:
where
edgeMask
is a bit coded parameter to disable the rounding of an edge (1,2,4,8 - in clockwise order):On the other way round, maybe
r
androundMask
can be added to the generic drawRect() function (with roundMask to enable rounded edges) but I don't know how Javascript reacts when function parameters are missing.