---
name: "SDL_FillRect"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_FillRect"
---

# SDL\_FillRect(3)

This function performs a fast fill of the given rectangle with some color

## NAME

SDL\_FillRect - This function performs a fast fill of the given rectangle with some color

## SYNOPSIS

**#include "SDL.h"**

**int SDL\_FillRect**(**SDL\_Surface \*dst, SDL\_Rect \*dstrect, Uint32 color**);

## DESCRIPTION

This function performs a fast fill of the given rectangle with **color**. If **dstrect** is **NULL**, the whole surface will be filled with **color**.

The color should be a pixel of the format used by the surface, and can be generated by the *SDL\_MapRGB* or *SDL\_MapRGBA* functions. If the color value contains an alpha value then the destination is simply "filled" with that alpha information, no blending takes place.

If there is a clip rectangle set on the destination (set via *SDL\_SetClipRect*) then this function will clip based on the intersection of the clip rectangle and the **dstrect** rectangle and the dstrect rectangle will be modified to represent the area actually filled.

## RETURN VALUE

This function returns **0** on success, or **-1** on error.

## SEE ALSO

**SDL\_MapRGB**, **SDL\_MapRGBA**, **SDL\_BlitSurface**, **SDL\_Rect**
