SDL_LoadBMP(3)

πŸ’– SDL_LoadBMP(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_LoadBMP β€” the one that loads a BMP image from a file. no cap. πŸŽ€


🌸 NAME 🌸

SDL_LoadBMP β€” load a BMP image from a file, periodt. πŸ¦‹


✨ SYNOPSIS ✨

#include <SDL3/SDL_surface.h>

SDL_Surface * SDL_LoadBMP(const char *file);

look at her. so simple. so iconic. πŸ’…


🫢 DESCRIPTION 🫢

She gives you a brand-new surface loaded up from your BMP file, and she is literally handing it to you like a lil gift. 🎁

IMPORTANT BESTIE: the new surface should be freed with SDL_DestroySurface(). not doing so will result in a memory leak. that's not a vibe, that's a slow-motion tragedy. 😭 clean up after yourself, queen.

πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • file β€” the BMP file to load. that's it. that's the whole job. she just wants the file, bestie. πŸ’œ

🌈 RETURN VALUE 🌈

Returns a pointer to a new SDL_Surface structure β€” slay ✨ β€” or NULL on failure. if you get NULL, do not panic, just call SDL_GetError() for more information. she'll tell you what went wrong. 🫢


πŸ’€ THREAD SAFETY πŸ’€

It is safe to call this function from any thread. yes, ANY. go wild. multithreaded icon behavior. πŸ”₯


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older... bestie. we need to talk. πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! πŸ“ this lil slice of documentation came to you courtesy of Simple Directmedia Layer, version SDL 3.4.18, dated SDL_LoadBMP(3) β€” mwah, go free your surfaces. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from