Go Down

Topic: How to save a portion of the TFT adafruit's screen? (Read 154 times) previous topic - next topic



I'm using an Adafruit's similar 2.4" TFT screen, with no touch capabilities.

I need to draw a window over the content already drawn on the tft screen.

Is there any way, or function, that reads the contents of a rectangular area drawn on screen and saves it to a matrix? Something like instead of drawRectangle(), saveRectangle(x,y,height,width)?

Then I would draw a window, perform the stuff inside it, and only re-draw the exact rectangular area saved before, instead of redrawing the entire screen.

is there a way to do it? I've read it's possible to read one pixel at a time... I could write a function to read one by one ( I guess) and save it to a matrix, but I'd like to know if there's something like that already made...

Thanks so much for reading!


Sep 12, 2016, 06:39 am Last Edit: Sep 12, 2016, 06:42 am by david_prentice
Which shield?
Which library?

If you have a Uno style shield,  most of these can read registers and memory.   e.g. readID() and readPixel().
MCUFRIEND_kbv library has a readGRAM() method that will read a rectangle area.
Note that you need a big buffer to store even a small window.  e.g. 20x20 uses 800 bytes of SRAM.



Hi! Thanks!

No shield. Just an ordinary 2.2 tft like this,


wired through a 5v/3.3 level converter.

I´m using this library PDQ_GFX


Is this MCUFRIEND_KBV a faster alternative to the PDQ? But I read it´s not optimized to MEGA (mine)

I´m curious also if the MarekB library would be a better overall option for my MEGA, than the PDQ. But I coudn´t find in the documentation nothing about saving this rectangle area..

Anyway, I would have to re-write almost the whole screen (the window got too big), so I guess It won´t make a difference anyway...



Most ILI9341 SPI libraries have got broken or missing readPixel() functions.   However it is easy enough to fix / implement (providing your level converters support MISO properly)

You can save a whole screen to a SD card or Flash memory.    I don't think you will find many boards with external RAM.   (like the Xmega128A1 Xplained)

So you are limited to small areas if you only have AVR SRAM and EEPROM.

Incidentally Codevision's TFT libraries support memory reading.


Go Up