1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/lv_draw/lv_draw.h

106 lines
2.8 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_draw.h
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
*********************/
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
*********************/
/**********************
* TYPEDEFS
**********************/
2017-08-21 14:55:06 +02:00
/* Image header it is compatible with
* the result image converter utility*/
typedef struct
{
uint32_t w:12; /*Width of the image map*/
uint32_t h:12; /*Height of the image map*/
2017-11-26 14:39:22 +01:00
uint32_t transp:1; /*1: The image contains transparent pixels with LV_COLOR_TRANSP color*/
2017-08-21 14:55:06 +02:00
uint32_t cd:3; /*Color depth (0: reserved, 1: 8 bit, 2: 16 bit or 3: 24 bit, 4-7: reserved)*/
uint32_t res :4; /*Reserved*/
}lv_img_raw_header_t;
2016-06-08 07:25:08 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Draw a rectangle
* @param cords_p the coordinates of the rectangle
* @param mask_p the rectangle will be drawn only in this mask
* @param style_p pointer to a style
*/
2017-11-23 21:28:36 +01:00
void lv_draw_rect(const lv_area_t * cords_p, const lv_area_t * mask_p, const lv_style_t * style_p);
2017-01-02 15:29:05 +01:00
/*Experimental use for 3D modeling*/
#define USE_LV_TRIANGLE 0
#if USE_LV_TRIANGLE != 0
/**
*
* @param points pointer to an array with 3 points
* @param mask_p the triangle will be drawn only in this mask
* @param color color of the triangle
*/
2017-11-23 21:28:36 +01:00
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask_p, lv_color_t color);
#endif
/**
* Write a text
* @param cords_p coordinates of the label
* @param mask_p the label will be drawn only in this area
* @param style_p pointer to a style
* @param txt 0 terminated text to write
* @param flags settings for the text from 'txt_flag_t' enum
* @param offset text offset in x and y direction (NULL if unused)
*/
2017-11-23 21:28:36 +01:00
void lv_draw_label(const lv_area_t * cords_p,const lv_area_t * mask_p, const lv_style_t * style_p,
2017-11-24 17:48:47 +01:00
const char * txt, lv_txt_flag_t flag, lv_point_t * offset);
2017-01-02 15:29:05 +01:00
2017-11-27 17:48:54 +01:00
#if USE_LV_IMG
/**
* Draw an image
* @param cords_p the coordinates of the image
* @param mask_p the image will be drawn only in this area
2017-11-23 21:28:36 +01:00
* @param map_p pointer to a lv_color_t array which contains the pixels of the image
*/
2017-11-23 21:28:36 +01:00
void lv_draw_img(const lv_area_t * cords_p, const lv_area_t * mask_p,
const lv_style_t * style_p, const char * fn);
2017-11-27 17:48:54 +01:00
#endif
2017-01-02 10:48:21 +01:00
/**
* Draw a line
* @param p1 first point of the line
* @param p2 second point of the line
* @param mask_pthe line will be drawn only on this area
* @param style_p pointer to a style
*/
2017-11-23 21:28:36 +01:00
void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t * mask_p,
const lv_style_t * style_p);
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
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*/