https://github.com/rozek/banglejs-2-drawroundrect
draws a rounded rectangle on a Bangle.js 2
https://github.com/rozek/banglejs-2-drawroundrect
banglejs
Last synced: 11 months ago
JSON representation
draws a rounded rectangle on a Bangle.js 2
- Host: GitHub
- URL: https://github.com/rozek/banglejs-2-drawroundrect
- Owner: rozek
- License: mit
- Created: 2022-01-08T16:10:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-01T05:59:18.000Z (over 4 years ago)
- Last Synced: 2025-03-24T15:23:03.322Z (about 1 year ago)
- Topics: banglejs
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# banglejs-2-drawroundrect #
draws a rounded rectangle on a Bangle.js 2
This module adds a method `drawRoundRect` for drawing rounded rectangles to the global graphics context `g`. The current implementation is based on a remark from forum user [RaoulDuke](http://forum.espruino.com/profiles/181747/) (see [this discussion](http://forum.espruino.com/conversations/371330)).

The new method has the signature
```javascript
g.drawRoundRect(x1,y1, x2,y2, radius);
```
with the following parameters:
* `x1` - the left x coordinate
* `y1` - the top y coordinate
* `x2` - the right x coordinate
* `y2` - the bottom y coordinate
* `radius` - the corner radius (limited to 50% of the shorter edge of the rectangle
The rounded rectangle is 1px wide and drawn in the current foreground color.
## License ##
[MIT License](LICENSE.md)