Egui::Canvas
Inherits Egui::Widget < Reference < Object
Constructors
Instance methods
Solid write (alpha overwrite); out-of-bounds writes are ignored.
Coverage blend: cov in 0..255 multiplies the incoming color's
alpha (antialiased glyph rendering).
Blit an RGBA8 w×h buffer at (x, y). transparent_color skips
matching pixels (Paint's transparent-selection mode).
Freehand stroke through an already-stamped dab trail is just repeated #line calls in the app; brushes with round/diagonal stamps use this segmented variant.
Release the GPU texture (app shutdown / canvas replacement).
Ellipse inscribed in the bounding rect (x, y, w, h). Midpoint
algorithm (both quadrant pairs), every boundary pixel stamped for
width thickness.
Erase a w×h region down to one color (selection lift/cut).
Scanline flood fill (4-connected, exact color match).
Upload pending pixels NOW (show/flush otherwise catch it a frame later) — call after this frame's tool processing. Skipped when the buffer was resized after the texture (post-#show #resize): the stale texture gets wrong-size data — #ensure_texture recreates it on the next #show, and a same-frame second update is a sokol validation error (one sg_update_image per image per frame).
Short human label for the inspector (the button's text, a label's text…); nil = no meaningful label.
Bresenham line stamped with a square brush width px across.
The raw RGBA8 buffer (top-down, stride width*4). Read-only use; mutations through this reference bypass the dirty flag — call #mark_dirty after writing.
Outline of width device pixels, drawn inside the rect.
Copy a w×h region out (RGBA8); out-of-bounds areas read as transparent black.
Replace the whole buffer (must be widthheight4 bytes, RGBA8).
New dimensions; content is NOT preserved (call #snapshot/#restore around it when needed). The GPU texture is recreated lazily on the next #show.
Undo across resizes: a snapshot from a different canvas size resizes the canvas back and then restores the pixels.
Horizontal span, inclusive of both ends.
One brush dab centered on (x, y): shape is :square, :circle,
:fslash (╲) or :bslash (╱); size is the full diameter.