---
name: "SDL_CreateRGBSurfaceFrom"
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_CreateRGBSurfaceFrom"
---

# SDL\_CreateRGBSurfaceFrom(3)

Create an SDL\_Surface from pixel data

## NAME

SDL\_CreateRGBSurfaceFrom - Create an SDL\_Surface from pixel data

## SYNOPSIS

**#include "SDL.h"**

**SDL\_Surface \*SDL\_CreateRGBSurfaceFrom**(**void \*pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask**);

## DESCRIPTION

Creates an SDL\_Surface from the provided pixel data.

The data stored in **pixels** is assumed to be of the **depth** specified in the parameter list. The pixel data is not copied into the **SDL\_Surface** structure so it should not be freed until the surface has been freed with a called to *SDL\_FreeSurface*. **pitch** is the length of each scanline in bytes.

See **SDL\_CreateRGBSurface** for a more detailed description of the other parameters.

## RETURN VALUE

Returns the created surface, or **NULL** upon error.

## SEE ALSO

**SDL\_CreateRGBSurface**, **SDL\_FreeSurface**
