# Sandbox.Painter.Rect

## Overload 1

```csharp
void Rect(Rect rect, Vector4 borderWidths, Color colorLeft, Color colorTop, Color colorRight, Color colorBottom, CornerRadii corners = null)
```

Draws a filled rectangle with independent inside border widths and colors, ordered left, top, right, bottom.
Uses Fill for the background and Stroke.Style for the border, with CSS corner joins and dash/dot spacing.
Stroke.Width, Stroke.Fill, Alignment, Cap and Join do not affect these explicit borders.
Border widths must be finite and non-negative. Corners follow the same rules as Rect.

### Parameters

- `rect` (`Rect`)
- `borderWidths` (`Vector4`)
- `colorLeft` (`Color`)
- `colorTop` (`Color`)
- `colorRight` (`Color`)
- `colorBottom` (`Color`)
- `corners` (`CornerRadii`), default `null`

## Overload 2

```csharp
void Rect(Rect rect, CornerRadii corners = null)
```

Draws a rectangle using Fill and Stroke. Pass a single radius for all corners,
or CornerRadii for elliptical corners ordered top-left, top-right, bottom-right, bottom-left.
Radii are in drawing pixels and follow CSS overlap clamping; negative or non-finite radii become zero.

### Parameters

- `rect` (`Rect`)
- `corners` (`CornerRadii`), default `null`

Declared in [Sandbox.Painter](/api/Sandbox.Painter).
Assembly: `Sandbox.Engine`.
