SDL_SavePNG(3)

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

✨ NAME ✨

okay bestie, welcome to SDL_SavePNG(3) β€” she's part of the SDL3 FUNCTIONS squad πŸ’– and she does exactly one thing but she does it flawlessly: save a surface to a file in PNG format. no cap. πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_surface.h>

bool SDL_SavePNG(SDL_Surface *surface, const char *file);

that's it. two args. so simple it's giving iconic πŸ’…


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • surface β€” the SDL_Surface structure holding the image you wanna save. this is your main character, your actual picture, the whole vibe ✨
  • file β€” a file to save to. that's the destination, the glow-up location, the place your pixels are moving to 🏑

πŸ’œ RETURN VALUE πŸ’œ

she returns true on success or false on failure β€” like, no in-between, no maybes, just yes or no fr fr. if it's a false situation, hit up SDL_GetError() for more information, because she will absolutely tell you what went wrong 😭


🧚 THREAD SAFETY 🧚

okay so this is lowkey the best part: this function can be called on different threads with different surfaces. key word being different surfaces, bestie β€” don't go sharing one surface across threads and expect peace, that's not the vibe check she passed 🫢


⭐ AVAILABILITY ⭐

this function is available since SDL 3.4.0. so if you're on anything older... yeah, that's a no 🚫


🌈 SEE ALSO 🌈

go read those too, they're her siblings and they're also slaying πŸ’…


and that's the whole page, bestie πŸ“ this gem lives in Simple Directmedia Layer, serving you SDL 3.4.18 realness, and honestly? iconic behavior. now go save some PNGs, you've got this πŸ‘‘πŸ’–

πŸ“¦ where this page comes from