FabGL
ESP32 Display Controller and Graphics Library

◆ readScreen()

void readScreen ( Rect const &  rect,
RGB222 destBuf 
)

Reads pixels inside the specified rectangle.

Screen reading may occur while other drawings are in progress, so the result may be not updated.

Parameters
rectScreen rectangle to read. To improve performance rectangle is not checked.
destBufDestination buffer. Buffer size must be at least rect.width() * rect.height.

Example:

// paint a red rectangle
Canvas.setBrushColor(Color::BrightRed);
Rect rect = Rect(10, 10, 100, 100);
Canvas.fillRectangle(rect);

// wait for vsync (hence actual drawing)
VGAController.processPrimitives();

// read rectangle pixels into "buf"
auto buf = new RGB222[rect.width() * rect.height()];
VGAController.readScreen(rect, buf);

// write buf 110 pixels to the reight
VGAController.writeScreen(rect.translate(110, 0), buf);
delete buf;

Definition at line 499 of file vgacontroller.cpp.