SDL_LoadBMP_IO(3)

πŸ’– SDL_LoadBMP_IO(3) πŸ’–

okay so bestie, welcome to SDL_LoadBMP_IO β€” the SDL3 FUNCTIONS girlie whose whole entire job is: load a BMP image from a seekable SDL data stream. that's it. that's the vibe. she eats, she serves, she reads your pixels off a stream. πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_surface.h>

SDL_Surface * SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio);

like look at her. two args. no drama. icon behavior fr fr πŸ’…


🌸 DESCRIPTION 🌸

so she hands you back a shiny new surface, right? and the way that you are legally and morally obligated to give it back is SDL_DestroySurface(). no cap. if you don't do that? memory leak. your program just slowly leaking. it's giving slow villain arc 😭 not the main character energy we want for you.

🫢 free your surfaces, bestie. the computer will literally thank you.

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • src β€” the data stream for the surface. this is your source, your origin story, the stream she's reading from. gotta be seekable, iykyk.
  • closeio β€” if true, she calls SDL_CloseIO() on src before returning, even in the case of an error. yes even then. especially then. she's thorough like that. if you pass false she leaves the stream open and it's yours to deal with. choose wisely πŸ’€

⭐ RETURN VALUE ⭐

returns a pointer to a brand new SDL_Surface structure, or NULL on failure. and if you get NULL, don't just sit there β€” call SDL_GetError() for more information. she will tell you what went wrong. she's not mysterious, she's just waiting for you to ask πŸ™ˆ


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. any. thread. go wild. parallelize. slay across cores πŸ”₯


πŸ’œ AVAILABILITY πŸ’œ

this function is available since SDL 3.2.0. so if you're on something older, bestie, that's a you problem and an upgrade problem πŸ’…


🌈 SEE ALSO 🌈

go read those too, they're all in the same friend group 🫢


and that's the whole page, no notes. this one came to you from Simple Directmedia Layer, running SDL 3.4.18, dated SDL_LoadBMP_IO(3) β€” yeah the footer's just the same name again, she's consistent like that ✨ bye bestie, go free your surfaces πŸ’–

πŸ“¦ where this page comes from