logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_Surface - A collection of pixels used in software blitting.

Availability

       This struct is available since SDL 3.2.0.

Description

       Pixels  are  arranged  in  memory  in rows, with the top row first. Each row occupies an amount of memory
       given by the pitch (sometimes known as the row stride in non-SDL APIs).

       Within each row, pixels are arranged from left to right until the width is reached. Each pixel occupies a
       number of bits appropriate for its format, with most formats representing each pixel as one or more whole
       bytes (in some indexed formats, instead multiple pixels are packed into each  byte),  and  a  byte  order
       given  by  the  format.  After  encoding  all  pixels, any remaining bytes to reach the pitch are used as
       padding to reach a desired alignment, and have undefined contents.

       When a surface holds YUV format data, the planes are assumed to be  contiguous  without  padding  between
       them,  e.g.  a  32x32  surface  in NV12 format with a pitch of 32 would consist of 32x32 bytes of Y plane
       followed by 32x16 bytes of UV plane.

       When a surface holds MJPG format data, pixels points at the compressed JPEG image and pitch is the length
       of that data.

Name

       SDL_Surface - A collection of pixels used in software blitting.

See Also

SDL_CreateSurface(3), SDL_DestroySurface(3)

Simple Directmedia Layer                           SDL 3.2.20                                 SDL_Surface(3type)

Synopsis

#include<SDL3/SDL_surface.h>structSDL_Surface{SDL_SurfaceFlagsflags;/**<Theflagsofthesurface,read-only*/SDL_PixelFormatformat;/**<Theformatofthesurface,read-only*/intw;/**<Thewidthofthesurface,read-only.*/inth;/**<Theheightofthesurface,read-only.*/intpitch;/**<Thedistanceinbytesbetweenrowsofpixels,read-only*/void*pixels;/**<Apointertothepixelsofthesurface,thepixelsarewriteableifnon-NULL*/intrefcount;/**<Applicationreferencecount,usedwhenfreeingsurface*/void*reserved;/**<Reservedforinternaluse*/};

See Also