IMG_SaveCUR_IO(3)
πΎ 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β theSDL_Surfaceyou wanna save. your lil pixel baby πdstβ theSDL_IOStreamyou're writing the image data into. the destination, the moment, the main character β¨closeioβtrueif you want theSDL_IOStreamclosed/freed before returning,falseif 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=truemeansdstgets 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
- fedora 43: SDL3_image-devel 3.4.8-1.fc43 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 43: SDL3_image-devel 3.4.8-1.fc43 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 44: SDL3_image-devel 3.4.8-1.fc44 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- fedora 44: SDL3_image-devel 3.4.8-1.fc44 Β· Zlib AND (HPND-Pbmplus AND Zlib) AND MIT AND (MIT OR Unlicense) AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms