IMG_SaveCUR_IO(3)

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

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

okay bestie, listen up πŸ’– this one lives in the SDL_image3 FUNCTIONS section of the manual, and it's about yeeting an SDL_Surface into CUR image data β€” but through an SDL_IOStream, not a file name. very demure, very streamy. ✨


🌸 NAME 🌸

IMG_SaveCUR_IO β€” Save an SDL_Surface into CUR image data, via an SDL_IOStream.

like. that's the whole gig. surface in, CUR data out, stream as the middleman πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

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

look at that signature. three little args, one tiny bool coming back. it's giving minimalist. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie πŸ“ if you literally just wanna save to a filename, don't do all this β€” go use IMG_SaveCUR() instead. that's the shortcut, no cap. this function is for when you already have an SDL_IOStream and you're doing the whole custom-IO thing. iykyk.

And this part is important, so read it twice: if closeio is true, then dst will be closed before returning, whether this function succeeds or not. 😭 like, success or failure, that stream is getting closed. it's not a "maybe", it's not a "if it works out", it's a periodt. so don't go using dst afterwards if you told it to close, or you're gonna have a bad time πŸ’€


🌈 FUNCTION PARAMETERS 🌈

  • surface β€” the SDL_Surface you wanna save. your lil pixel baby πŸ‘‘
  • dst β€” the SDL_IOStream you're writing the image data into. the destination, the moment, the main character ✨
  • closeio β€” true if you want the SDL_IOStream closed/freed before returning, false if you want it left open. you're literally just telling it whether to clean up after itself or not 🧹

⭐ RETURN VALUE ⭐

Returns true on success or false on failure β€” and if it fails, go call SDL_GetError() for more info, because she will tell you what went wrong πŸ“£


πŸŽ€ AVAILABILITY πŸŽ€

This function has been available since SDL_image 3.4.0. if you're on anything older, sorry bestie, it's not there yet πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

  • IMG_SaveCUR(3) β€” the filename version, for when you don't feel like doing stream math 🫢

⚠️ friendly reminder fr fr: closeio = true means dst gets closed whether this function succeeds or not. don't touch it after. that's the whole warning, and it's a real one πŸ’œ

and that's the page, bestie! this one came straight out of the SDL_image manual, version SDL_image 3.4.8 🌸 go forth and save your CURs, you absolute icon πŸ’…βœ¨

πŸ“¦ where this page comes from