1 /**
2  * @file lv_draw_sdl_img.h
3  *
4  */
5 
6 #ifndef LV_DRAW_SDL_IMG_H
7 #define LV_DRAW_SDL_IMG_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../lv_conf_internal.h"
17 
18 #if LV_USE_GPU_SDL
19 
20 #include LV_GPU_SDL_INCLUDE_PATH
21 
22 #include "../lv_draw.h"
23 
24 #include "lv_draw_sdl_texture_cache.h"
25 
26 /*********************
27  *      DEFINES
28  *********************/
29 
30 /**********************
31  *      TYPEDEFS
32  **********************/
33 
34 typedef struct lv_draw_sdl_img_header_t {
35     lv_img_header_t base;
36     SDL_Rect rect;
37     bool managed;
38 } lv_draw_sdl_img_header_t;
39 
40 /**********************
41  * GLOBAL PROTOTYPES
42  **********************/
43 
44 /*======================
45  * Add/remove functions
46  *=====================*/
47 
48 /*=====================
49  * Setter functions
50  *====================*/
51 
52 /*=====================
53  * Getter functions
54  *====================*/
55 
56 /*=====================
57  * Other functions
58  *====================*/
59 /**
60  *
61  * @param ctx Drawing context
62  * @param key Texture cache key
63  * @param key_size Size of texture cache key
64  * @param src Image source pointer
65  * @param frame_id Frame ID for animated image
66  * @param texture Texture for render
67  * @param header Header also holds sdl image info
68  * @param texture_in_cache Whether the texture has been put in the cache. Please note for managed texture,
69  * this will be false too. So you'll need to check header.managed too.
70  * @return Whether the image has been loaded successfully
71  */
72 bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
73                                   const void * src, int32_t frame_id, SDL_Texture ** texture,
74                                   lv_draw_sdl_img_header_t ** header, bool * texture_in_cache);
75 /**********************
76  *      MACROS
77  **********************/
78 
79 #endif /*LV_USE_GPU_SDL*/
80 
81 #ifdef __cplusplus
82 } /*extern "C"*/
83 #endif
84 
85 #endif /*LV_DRAW_SDL_IMG_H*/
86