feat(gif): add loop count control (#6839)

This commit is contained in:
Lorenzo Arena
2024-09-23 15:59:17 +02:00
committed by GitHub
parent 046d10bf7e
commit fe0f5e8607
2 changed files with 49 additions and 0 deletions
+30
View File
@@ -137,6 +137,36 @@ void lv_gif_resume(lv_obj_t * obj)
lv_timer_resume(gifobj->timer);
}
bool lv_gif_is_loaded(lv_obj_t * obj)
{
lv_gif_t * gifobj = (lv_gif_t *) obj;
return (gifobj->gif != NULL);
}
int32_t lv_gif_get_loop_count(lv_obj_t * obj)
{
lv_gif_t * gifobj = (lv_gif_t *) obj;
if(gifobj->gif == NULL) {
return -1;
}
return gifobj->gif->loop_count;
}
void lv_gif_set_loop_count(lv_obj_t * obj, int32_t count)
{
lv_gif_t * gifobj = (lv_gif_t *) obj;
if(gifobj->gif == NULL) {
LV_LOG_WARN("Gif resource not loaded correctly");
return;
}
gifobj->gif->loop_count = count;
}
/**********************
* STATIC FUNCTIONS
**********************/
+19
View File
@@ -72,6 +72,25 @@ void lv_gif_pause(lv_obj_t * obj);
*/
void lv_gif_resume(lv_obj_t * obj);
/**
* Checks if the GIF was loaded correctly.
* @param obj pointer to a gif obj
*/
bool lv_gif_is_loaded(lv_obj_t * obj);
/**
* Get the loop count for the GIF.
* @param obj pointer to a gif obj
*/
int32_t lv_gif_get_loop_count(lv_obj_t * obj);
/**
* Set the loop count for the GIF.
* @param obj pointer to a gif obj
* @param count the loop count to set
*/
void lv_gif_set_loop_count(lv_obj_t * obj, int32_t count);
/**********************
* MACROS
**********************/