fade_interpolate(3alleg4)

πŸ’– fade_interpolate β€” bestie edition πŸ’–

okay so this is one of those Allegro manual pages, from the Allegro game programming library, and it's genuinely such a slay little function. sit with me for a sec 🫢


✨ NAME ✨

fade_interpolate β€” calculates a new palette interpolated between two others, and yes it does exactly what it says on the tin πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

void fade_interpolate(const PALETTE source, const PALETTE dest, PALETTE
output, int pos, int from, int to);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, bestie, this function cooks up a temporary palette that sits partway between source and dest, and it hands it back to you in the output parameter. no cap.

where exactly it lands between those two extremes? that's all on pos, and the vibes are:

  • pos = 0 β†’ you get an exact copy of source
  • pos = 64 β†’ you get dest
  • pos = 32 β†’ you get a palette half way between the two
  • etc. β€” you get the pattern, it's giving very much linear interpolation energy ✨

and here's the little detail that matters: this routine only affects the colors between from and to, and that range is inclusive. so if you want to interpolate the entire palette, pass 0 and 255. periodt. πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€


not me being obsessed with a palette lerp function... but fr fr, 0 and 255 for the whole thing, don't forget, or you'll be sitting there like πŸ’€ wondering why half your palette didn't move.

and that's the whole page, bestie! this was the Allegro manual, version 4.4.3, and you just read fade_interpolate(3alleg4). go interpolate something gorgeous πŸ’–βœ¨πŸŽ€πŸ¦‹