cf_sprite_set_center_patch¶
Category: sprite
GitHub: cute_sprite.h
Sets the 9-slice center patch in pixel coordinates.
void cf_sprite_set_center_patch(CF_Sprite* sprite, CF_Aabb center_patch) { CF_ASSERT(sprite); sprite->_center_patch = center_patch; }
| Parameters | Description |
|---|---|
sprite |
The sprite. |
center_patch |
AABB of the stretchable/tileable center region in sprite pixels. Uses the same layout as Aseprite 9-slice center rects and as returned by cf_sprite_get_center_patch for .ase sprites: min is the top-left of the center, max is the bottom-right, with the origin at the top-left of the sprite (Y increases downward). |
Remarks¶
Easy sprites have no .ase slice data, so you must call this before cf_draw_sprite_9_slice or cf_draw_sprite_9_slice_tiled. A zero AABB falls back to cf_draw_sprite. For aseprite sprites, cf_sprite_update / cf_sprite_play overwrite this from the asset's slice data.
Related Pages¶
CF_Sprite
cf_sprite_get_center_patch
cf_draw_sprite_9_slice
cf_draw_sprite_9_slice_tiled