Buffer Graphics Library [version 0.1]

Here is a graphics library I wrote (it's still in progress) for small to medium size (up to 256*256 pixels) monochrome displays (LCDs, LED matrices, ...). It takes advantage of fast RAM access of the Arduino boards and writes to buffers (a chunk of memory with the same size like the display) in the RAM instead of using the display driver itself to draw shapes. For each frame you want to display, you need to call a driver specific function to write the whole content of the screen. This function has to be provided by the driver library itself, and a lot of them already include them. And for those that don't such a function isn't hard to implement because most drivers support it (such as the T6963, here is my library for it).

The BufferGraphics library includes a large set of decently speed optimized graphics functions, such as:

  • Buffer manipulation, such as:
    Filling, copying, overlaying and inverting buffers
    Scrolling, flipping and rotating areas of buffers
  • Basic drawing, such as:
    Lines, Rectangles, Circles with different line modes
    Filled and inverting rectangles and circles
  • Pixel access
  • Bitmap drawing and storing, arbitrary rotating and shrinking

Most functions modify the bytes itself instead of setting the pixels individually, increasing the speed significantly.
The library comes with a bitmap converter tool to paste bitmap data easily in your sketches.
In addition, there is a pdf with a documentation of each function, how to use them and examples.

Each function was tested and should work, but there might be still some bugs since I basically wrote this library from scratch :slight_smile:

These functions are planned and already partially implemented, but commented out:

  • Bitmap transformation
  • Filled triangles and quadrilaterals

If you want to help implementing these functions or if you have improvements or optimizations, feel free to give it a try and add them. :slight_smile:

Download