mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-24 00:07:03 +08:00
feat(gif): add loop count control (#6839)
This commit is contained in:
@@ -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
|
||||
**********************/
|
||||
|
||||
@@ -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
|
||||
**********************/
|
||||
|
||||
Reference in New Issue
Block a user