olikraus / ucglib

Arduino True Color Library for TFTs and OLEDs
https://github.com/olikraus/ucglib/wiki
Other
261 stars 76 forks source link

Implement frame buffer #124

Closed fornellas closed 2 years ago

fornellas commented 4 years ago

Implements an optional frame buffer on top of existing functionality. It works by redirecting all drawing functions to happen in memory, and allow users to explicitly send the buffer as a whole to the display when finished. This eliminates all visual artifacts resulting from updating graphics directly on the display memory.

Given that not all use cases have enough memory for a frame buffer, users can optionally use it with:

  ucg_InitBuffer(
    &ucg,
    ucg_dev_ssd1351_18x128x128_ilsoft,
    ucg_ext_ssd1351_18,
    ucg_com_cm3_4wire_HW_SPI
  );
  ucg_SetColor(&ucg, 0, 255, 255, 255);
  ucg_DrawBox(&ucg, 0, 0, 100, 10);
  ucg_SendBuffer(&ucg);

Data will be all pumped to the display only when ucg_SendBuffer is called.

I tested this with a SSD1351 and the SDL examples, everything seems all right.

Implementation details:

Closes #122.

PS: This PR is on top of #123, which should be reviewed / merged first.

fornellas commented 2 years ago

I'm closing this PR as it seems there's no interest in merging or reviewing it. I ended up writing a completely new graphics library, which solves this an many other problems: https://github.com/fornellas/eglib.