SDL_SetSurfaceRLE(3)

πŸ’– SDL_SetSurfaceRLE(3) πŸ’–

okay bestie, welcome to the SDL3 functions corner of the manual, and today's main character is SDL_SetSurfaceRLE β€” the lil hint-flipper that makes your blits go zoom. no cap. πŸ¦‹


✨ NAME ✨

SDL_SetSurfaceRLE β€” set the RLE acceleration hint for a surface. that's it, that's the whole job, and she does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_surface.h>

bool SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled);

πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea, fr fr: if RLE is enabled, color key and alpha blending blits are much faster. like, noticeably. iconic behaviour. πŸ”₯

BUT. and this is the big BUT, bestie β€” the surface must be locked before directly accessing the pixels. RLE on means you don't just wander in and start touching pixels with your bare hands. lock first. SDL_LockSurface is right there. 🫢

πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • surface β€” the SDL_Surface structure to optimize. yes, this one. your girl. your canvas. 🌈
  • enabled β€” true to enable RLE acceleration, false to disable it. binary choice, no in-between, very decisive of you. ⭐

😭 RETURN VALUE 😭

Returns true on success or false on failure. and if it fails? don't just sit there spiraling β€” call SDL_GetError() for more information. she'll tell you what went wrong. πŸ’€


🧚 THREAD SAFETY 🧚

This function can be called on different threads with different surfaces. key word: different. different surfaces, different threads, everybody minding their own business. peaceful. serene. no drama. ✨


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. so if you're on something older, it's giving "not yet, babe". πŸ’…


🌸 SEE ALSO 🌸


mwah πŸ’– that's the whole page. go forth, set your RLE hint, lock your surfaces, and slay.

this has been your girl from the Simple Directmedia Layer crew, running SDL 3.4.18, signing off on SDL_SetSurfaceRLE(3) β€” stay hydrated, lock your pixels, periodt. πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from