rdagger / micropython-ili9341

MicroPython ILI9341Display & XPT2046 Touch Screen Driver
MIT License
191 stars 40 forks source link

show() function #36

Open Rickroller01 opened 1 month ago

Rickroller01 commented 1 month ago

Is there a way to implement manually updating the display similar to the show() function in the ssd1306 library. My guess is adding another buffer to the Block() function.

rdagger commented 1 month ago

This issue is similar to https://github.com/rdagger/micropython-ili9341/issues/35#issue-2568191496

Rickroller01 commented 1 month ago

This issue is similar to #35 (comment)

I have noticed that. Will I be able to replace the block function with an extra framebuffer then add a show() function that is basically the block function?

rdagger commented 1 month ago

Improving the library properly will take some work. A simple approach would be to modify the block function to draw to a framebuffer and then add a show method, but this wouldn't fully take advantage of the performance benefits offered by the framebuffer class.

In MicroPython v1.20.0, several useful framebuffer methods were added, such as ellipse, poly, and rect (with a new fill option). These methods are implemented in C, making them significantly faster and more efficient than their Python equivalents.

To improve the library properly, a secondary set of shape-drawing methods should be added to fully leverage these native framebuffer methods. This would provide the best performance and functionality by taking advantage of the underlying C implementations.

However, this functionality is already achievable by directly creating a framebuffer, drawing on it using the native methods, and then using the _display.drawsprite method to transfer the framebuffer to the display.