Skip to content

SDL_Surface

A software (CPU) image in memory. Freed when references vanish. Typically converted to SDL_Texture for drawing, or used as raw pixel data.

blit(dstRect, srcSurface, srcRect) function

Blit (copy) another surface onto this surface, scaling if needed.

dstRect: Destination {x, y, w, h}

srcSurface: The source SDL_Surface

srcRect: {x, y, w, h} portion from source

Returns: None

scale(newSize) function

Return a new SDL_Surface scaled to [width, height] using linear filtering.

newSize: [width, height]

Returns: A new SDL_Surface with the scaled result.

fill(color) function

Fill the entire surface with a single color.

color: [r, g, b, a] in 0..1

Returns: None

rect(rect, color) function

Fill a sub-rectangle of the surface with a color.

rect: {x, y, w, h}

color: [r, g, b, a]

Returns: None

dup() function

Make a copy of this surface in RGBA format.

Returns: A new SDL_Surface copy.