SDL_RenderTextureAffine(3)

✨ SDL_RenderTextureAffine ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the SDL_RenderTextureAffine(3) manual, we're doing RENDERING today πŸ’–


🌸 NAME 🌸

SDL_RenderTextureAffine β€” copy a portion of the source texture to the current rendering target, with affine transform, at subpixel precision. yes she's fancy, she does math, she slays πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_render.h>

bool SDL_RenderTextureAffine(SDL_Renderer *renderer, SDL_Texture *texture,
                         const SDL_FRect *srcrect, const SDL_FPoint *origin,
                         const SDL_FPoint *right, const SDL_FPoint *down);

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • renderer β€” the renderer which should copy parts of a texture. she's the one doing the work, give her credit πŸ‘‘
  • texture β€” the source texture. the pic we're pulling from, the main character of the operation ✨
  • srcrect β€” a pointer to the source rectangle, or NULL for the entire texture. like, "just give me this lil chunk" or "no thoughts, whole texture" πŸ™ˆ
  • origin β€” a pointer to a point indicating where the top-left corner of srcrect should be mapped to, or NULL for the rendering target's origin. where the top-left lands, basically 🌸
  • right β€” a pointer to a point indicating where the top-right corner of srcrect should be mapped to, or NULL for the rendering target's top-right corner. top-right go here, periodt πŸ’–
  • down β€” a pointer to a point indicating where the bottom-left corner of srcrect should be mapped to, or NULL for the rendering target's bottom-left corner. bottom-left destination, that's the vibe πŸ¦‹
ngl the way this works is: you hand her three corners and she does the affine thing with them. top-left, top-right, bottom-left. the fourth one is implied. geometry ate, no cap πŸ’€

⭐ RETURN VALUE ⭐

Returns true on success or false on failure; call SDL_GetError() for more information.

so like. if it returns false, do NOT just sit there, go call SDL_GetError() and find out what happened, bestie 😭


πŸ’œ THREAD SAFETY πŸ’œ

You may only call this function from the main thread.

like, respectfully, do not try to be cute and call her from a worker thread. she is not about that life 🚫🧡


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0.

so if you're on something older, that's a skill issue on your SDL version, upgrade fr fr ⬆️


πŸ“ SEE ALSO πŸ“

(the non-affine sister function, she's iconic too, go say hi 🫢)


that's the whole page!! every flag, every corner, every NULL default, all of it preserved with love πŸ’– this cutie comes to you courtesy of Simple Directmedia Layer, SDL 3.4.18, and it's filed under the SDL_RenderTextureAffine(3) header in the SDL3 FUNCTIONS section. go forth and transform your textures affinely, babe πŸŒŸβœ¨πŸ’…

πŸ“¦ where this page comes from