PAX graphics

Related blog posts

Joining Badge.Team

A badge prototype.

A badge prototype.

In summer 2020, I started volunteering for the MCH2022 Badge.Team. I really wanted to contribute, but at first I didn't know where to start. So, I tried making an app for the SH2017 badge.

That is when I realised. There is no way to perform transformations. There isn't even a way to draw a triangle!

So, I got to work creating some better graphics for them. And now, for the MCH2022 badge, I was asked to write the graphics stack.

The graphics stack I'm writing is called PAX graphics, an improved version of what I learned by making graphics for the earlier Badge.Team firmware.

About PAX graphics

A frame of the graphics demo.

A frame of the graphics demo.

By necessity, PAX graphics is licensed MIT. This permissive license means you can use and modify it all you want, which is required for Badge.Team and MCH2022 as there's been problems with licensing in the past.

PAX is a feature rich 2D drawing library, written for the ESP32 (esp-idf v4). With the goal being allowing the uninitiated to draw some cool graphics, optimisation is key: There a few internal optimisations, some small gains and some big gains.
Other features include:

  • New color blending functions,
  • Support for HSV colors (HSV to RGB),
  • Triangle drawing,
  • 2D transformations like scale, rotate and translate (like moving the canvas),
  • Many color modes picked on a buffer-by-buffer basis, to conserve RAM and to support displays,
  • And the ability to not compile features you don't use.

For those of you who want to use it, check out the documentation. Contributions are welcome.

The demo

In the video above, you can see a small demo of the library so far. The framerate is calculated based on the time between writes to display, which includes the fairly long display update time. Theoretical maxima of performance is in the 20FPS range.