1 /**
2  * @file lv_draw_sdl_composite.h
3  *
4  */
5 
6 #ifndef LV_DRAW_SDL_COMPOSITE_H
7 #define LV_DRAW_SDL_COMPOSITE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 
17 #include "../../lv_conf_internal.h"
18 
19 #include LV_GPU_SDL_INCLUDE_PATH
20 
21 #include "lv_draw_sdl.h"
22 #include "../../misc/lv_area.h"
23 #include "../../misc/lv_color.h"
24 
25 /*********************
26  *      DEFINES
27  *********************/
28 
29 /**********************
30  *      TYPEDEFS
31  **********************/
32 
33 typedef enum lv_draw_sdl_composite_texture_id_t {
34     LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0,
35     LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1,
36     LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0,
37     LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET1,
38     LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0,
39 } lv_draw_sdl_composite_texture_id_t;
40 
41 /**********************
42  * GLOBAL PROTOTYPES
43  **********************/
44 
45 /**
46  * Begin drawing with mask. Render target will be switched to a temporary texture,
47  * and drawing coordinates may get clipped or translated
48  * @param ctx Drawing context
49  * @param coords_in Original coordinates
50  * @param clip_in Original clip area
51  * @param extension Useful for shadows or outlines, can be NULL
52  * @param coords_out Translated coords
53  * @param clip_out Translated clip area
54  * @param apply_area Area of actual composited texture will be drawn
55  * @return true if there are any mask needs to be drawn, false otherwise
56  */
57 bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords_in, const lv_area_t * clip_in,
58                                  const lv_area_t * extension, lv_blend_mode_t blend_mode, lv_area_t * coords_out,
59                                  lv_area_t * clip_out, lv_area_t * apply_area);
60 
61 void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_area, lv_blend_mode_t blend_mode);
62 
63 /**
64  *
65  * @param ctx Drawing context
66  * @param id Texture ID
67  * @param w Maximum width needed
68  * @param h Maximum height needed
69  * @param texture_in_cache output to query if the texture is in cache. If it's not in cache, you'll need to destroy it
70  * by yourself
71  * @return Obtained texture
72  */
73 SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
74                                                    lv_coord_t w, lv_coord_t h, bool * texture_in_cache);
75 
76 /**********************
77  *      MACROS
78  **********************/
79 
80 #ifdef __cplusplus
81 } /*extern "C"*/
82 #endif
83 
84 #endif /*LV_DRAW_SDL_COMPOSITE_H*/
85