FabGL
ESP32 Display Controller and Graphics Library

◆ writeScreen()

void writeScreen ( Rect const &  rect,
RGB222 srcBuf 
)

Writes pixels inside the specified rectangle.

Screen writing may occur while other drawings are in progress, so written pixels may be overlapped or mixed.

Parameters
rectScreen rectangle to write. To improve performance rectangle is not checked.
srcBufSource 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 508 of file vgacontroller.cpp.