Skip to content

textmode.js / TextmodeFramebuffer / readPixels

Method: readPixels() ​

ts
readPixels(attachmentIndex): Uint8Array;

Read RGBA pixel data from one attachment.

The returned data is vertically flipped so the first row matches the top row of the framebuffer when used from JavaScript.

Parameters ​

ParameterTypeDescription
attachmentIndexnumberZero-based attachment index to read.

Returns ​

Uint8Array

RGBA pixel data for the selected attachment.

Example ​