IMG_LoadAPNGAnimation_IO(3)

πŸ“¦
version 3.4.8 Β· 5 versions
, in fedora 43, fedora 44

πŸ’– IMG_LoadAPNGAnimation_IO πŸ’–

okay bestie, welcome to the SDL_image3 corner of the manual, where we're about to talk about IMG_LoadAPNGAnimation_IO β€” yes that's a whole mouthful, and yes it's iconic. this one's all about pulling an APNG animation straight out of an SDL_IOStream. let's go πŸ¦‹


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

IMG_Animation* IMG_LoadAPNGAnimation_IO(SDL_IOStream *src);

like, that's it. one include, one function, one pointer to an SDL_IOStream. slay πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea: if you already know β€” like, you are 100% certain, no doubt in your heart β€” that what you're holding is an APNG image, you can just call this function. it'll skip all of SDL_image's file format detection routines, because why make it guess when you already know the answer? main character energy fr fr ✨

that said… generally it's better to use the abstract interfaces, okay? this is the shortcut, not the vibe. also worth noting: there's only an SDL_IOStream interface available here. that's the whole menu, no other options. πŸŽ€

and the most important thing β€” the way that you must clean up after yourself β€” when you're done with the returned animation, the app should dispose of it with a call to IMG_FreeAnimation(). do not leave that animation just sitting there. free your girl. 🫢

not me reminding you again: IMG_FreeAnimation() when you're done. memory doesn't free itself, bestie. 😭

🧚 FUNCTION PARAMETERS 🧚

  • src β€” an SDL_IOStream from which data will be read. that's where the APNG bytes come from, that's the whole source of truth. πŸ’œ

⭐ RETURN VALUE ⭐

returns a brand new IMG_Animation (yes, a whole new one, fresh out the box πŸ’–), or NULL on error. and if you get NULL, that's your sign that something went wrong β€” go check on it. πŸ™ˆ


🌈 AVAILABILITY 🌈

this function has been available since SDL_image 3.4.0. so if you're on anything older, it's giving "not yet, babe" β€” you're gonna need to upgrade. πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, obviously:


okay that's the whole page, no cap. this was SDL_image, version 3.4.8, brought to you by the SDL_image girlies, and IMG_LoadAPNGAnimation_IO(3) is out here living her best life. go forth, load that APNG, free that animation. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from