IMG_AddAnim...ncoderFrame(3)

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

πŸ’– IMG_AddAnimationEncoderFrame πŸ’–

okay bestie, so this is a page from the SDL_image3 FUNCTIONS section of the manual β€” it's the IMG_AddAnim...ncoderFrame(3) one, yes the title is truncated with the little dots, that's just how the man page header rolls, don't panic. we're talking about adding a frame to an animation encoder. putting a picture into the movie. the whole vibe. let's go ✨


🌸 NAME 🌸

IMG_AddAnimationEncoderFrame β€” adds a frame to an animation encoder. that's it, that's the whole job, and she does it slayfully πŸ’…


✨ SYNOPSIS ✨

#include <SDL3_image/SDL_image.h>

bool IMG_AddAnimationEncoderFrame(IMG_AnimationEncoder *encoder, SDL_Surface *surface, Uint64 duration);

look at her. three little arguments. no cap, this is the whole function signature, copy it exactly, i'm not playing 🫢


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • encoder β€” the receiving images. like, the encoder that's receiving them. she's the one collecting the frames 🧺
  • surface β€” the surface you wanna add as the next frame in the animation. the actual picture, the moment, the lewk πŸ’…
  • duration β€” how long that frame hangs around, usually measured in milliseconds but lowkey it can be other units if the IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER property was set back when you created the encoder. so like, set that property and the units are yours to decide, periodt ⏱️

πŸ”₯ RETURN VALUE πŸ”₯

returns true on success, or false on failure. and if it's false?? call SDL_GetError() for more info, she will tell you what went wrong, fr fr 😭


🌈 AVAILABILITY 🌈

this one's been around since SDL_image 3.4.0 β€” so if you're on anything older, bestie, she is simply not there yet πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, honestly. create, create-with-IO, create-with-properties, and the closer. you need all of them for the full arc πŸ¦‹


quick reminder before you go: the encoder has to exist before you start feeding her frames, and the duration unit thing depends on that IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER property at creation time. set it or don't, just know what you're doing πŸ’–

and that's the page!! brought to you by the SDL_image manual, version SDL_image 3.4.8 πŸ’– this was IMG_AddAnim...ncoderFrame(3), mwah, go make something iconic with it πŸŒŸπŸ’œ

πŸ“¦ where this page comes from