What I want is to redraw the rectangle at the end of the for cycle withour flickering over the other rectangles already drawn on screen any idea how can I achieve that ?
Also the tft library have PImage when I add it as object almost 35-40% of memory is used for it so how can I dispose that resource from the RAM after I dont need it any more ?
What screen are you using, I might be able to recreate what you're seeing. I need the full code too. A lot of times you can't do anything about the flicker, unless you change the library itself.
Could you also post maybe a video just in case i can't recreate your issue?
Edit:
Ok I have a LCD very similar that uses the same background library (ST7735), but the main library TFT, is different. But I will see what I can do.
Ok, I got it working with your code, and I see what you are saying about the flicker, but what exactly are you trying to do?
The flicker is due to the way the rectangles are drawn on screen. Your code is drawing many little boxes really fast, then you have a black box that draws over them. The flicker is there because, the black box is not being drawn fast enough, so what you see is parts of the other boxes still on the screen.
If the flicker is such a burden, then you can always get a DUE, it is much faster(expensive too) and it should get rid of that flicker.
Well then instead of drawing all the little rectangles first, make the black rectangle first then draw the little rectangles over it, BUT, not the way you are doing it now. Right now, you are drawing all the little rectangle on the screen all at once. what you should be doing is only drawing the one that should be visible at a certain "index"
So to do this you will either need to use IF/ELSE statements or CASE statements.
If you are not using a DUE or other very fast processor, then your approach of drawing everything first, will not work.