acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_draw.h (3952B)

      1 /**
      2  * @file lv_draw.h
      3  *
      4  */
      5 
      6 #ifndef LV_DRAW_H
      7 #define LV_DRAW_H
      8 
      9 #ifdef __cplusplus
     10 extern "C" {
     11 #endif
     12 
     13 /*********************
     14  *      INCLUDES
     15  *********************/
     16 #include "../lv_conf_internal.h"
     17 
     18 #include "../misc/lv_style.h"
     19 #include "../misc/lv_txt.h"
     20 #include "lv_img_decoder.h"
     21 #include "lv_img_cache.h"
     22 
     23 #include "lv_draw_rect.h"
     24 #include "lv_draw_label.h"
     25 #include "lv_draw_img.h"
     26 #include "lv_draw_line.h"
     27 #include "lv_draw_triangle.h"
     28 #include "lv_draw_arc.h"
     29 #include "lv_draw_mask.h"
     30 
     31 /*********************
     32  *      DEFINES
     33  *********************/
     34 
     35 /**********************
     36  *      TYPEDEFS
     37  **********************/
     38 
     39 typedef struct {
     40     void * user_data;
     41 } lv_draw_mask_t;
     42 
     43 
     44 typedef struct _lv_draw_ctx_t  {
     45     /**
     46      *  Pointer to a buffer to draw into
     47      */
     48     void * buf;
     49 
     50     /**
     51      * The position and size of `buf` (absolute coordinates)
     52      */
     53     lv_area_t * buf_area;
     54 
     55     /**
     56      * The current clip area with absolute coordinates, always the same or smaller than `buf_area`
     57      */
     58     const lv_area_t * clip_area;
     59 
     60 
     61     void (*draw_rect)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
     62 
     63     void (*draw_arc)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
     64                      uint16_t radius,  uint16_t start_angle, uint16_t end_angle);
     65 
     66     void (*draw_img_decoded)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
     67                              const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format);
     68 
     69     lv_res_t (*draw_img)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
     70                          const lv_area_t * coords, const void * src);
     71 
     72     void (*draw_letter)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,  const lv_point_t * pos_p,
     73                         uint32_t letter);
     74 
     75 
     76     void (*draw_line)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
     77                       const lv_point_t * point2);
     78 
     79 
     80     void (*draw_polygon)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc,
     81                          const lv_point_t * points, uint16_t point_cnt);
     82 
     83     /**
     84      * Replace the buffer with a rect without decoration like radius or borders
     85      */
     86     void (*draw_bg)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_area_t * coords);
     87 
     88     /**
     89      * Wait until all background operations are finished. (E.g. GPU operations)
     90      */
     91     void (*wait_for_finish)(struct _lv_draw_ctx_t * draw_ctx);
     92 
     93     /**
     94      * Copy an area from buffer to an other
     95      * @param draw_ctx      pointer to a draw context
     96      * @param dest_buf      copy the buffer into this buffer
     97      * @param dest_stride   the width of the dest_buf in pixels
     98      * @param dest_area     the destination area
     99      * @param src_buf       copy from this buffer
    100      * @param src_stride    the width of src_buf in pixels
    101      * @param src_area      the source area.
    102      *
    103      * @note dest_area and src_area must have the same width and height
    104      *       but can have different x and y position.
    105      * @note dest_area and src_area must be clipped to the real dimensions of the buffers
    106      */
    107     void (*buffer_copy)(struct _lv_draw_ctx_t * draw_ctx, void * dest_buf, lv_coord_t dest_stride,
    108                         const lv_area_t * dest_area,
    109                         void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
    110 #if LV_USE_USER_DATA
    111     void * user_data;
    112 #endif
    113 
    114 } lv_draw_ctx_t;
    115 
    116 /**********************
    117  * GLOBAL PROTOTYPES
    118  **********************/
    119 
    120 void lv_draw_init(void);
    121 
    122 /**********************
    123  *  GLOBAL VARIABLES
    124  **********************/
    125 
    126 /**********************
    127  *      MACROS
    128  **********************/
    129 
    130 /**********************
    131  *   POST INCLUDES
    132  *********************/
    133 
    134 #ifdef __cplusplus
    135 } /*extern "C"*/
    136 #endif
    137 
    138 #endif /*LV_DRAW_H*/