toPNG
toPNG(
device,framebuffer,width,height,texts?):string
Defined in: webgl/png.ts:15
Read a rendered framebuffer back to a PNG data URL. WebGL readback is
bottom-left origin, so rows are flipped to top-left for the image. Browser
only (uses a 2D canvas to encode). Render into framebuffer before calling.
texts (#219): screen-space labels composited on top of the readback via the shared
2D painter (the same one the Canvas backend renders with), so a WebGL toPNG()
includes the labels its HTML overlay shows on screen. Export-time only — never on a
per-frame path. The framebuffer is CSS-px sized, so label coords map 1:1.
Parameters
Section titled “Parameters”device
Section titled “device”Device
framebuffer
Section titled “framebuffer”Framebuffer
number
height
Section titled “height”number
texts?
Section titled “texts?”readonly TextData[] = []
Returns
Section titled “Returns”string