TftReadPixel()

Library Description ›› EPD ›› Buffered ›› Data ››
Parent Previous Next

Syntax

TftReadPixel(wX_Pixel As Word, wY_Pixel As Word), Word

Parameters

wX_Pixel — X-coordinate

wY_Pixel — Y-coordinate


Return value — 16-bit RGB565 color


Reads a pixel value from the RAM/SRAM buffer and returns it as a 16-bit color.


This is the read-side counterpart to TftPixel() — not to be confused with EpdPixel(), which reads from GRAM directly rather than a buffer.
What's actually stored in the buffer per pixel is a single bit (0 or 1), not a real color — the library decides what that bit means (Black/White or Red/Yellow) based on the panel's EpdType, and on which working plane and working buffer are currently selected.


Because of this, EpdSetPlane() gives you a way to control how TftReadPixel() interprets that bit.
As covered earlier, EpdSetPlane() normally reverts to the correct plane automatically — but you can call it manually right before a TftReadPixel() call to force the library to read the same stored bit as either Black/White or Red/Yellow, regardless of which plane it would have picked on its own.
This is exactly the kind of "limited case" manual plane-setting is meant for. The next pixel write afterward reverts plane selection back to automatic, as already described.


Because TftPixel() only ever stores one of the panel's handful of core colors (via EpdMapColor()'s reduction, covered earlier), TftReadPixel() can only ever return one of those same core colors back — it cannot recover whatever original, richer color was originally passed in and reduced.
Reading a pixel back gives you what will actually be displayed there, not what was originally requested.


This procedure is managed automatically by the library in normal use. Unlike TftPixel(), which you'll often call directly when drawing your own shapes or pixels, there's normally no need to call TftReadPixel() yourself — but it's useful to know it exists, particularly for the manual plane-forcing case above.

Created with the Personal Edition of HelpNDoc: Enhance Your Documentation with HelpNDoc's Advanced Project Analyzer