current blend mode
current fill & stroke style color, with its own alpha. A fill or a
stroke is drawn at this alpha times RenderState#globalAlpha,
as a 2D context draws its fillStyle under its globalAlpha.
current per-renderable depth value, pushed into the vertex stream
by the WebGL batchers as the z component of each vertex. Has no
visible effect under the engine's default orthographic projection;
required for perspective (Camera3d) to scale sprites by distance.
Mirrors renderable.depth, set by Renderable.preDraw via
Renderer#setDepth.
current gradient fill (null when using solid color)
current scissor/clipping rectangle [x, y, width, height]
current custom shader effect (undefined when using default shader)
current tint applied to sprites
current transformation matrix
current global alpha, applied to everything drawn: fills and strokes (times the colour's own alpha) and images (times the tint). Kept apart from RenderState#currentColor, so a translucent colour does not fade the images drawn after it.
current line dash pattern (empty array = solid line)
current line join, saved and restored like RenderState#lineWidth
current line width. The GPU renderers keep theirs here so that save()/restore() covers it, the way a 2D context's state does; the Canvas renderer leaves it to the context itself.
Reset all state to defaults and clear the stack.
canvas width
canvas height
Restore state from the stack.
Color, global alpha, tint, transform, and scissor are restored in place.
Blend mode is NOT applied to currentBlendMode — it is returned so the
renderer can call its own setBlendMode() (which has context-specific side effects).
current canvas width (used when scissor was inactive)
current canvas height (used when scissor was inactive)
restored blend mode and scissor flag, or null if stack was empty
Save the current state onto the stack (zero allocations).
OptionalscissorTestActive: boolean = false
whether scissor/clip is currently enabled
Renderer-agnostic state container with a pre-allocated save/restore stack.
Owns the mutable rendering state (color, global alpha, tint, transform, scissor, blend mode, line width and join) and provides zero-allocation save()/restore() via index-based stacks. Both CanvasRenderer and WebGLRenderer (and future WebGPU) delegate state management here, keeping rendering-context-specific code in the renderers.