2016-06-08 07:25:08 +02:00
|
|
|
/**
|
2017-04-10 11:33:38 +02:00
|
|
|
* @file lv_draw.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
2016-06-08 07:25:08 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_DRAW_H
|
|
|
|
#define LV_DRAW_H
|
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2018-07-07 12:21:36 +02:00
|
|
|
#ifdef LV_CONF_INCLUDE_SIMPLE
|
2018-07-07 11:53:22 +02:00
|
|
|
#include "lv_conf.h"
|
|
|
|
#else
|
|
|
|
#include "../../lv_conf.h"
|
|
|
|
#endif
|
|
|
|
|
2017-11-30 11:35:33 +01:00
|
|
|
#include "../lv_core/lv_style.h"
|
2017-11-26 11:38:28 +01:00
|
|
|
#include "../lv_misc/lv_txt.h"
|
2017-01-02 10:48:21 +01:00
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
2018-02-23 13:56:04 +01:00
|
|
|
/*If image pixels contains alpha we need to know how much byte is a pixel*/
|
|
|
|
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
|
|
|
# define LV_IMG_PX_SIZE_ALPHA_BYTE 2
|
|
|
|
#elif LV_COLOR_DEPTH == 16
|
|
|
|
# define LV_IMG_PX_SIZE_ALPHA_BYTE 3
|
2018-09-21 07:23:44 +02:00
|
|
|
#elif LV_COLOR_DEPTH == 32
|
2018-02-23 13:56:04 +01:00
|
|
|
# define LV_IMG_PX_SIZE_ALPHA_BYTE 4
|
|
|
|
#endif
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
2018-06-19 09:49:58 +02:00
|
|
|
**********************/
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2018-02-23 13:56:04 +01:00
|
|
|
LV_IMG_SRC_VARIABLE,
|
|
|
|
LV_IMG_SRC_FILE,
|
|
|
|
LV_IMG_SRC_SYMBOL,
|
|
|
|
LV_IMG_SRC_UNKNOWN,
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
|
|
|
typedef uint8_t lv_img_src_t;
|
2018-02-09 12:40:00 +01:00
|
|
|
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2018-05-25 23:14:19 +02:00
|
|
|
#if LV_ANTIALIAS != 0
|
2018-06-12 09:22:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the opacity of a pixel based it's position in a line segment
|
|
|
|
* @param seg segment length
|
|
|
|
* @param px_id position of of a pixel which opacity should be get [0..seg-1]
|
|
|
|
* @param base_opa the base opacity
|
|
|
|
* @return the opacity of the given pixel
|
|
|
|
*/
|
2018-06-19 09:49:58 +02:00
|
|
|
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa);
|
2018-06-12 09:22:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a vertical anti-aliasing segment (pixels with decreasing opacity)
|
|
|
|
* @param x start point x coordinate
|
|
|
|
* @param y start point y coordinate
|
|
|
|
* @param length length of segment (negative value to start from 0 opacity)
|
|
|
|
* @param mask draw only in this area
|
|
|
|
* @param color color of pixels
|
|
|
|
* @param opa maximum opacity
|
|
|
|
*/
|
|
|
|
void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a horizontal anti-aliasing segment (pixels with decreasing opacity)
|
|
|
|
* @param x start point x coordinate
|
|
|
|
* @param y start point y coordinate
|
|
|
|
* @param length length of segment (negative value to start from 0 opacity)
|
|
|
|
* @param mask draw only in this area
|
|
|
|
* @param color color of pixels
|
|
|
|
* @param opa maximum opacity
|
|
|
|
*/
|
|
|
|
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
|
2018-05-25 23:14:19 +02:00
|
|
|
#endif
|
2018-05-20 21:27:57 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL VARIABLES
|
|
|
|
**********************/
|
2018-09-23 21:54:55 +02:00
|
|
|
extern void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
|
|
|
|
extern void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
|
|
|
|
extern void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa);
|
|
|
|
extern void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
2018-06-19 09:49:58 +02:00
|
|
|
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
|
|
|
|
lv_color_t recolor, lv_opa_t recolor_opa);
|
2018-05-20 21:27:57 +02:00
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2018-06-07 15:32:19 +02:00
|
|
|
/**********************
|
|
|
|
* POST INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_draw_rect.h"
|
|
|
|
#include "lv_draw_label.h"
|
|
|
|
#include "lv_draw_img.h"
|
|
|
|
#include "lv_draw_line.h"
|
|
|
|
#include "lv_draw_triangle.h"
|
2017-07-09 15:32:49 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
2016-06-08 07:25:08 +02:00
|
|
|
#endif
|
2017-07-09 15:32:49 +02:00
|
|
|
|
|
|
|
#endif /*LV_DRAW_H*/
|