WithClipRect
Execute a callback with a temporary clipping rectangle.
Syntax
Susano.WithClipRect(x, y, w, h, callback) -> void
Parameters
x, y (number): Top-left corner of the clip region in pixels.
w, h (number): Width and height of the clip region in pixels.
callback (function): A function containing draw commands to execute within the clip region.
Return(s)
None
Behavior
Convenience wrapper that pushes a clip rect, executes your callback, then pops the clip rect. Always intersects with the current clip rect. PopClipRect() is called even if the callback errors.
Example(s)
Susano.WithClipRect(100, 100, 200, 150, function()
Susano.DrawRectFilled(50, 50, 300, 300, 1, 0, 0)
end)