1 /**
2  * @file lv_draw_sdl_rect.h
3  *
4  */
5 
6 #ifndef LV_DRAW_SDL_RECT_H
7 #define LV_DRAW_SDL_RECT_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_rect_header_t {
35     lv_img_header_t base;
36     SDL_Rect rect;
37 } lv_draw_sdl_rect_header_t;
38 
39 /**********************
40  * GLOBAL PROTOTYPES
41  **********************/
42 
43 /*======================
44  * Add/remove functions
45  *=====================*/
46 
47 /*=====================
48  * Setter functions
49  *====================*/
50 
51 /*=====================
52  * Getter functions
53  *====================*/
54 
55 /*=====================
56  * Other functions
57  *====================*/
58 
59 /**
60  *
61  * @param ctx Drawing context
62  * @param radius Corner radius of the rectangle
63  * @param in_cache Whether the texture has been put in the cache
64  * @return Background fragment texture
65  */
66 SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius, bool * in_cache);
67 
68 /**
69  *
70  * @param ctx Drawing context
71  * @param grad Gradient info
72  * @param w Width of the rectangle
73  * @param h Height of the rectangle
74  * @param radius Corner radius of the rectangle
75  * @param in_cache Whether the texture has been put in the cache
76  * @return Gradient fragment texture
77  */
78 SDL_Texture * lv_draw_sdl_rect_grad_frag_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad, lv_coord_t w,
79                                                 lv_coord_t h, lv_coord_t radius, bool * in_cache);
80 
81 /**
82  *
83  * @param ctx Drawing context
84  * @param grad Gradient info
85  * @param in_cache Whether the texture has been put in the cache
86  * @return Gradient strip texture
87  */
88 SDL_Texture * lv_draw_sdl_rect_grad_strip_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad, bool * in_cache);
89 
90 void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size,
91                                            const lv_area_t * coords, const lv_area_t * clip, bool full);
92 
93 /**********************
94  *      MACROS
95  **********************/
96 
97 #endif /*LV_USE_GPU_SDL*/
98 
99 #ifdef __cplusplus
100 } /*extern "C"*/
101 #endif
102 
103 #endif /*LV_DRAW_SDL_RECT_H*/
104