LDKTextureAtlasRegion
typedef struct LDKTextureAtlasRegion{
u64 id;
char name[LDK_TEXTURE_ATLAS_REGION_NAME_CAPACITY];
u32 x, y, width, height;
float pivot_x, pivot_y;
}LDKTextureAtlasRegion;
typedef struct LDKTextureAtlasRegion{
u64 id;
char name[LDK_TEXTURE_ATLAS_REGION_NAME_CAPACITY];
u32 x, y, width, height;
float pivot_x, pivot_y;
}LDKTextureAtlasRegion;
#define LDK_TEXTURE_ATLAS_REGION_NAME_CAPACITY 96u
Add the texture atlas region.
LDK_API bool ldk_texture_atlas_region_add(
LDKTextureAtlas *atlas,
const char *name,
u32 x,
u32 y,
u32 width,
u32 height,
u64 *out_id
);
LDKTextureAtlas *atlasconst char *nameu32 xu32 yu32 widthu32 heightu64 *out_idTrue if the operation succeeds; false otherwise.
Find the texture atlas region.
LDK_API LDKTextureAtlasRegion * ldk_texture_atlas_region_find(
LDKTextureAtlas *atlas,
u64 id
);
LDKTextureAtlas *atlasu64 idPointer to the requested object or data; NULL when unavailable.
Find a region by stable ID without exposing mutable access.
LDK_API const LDKTextureAtlasRegion * ldk_texture_atlas_region_find_const(
const LDKTextureAtlas *atlas,
u64 id
);
const LDKTextureAtlas *atlasu64 idPointer to the requested object or data; NULL when unavailable.
Remove the texture atlas region.
LDK_API bool ldk_texture_atlas_region_remove(
LDKTextureAtlas *atlas,
u64 id
);
LDKTextureAtlas *atlasu64 idTrue if the operation succeeds; false otherwise.
Rename a region without changing its stable identifier.
LDK_API bool ldk_texture_atlas_region_rename(
LDKTextureAtlas *atlas,
u64 id,
const char *name
);
LDKTextureAtlas *atlasu64 idconst char *nameTrue if the operation succeeds; false otherwise.
Compute normalized UV coordinates for an atlas region. Atlas regions are specified in pixel coordinates; this operation converts them to normalized texture coordinates.
LDK_API bool ldk_texture_atlas_region_uv(
const LDKTextureAtlasRegion *region,
u32 image_width,
u32 image_height,
float out_uv[4]
);
const LDKTextureAtlasRegion *regionu32 image_widthu32 image_heightfloat out_uv[4]True if the operation succeeds; false otherwise.