IRenderer.SetScissorRect(Nullable) Method
Definition¶
Namespace: Brine2D.Rendering
Set a scissor rectangle to clip all rendering to a specific region. All draw calls will be clipped to this rectangle until disabled with null.
void SetScissorRect(System.Nullable<Brine2D.Core.Rectangle> rect);
Parameters¶
rect System.Nullable<Rectangle>
Rectangle to clip to, or null to disable clipping
Example¶
// Clip to a 200x200 region
renderer.SetScissorRect(new Rectangle(10, 10, 200, 200));
renderer.DrawTexture(largeTexture, 0, 0); // Only visible part inside rect
// Disable clipping
renderer.SetScissorRect(null);
renderer.DrawTexture(largeTexture, 0, 0); // Fully visible
// Nested clipping for scroll view
renderer.SetScissorRect(scrollViewBounds);
foreach (var item in scrollItems)
{
renderer.DrawText(item.Text, item.X, item.Y, Color.White);
}
renderer.SetScissorRect(null);
Remarks¶
Scissor rects are useful for: - UI scroll views and panels - Text clipping in bounded areas - Split-screen rendering - Preventing rendering outside specific regions
The scissor rect is in screen coordinates (not world coordinates). It is not affected by camera transforms.