var anyEl = …;
anyEl.paintBackground = function(gfx) {
gfx.fillColor(rgb(0,0,0))
.rectangle(0,0,100cm,100cm);
return true; // to suppress CSS background drawing
}
paintBackground/Content/Foreground methods are called while rendering HTML tree and the `gfx` passed to that function is the very same graphics that is used for rendering HTML/CSS tree.
That thing allows to combine immediate mode graphics a la ImGui with retained one to achieve more performant solution at the end.
Like in my Sciter (https://sciter.com) where you can do
paintBackground/Content/Foreground methods are called while rendering HTML tree and the `gfx` passed to that function is the very same graphics that is used for rendering HTML/CSS tree.That thing allows to combine immediate mode graphics a la ImGui with retained one to achieve more performant solution at the end.
The same approach can be used with WASM I think.