GithubHelp home page GithubHelp logo

tinygl's Introduction

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 and Fyne 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:

  • 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)
    • 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.

tinygl's People

Contributors

aykevl avatar deadprogram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hybridgroup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.