SDL_DisplayFormat(3)
π SDL_DisplayFormat(3) π
okay bestie, welcome to the SDL API Reference β¨ this one's a lil glow-up function and it's honestly so useful, let's get into it π«Ά
πΈ NAME πΈ
SDL_DisplayFormat β converts a surface to the display format π
β¨ SYNOPSIS β¨
#include "SDL.h"
SDL_Surface *SDL_DisplayFormat(SDL_Surface *surface);
π¦ DESCRIPTION π¦
so basically, this function takes a surface and copies it onto a brand new surface β one that's in the pixel format and colors of the video framebuffer. why do we care?? because that makes it suitable for fast blitting onto the display surface. it's giving speed, it's giving optimized, it's giving main character energy fr fr π₯
and the way it does that? it calls SDL_ConvertSurface. periodt π
β¨ pro tip moment β¨ if you wanna take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and the alpha value before you call this function. timing is everything bestie, do it first or it just won't hit the same π
and if you're out here wanting an alpha channel? that's a whole different function β go see SDL_DisplayFormatAlpha π§
π RETURN VALUE π
if the conversion fails, or it runs out of memory, it returns NULL. that's it, that's the whole thing. no cap. so pls pls pls check your return value π
π SEE ALSO π
SDL_ConvertSurfaceSDL_DisplayFormatAlphaSDL_SetAlphaSDL_SetColorKeySDL_Surface
that's the page bestie!! π this was the SDL manpage, dated Tue 11 Sep 2001, 23:01 β yeah she's vintage but she still ate π go forth and blit fast, ily, bye!! ππΈπ¦
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms