Module surface
Available on crate feature
dep_sdl3
only.Expand description
SDL surfaces are buffers of pixels in system RAM. These are useful for passing around and manipulating images that are not stored in GPU memory.
SDL_Surface
makes serious efforts to manage images in various formats, and
provides a reasonable toolbox for transforming the data, including copying
between surfaces, filling rectangles in the image data, etc.
There is also a simple .bmp loader, SDL_LoadBMP()
. SDL itself does not
provide loaders for various other file formats, but there are several
excellent external libraries that do, including its own satellite library,
SDL_image:
Structs§
- SDL_
Flip Mode - The flip mode.
- SDL_
Scale Mode - The scaling mode.
- SDL_
Surface - A collection of pixels used in software blitting.
Constants§
- SDL_
FLIP_ HORIZONTAL - flip horizontally
- SDL_
FLIP_ NONE - Do not flip
- SDL_
FLIP_ VERTICAL - flip vertically
- SDL_
PROP_ SURFACE_ HDR_ HEADROOM_ FLOAT - SDL_
PROP_ SURFACE_ SDR_ WHITE_ POINT_ FLOAT - SDL_
PROP_ SURFACE_ TONEMAP_ OPERATOR_ STRING - SDL_
SCALEMODE_ LINEAR - linear filtering
- SDL_
SCALEMODE_ NEAREST - nearest pixel sampling
- SDL_
SURFACE_ LOCKED - Surface is currently locked
- SDL_
SURFACE_ LOCK_ NEEDED - Surface needs to be locked to access pixels
- SDL_
SURFACE_ PREALLOCATED - Surface uses preallocated pixel memory
- SDL_
SURFACE_ SIMD_ ALIGNED - Surface uses pixel memory allocated with
SDL_aligned_alloc()
Functions§
- SDL_
AddSurface ⚠Alternate Image - Add an alternate version of a surface.
- SDL_
Blit ⚠Surface - Performs a fast blit from the source surface to the destination surface with clipping.
- SDL_
Blit ⚠Surface9 Grid - Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format.
- SDL_
Blit ⚠Surface Scaled - Perform a scaled blit to a destination surface, which may be of a different format.
- SDL_
Blit ⚠Surface Tiled - Perform a tiled blit to a destination surface, which may be of a different format.
- SDL_
Blit ⚠Surface Tiled With Scale - Perform a scaled and tiled blit to a destination surface, which may be of a different format.
- SDL_
Blit ⚠Surface Unchecked - Perform low-level surface blitting only.
- SDL_
Blit ⚠Surface Unchecked Scaled - Perform low-level surface scaled blitting only.
- SDL_
Clear ⚠Surface - Clear a surface with a specific color, with floating point precision.
- SDL_
Convert ⚠Pixels - Copy a block of pixels of one format to another format.
- SDL_
Convert ⚠Pixels AndColorspace - Copy a block of pixels of one format and colorspace to another format and colorspace.
- SDL_
Convert ⚠Surface - Copy an existing surface to a new surface of the specified format.
- SDL_
Convert ⚠Surface AndColorspace - Copy an existing surface to a new surface of the specified format and colorspace.
- SDL_
Create ⚠Surface - Allocate a new surface with a specific pixel format.
- SDL_
Create ⚠Surface From - Allocate a new surface with a specific pixel format and existing pixel data.
- SDL_
Create ⚠Surface Palette - Create a palette and associate it with a surface.
- SDL_
Destroy ⚠Surface - Free a surface.
- SDL_
Duplicate ⚠Surface - Creates a new surface identical to the existing surface.
- SDL_
Fill ⚠Surface Rect - Perform a fast fill of a rectangle with a specific color.
- SDL_
Fill ⚠Surface Rects - Perform a fast fill of a set of rectangles with a specific color.
- SDL_
Flip ⚠Surface - Flip a surface vertically or horizontally.
- SDL_
GetSurface ⚠Alpha Mod - Get the additional alpha value used in blit operations.
- SDL_
GetSurface ⚠Blend Mode - Get the blend mode used for blit operations.
- SDL_
GetSurface ⚠Clip Rect - Get the clipping rectangle for a surface.
- SDL_
GetSurface ⚠Color Key - Get the color key (transparent pixel) for a surface.
- SDL_
GetSurface ⚠Color Mod - Get the additional color value multiplied into blit operations.
- SDL_
GetSurface ⚠Colorspace - Get the colorspace used by a surface.
- SDL_
GetSurface ⚠Images - Get an array including all versions of a surface.
- SDL_
GetSurface ⚠Palette - Get the palette used by a surface.
- SDL_
GetSurface ⚠Properties - Get the properties associated with a surface.
- SDL_
LoadBMP ⚠ - Load a BMP image from a file.
- SDL_
LoadBMP_ ⚠IO - Load a BMP image from a seekable SDL data stream.
- SDL_
Lock ⚠Surface - Set up a surface for directly accessing the pixels.
- SDL_
MUSTLOCK ⚠ - Evaluates to true if the surface needs to be locked before access.
- SDL_
MapSurfaceRGB ⚠ - Map an RGB triple to an opaque pixel value for a surface.
- SDL_
MapSurfaceRGBA ⚠ - Map an RGBA quadruple to a pixel value for a surface.
- SDL_
Premultiply ⚠Alpha - Premultiply the alpha on a block of pixels.
- SDL_
Premultiply ⚠Surface Alpha - Premultiply the alpha in a surface.
- SDL_
Read ⚠Surface Pixel - Retrieves a single pixel from a surface.
- SDL_
Read ⚠Surface Pixel Float - Retrieves a single pixel from a surface.
- SDL_
Remove ⚠Surface Alternate Images - Remove all alternate versions of a surface.
- SDL_
SaveBMP ⚠ - Save a surface to a file.
- SDL_
SaveBMP_ ⚠IO - Save a surface to a seekable SDL data stream in BMP format.
- SDL_
Scale ⚠Surface - Creates a new surface identical to the existing surface, scaled to the desired size.
- SDL_
SetSurface ⚠Alpha Mod - Set an additional alpha value used in blit operations.
- SDL_
SetSurface ⚠Blend Mode - Set the blend mode used for blit operations.
- SDL_
SetSurface ⚠Clip Rect - Set the clipping rectangle for a surface.
- SDL_
SetSurface ⚠Color Key - Set the color key (transparent pixel) in a surface.
- SDL_
SetSurface ⚠Color Mod - Set an additional color value multiplied into blit operations.
- SDL_
SetSurface ⚠Colorspace - Set the colorspace used by a surface.
- SDL_
SetSurface ⚠Palette - Set the palette used by a surface.
- SDL_
SetSurfaceRLE ⚠ - Set the RLE acceleration hint for a surface.
- SDL_
Stretch ⚠Surface - Perform a stretched pixel copy from one surface to another.
- SDL_
Surface ⚠HasAlternate Images - Return whether a surface has alternate versions available.
- SDL_
Surface ⚠HasColor Key - Returns whether the surface has a color key.
- SDL_
Surface ⚠HasRLE - Returns whether the surface is RLE enabled.
- SDL_
Unlock ⚠Surface - Release a surface after directly accessing the pixels.
- SDL_
Write ⚠Surface Pixel - Writes a single pixel to a surface.
- SDL_
Write ⚠Surface Pixel Float - Writes a single pixel to a surface.
Type Aliases§
- SDL_
Surface Flags - The flags on an
SDL_Surface
.