SDL_RenderTexture9GridTiled(3)

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

✨ SDL_RenderTexture9GridTiled(3) ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages πŸ’– this one's a SDL_RenderTexture9GridTiled situation and it's genuinely so satisfying once it clicks.


🌸 NAME 🌸

SDL_RenderTexture9GridTiled β€” do a scaled copy onto the current rendering target using the 9-grid algorithm, at subpixel precision ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_render.h>

bool SDL_RenderTexture9GridTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect, float tileScale);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the pixels in your texture get chopped into a 3x3 grid, right? each corner uses its own corner size, and the sides + center are whatever pixels are left over. then the corners get scaled using scale and fitted into the corners of the destination rectangle. after that, the sides and the center get tiled into place to cover the rest of the destination rectangle. it's giving wallpaper energy fr fr 🧚


πŸ’… FUNCTION PARAMETERS πŸ’…

  • renderer β€” the renderer that's gonna copy parts of a texture. that's its whole job.
  • texture β€” the source texture. the material, the moment, the main character πŸ‘‘
  • srcrect β€” the SDL_Rect structure representing the rectangle used for the 9-grid, or NULL to use the entire texture.
  • left_width β€” the width, in pixels, of the left corners in srcrect.
  • right_width β€” the width, in pixels, of the right corners in srcrect.
  • top_height β€” the height, in pixels, of the top corners in srcrect.
  • bottom_height β€” the height, in pixels, of the bottom corners in srcrect.
  • scale β€” the scale used to transform the corner of srcrect into the corner of dstrect, or 0.0f for an unscaled copy.
  • dstrect β€” a pointer to the destination rectangle, or NULL for the entire rendering target.
  • tileScale β€” the scale used to transform the borders and center of srcrect into the borders and middle of dstrect, or 1.0f for an unscaled copy.

🌈 RETURN VALUE 🌈

returns true on success or false on failure β€” and if it fails, call SDL_GetError() for more info. no cap, always check πŸ’€


⭐ THREAD SAFETY ⭐

this function should only be called on the main thread. periodt. don't try it anywhere else πŸ™ˆ


πŸ’œ AVAILABILITY πŸ’œ

this function is available since SDL 3.4.0. iconic behavior.


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie 🫢 this was Simple Directmedia Layer, SDL 3.4.18, and yes the footer said SDL_RenderTexture9GridTiled(3) too, so we're full circle πŸ’– mwah, go tile something gorgeous ✨

πŸ“¦ where this page comes from