Skip to content

cf_sprite_get_pixels

Category: sprite
GitHub: cute_sprite.h


Returns pixel data for a specific frame of a named animation.

CF_Image cf_sprite_get_pixels(CF_Sprite* sprite, int blend_index, const char* animation, int frame_index);
Parameters Description
sprite The sprite.
blend_index Which blend to read (0 = default, 1+ from cf_sprite_add_blend).
animation Name of the animation containing the frame.
frame_index Zero-based index of the frame within the animation.

Return Value

A CF_Image with a copy of the frame's pixel data (premultiplied alpha). Returns a zero'd CF_Image if the animation or frame is not found. The caller must free the image with cf_image_free.

CF_Sprite
CF_Image
CF_Frame
cf_image_free