https://github.com/aykevl/tinygl
Tiny graphics library for SPI connected displays
https://github.com/aykevl/tinygl
Last synced: 7 months ago
JSON representation
Tiny graphics library for SPI connected displays
- Host: GitHub
- URL: https://github.com/aykevl/tinygl
- Owner: aykevl
- License: bsd-3-clause
- Created: 2023-03-24T17:35:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-25T14:30:30.000Z (over 1 year ago)
- Last Synced: 2025-03-17T10:38:27.040Z (7 months ago)
- Language: Go
- Size: 569 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-tinygo - tinygl - The fastest and smallest Go math library for constrained environments, like microcontrollers or WebAssembly. (Display Hardware)
README
# Tiny graphics library
**Note: work in progress.** This module isn't ready for use yet.
Create fast graphics on slow SPI-connected displays.
This library is inspired by [LVGL](https://lvgl.io/) and [Fyne](https://fyne.io/) and provides a way to create fast user interfaces on slow SPI connected displays.
## Supported displays
Most dislays from the TinyGo drivers repository can be supported. The main requirement is that they have a way to send raw pixel data to the display (`DrawRGBBitmap8`).
## Contributing
You are free to contribute, but note that the design isn't complete yet so more features may need to be delayed a bit until I think the design is right.
### Code style
To make things fast and to reduce memory consumption, there are a few code style considerations apart from the usual Go conventions:
* All internal colors are stored as the target pixel data. This is usually RGB565 big-endian.
* Coordinates are of the `int` type in the public API and when doing integer math, but are stored as `int16`.
Rationale: `int16` is usually big enough for all coordinates. However, the main compilation target is 32-bit microcontrollers which are most efficient when working with 32-bit integers. Casting on load/store is usually free: ARM has a sign-extending 16-bit load instruction and stores are simply a truncating 16-bit store. Using `int` in the public API is also more convenient for users of the API.
* No memory allocations should be needed while writing data to the display.
* The main package (tinygl) does not care about any particular UI style like Material. Such styles should be implemented separately.### Release criteria
This library isn't complete. There are some things I'd like to improve before calling this stable:
- [x] ~The `Displayer` interface isn't great: `DrawRGBBitmap8` always takes a byte slice, which is unfortunate. It would be better if it could take a slice of the underlying pixel data instead.~
- [ ] Black-and-white screens aren't well supported: they have pixel data smaller than a single byte. These screens aren't natively supported in LVGL either, but it would be nice if we were able to.
- [ ] Displays with in-memory buffers could be better supported, by writing to the buffers directly. An example is the hub75 display driver.
- [ ] Theming needs to be improved. Ideally, the theme and the layout code are entirely separate and the theme just sets the sizes/colors to be used for standard widgets.
- [ ] DPI scaling isn't implemented yet. It should ideally be able to do all important calculations at compile time.
- Lots of features are missing, like:
- [ ] show/hide animations that look smooth (by only redrawing parts of the screen that changed)
- [x] ~using hardware scrolling present in most SPI displays~
- [ ] all the missing widgets and container types## License
BSD 2-clause license, see LICENSE.txt for details.