SDL_GPUBlitRegion(3type)

πŸ’– NAME πŸ’–

SDL_GPUBlitRegion β€” it's a struct, bestie, and it describes a region of a texture that you're gonna use in a blit operation. That's the whole vibe. A little rectangle of texture saying "me, this part, right here" πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef struct SDL_GPUBlitRegion
{
    SDL_GPUTexture *texture;      /**< The texture. */
    Uint32 mip_level;             /**< The mip level index of the region. */
    Uint32 layer_or_depth_plane;  /**< The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. */
    Uint32 x;                     /**< The left offset of the region. */
    Uint32 y;                     /**< The top offset of the region.  */
    Uint32 w;                     /**< The width of the region. */
    Uint32 h;                     /**< The height of the region. */
} SDL_GPUBlitRegion;

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. picture a texture. huge, gorgeous, main character energy. now picture you only want part of it for your blit. that's what this struct is for, and it is so straightforward. let's meet the members one by one, no gatekeeping 🫢

  • texture β€” the texture. yeah. that's it. that's the field. the actual SDL_GPUTexture * we're talking about πŸ‘‘
  • mip_level β€” the mip level index of the region. which level of the mip pyramid are we pulling from, bestie?
  • layer_or_depth_plane β€” the layer index or depth plane of the region, and yes the name is long because it does double duty. on 2D array textures and cube textures this value is treated as a layer index. on 3D textures it's treated as a depth plane. one field, two personalities, we love a versatile icon 🌈
  • x β€” the left offset of the region. how far in from the left we start πŸ“
  • y β€” the top offset of the region. how far down from the top we start πŸ“
  • w β€” the width of the region. how wide our little slice is πŸ“
  • h β€” the height of the region. how tall our little slice is πŸ“

so like, x, y, w, h are just... a rectangle. a rect. the classic. and then texture, mip_level and layer_or_depth_plane tell it which texture and which slice of it you mean. it's giving "I know exactly which part of this texture I want and I'm not settling" πŸ’…βœ¨


🌸 AVAILABILITY 🌸

this struct has been around since SDL 3.2.0. not new new, but not ancient either. it's been here, being useful, minding its business πŸ’œ


πŸŽ€ SEE ALSO πŸŽ€

go read those too, they're literally the whole point of this struct existing. iykyk πŸ”₯


and that's the page, bestie!! this lil datatype comes to you from Simple Directmedia Layer β€” that's the source β€” and the version tag on it is SDL 3.4.18. mwah, go blit something gorgeous πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from