IMG_SaveTGA_IO(3)

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

πŸ’Ύ IMG_SaveTGA_IO(3) β€” the SDL_image3 girlies' guide πŸ’Ύ

okay bestie, so you know how we've been saving TGA files but you're working with an SDL_IOStream instead of a plain filename? yeah. this is that one. it's IMG_SaveTGA_IO, and it lives in the SDL_image3 FUNCTIONS family. let's get into it 🫢


✨ NAME ✨

IMG_SaveTGA_IO β€” save an SDL_Surface into TGA image data, via an SDL_IOStream. no cap, that's the whole vibe.


🌸 SYNOPSIS 🌸

#include <SDL3_image/SDL_image.h>

bool IMG_SaveTGA_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio);

πŸ’– DESCRIPTION πŸ’–

so like, if you literally just wanna save to a filename and you're not out here doing stream gymnastics? you can use IMG_SaveTGA() instead. that's the simpler sister function, iykyk. πŸŽ€

now here's the part that MATTERS, bestie, pay attention:

if closeio is true, then dst will be closed before returning β€” and that's true whether this function succeeds or not. the way that it doesn't care about the outcome, it's closing that stream either way. periodt. πŸ’…


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • surface β€” the SDL_Surface you wanna save. your art. your masterpiece. πŸ‘‘
  • dst β€” the SDL_IOStream where the image data is going. the destination, the moment.
  • closeio β€” pass true to close/free the SDL_IOStream before returning, or false to leave it open. your call, main character. ⭐

🌈 RETURN VALUE 🌈

returns true on success or false on failure β€” and if it's giving failure, hit up SDL_GetError() for more info. that's your bestie who always tells you what actually went wrong. πŸ’€


⭐ AVAILABILITY ⭐

this one's been around since SDL_image 3.4.0. so if you're on something older than that, no TGA stream saving for you, sorry babe. 😭


πŸŽ€ SEE ALSO πŸŽ€

  • IMG_SaveTGA(3) β€” the filename-flavored version, go say hi πŸ’œ

lowkey reminder: that closeio thing is a commitment. once it's true, that stream is getting closed no matter how things shake out. know that before you hand it over. πŸ™ˆ

okay that's the whole page, you ate it, you understood it, iconic behavior truly. this was SDL_image 3.4.8, and yes the date on the original footer was the same as always because they're cute like that. mwah. πŸ’–βœ¨πŸ“

πŸ“¦ where this page comes from