Skip to content

RendererExtensions.WithScissorRect(this IRenderer, Nullable, Action) Method

Definition

Namespace: Brine2D.Rendering

Execute an action with a temporary scissor rect. The previous scissor rect is automatically restored after the action.

public static void WithScissorRect(this Brine2D.Rendering.IRenderer renderer, System.Nullable<Brine2D.Core.Rectangle> rect, System.Action action);

Parameters

renderer IRenderer

rect System.Nullable<Rectangle>

action System.Action

Example

renderer.WithScissorRect(panelBounds, () =>
{
    // All rendering here is clipped to panelBounds
    RenderPanelContent();
});
// Scissor rect automatically restored here