I would like to add a paint bucket, here's how it would work:
You would draw on the screen with different colours (drawCircle at touched place), and you put this paint bucket and until it hit another colour, it would keep colouring. Like all the other types of paint buckets.
I have no idea how to make this work normally or effeciently.
@anon73444976 I don't think you understand what I'm trying to say, What I'm trying to say is how do I detect what colour a pixel is without creating a lot of lag
Generally, Adafruit's libraries keep a buffer which contains the data you want displayed. Most of their graphics functions write to the buffer and there is one that actually sends that data from the buffer to the physical display.
Look at the source code for the library. There may already be a readPixel function that tells you what the buffer holds. If not, you can add one.
Not necessarily easy to determine, since there are library functions for drawing geometric shapes such as circles where the actual pixel data is generated by the function. Then you would need to look into either the buffer or the display itself.
It is also common on tft displays to be able to overwrite text onto a display without erasing whatever is already on the display, in which case readback from the display itself is needed.
The library just writes the pixels that are needed for the characters, leaving the background as-is. Adafruit has some fonts that also contain background information, allowing you to write text in one color and the background in another, but that is generally not supported in non-Adafruit fonts. To erase the old text you either write the same text in the background color (faster), or use a library function that returns the rectangular area the text occupies and write a box of the background color to that area (fairly slow).
To a degree. The library handles the work of determining exactly which pixels to write, and does rotation and scaling, as well as proportional spaced fonts with variable font size, so there really is a need to read back from the display.