1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_line.h

145 lines
3.7 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_line.h
*
*/
#ifndef LV_LINE_H
#define LV_LINE_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2016-06-08 07:25:08 +02:00
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_LINE != 0
#include "../lv_obj/lv_obj.h"
2016-06-08 07:25:08 +02:00
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of line*/
typedef struct
{
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
const point_t * point_array; /*Pointer to an array with the points of the line*/
uint16_t point_num; /*Number of points in 'point_array' */
uint8_t auto_size :1; /*1: set obj. width to x max and obj. height to y max */
uint8_t y_inv :1; /*1: y == 0 will be on the bottom*/
uint8_t upscale :1; /*1: upscale coordinates with LV_DOWNSCALE*/
}lv_line_ext_t;
2016-06-08 07:25:08 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
2017-11-13 16:11:05 +01:00
/**
* Create a line objects
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy);
2017-11-13 16:11:05 +01:00
/*=====================
* Setter functions
*====================*/
/**
* Set an array of points. The line object will connect these points.
* @param line pointer to a line object
* @param point_a an array of points. Only the address is saved,
2017-04-21 09:15:39 +02:00
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
2016-10-07 11:15:46 +02:00
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num);
/**
* Enable (or disable) the auto-size option. The size of the object will fit to its points.
* (set width to x max and height to y max)
* @param line pointer to a line object
2017-11-13 16:11:05 +01:00
* @param autosize_en true: auto size is enabled, false: auto size is disabled
*/
2017-11-13 16:11:05 +01:00
void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en);
/**
* Enable (or disable) the y coordinate inversion.
* If enabled then y will be subtracted from the height of the object,
* therefore the y=0 coordinate will be on the bottom.
* @param line pointer to a line object
2017-11-13 16:11:05 +01:00
* @param yinv_en true: enable the y inversion, false:disable the y inversion
*/
void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en);
/**
* Enable (or disable) the points' coordinate upscaling (if LV_ANTIALIAS is enabled).
* @param line pointer to a line object
* @param unscale_en true: enable the point coordinate upscaling
*/
2017-11-13 16:11:05 +01:00
void lv_line_set_upscale(lv_obj_t * line, bool unscale_en);
/**
2017-11-13 16:11:05 +01:00
* Set the style of a line
* @param line pointer to a line object
2017-11-13 16:11:05 +01:00
* @param style pointer to a style
*/
2017-11-13 16:11:05 +01:00
static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
{
lv_obj_set_style(line, style);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the auto size attribute
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
2016-10-07 11:15:46 +02:00
bool lv_line_get_auto_size(lv_obj_t * line);
/**
* Get the y inversion attribute
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
2016-10-07 11:15:46 +02:00
bool lv_line_get_y_inv(lv_obj_t * line);
/**
* Get the point upscale enable attribute
* @param obj pointer to a line object
* @return true: point coordinate upscale is enabled, false: disabled
*/
2016-10-07 11:15:46 +02:00
bool lv_line_get_upscale(lv_obj_t * line);
2016-06-08 07:25:08 +02:00
2017-11-13 16:11:05 +01:00
/**
* Get the style of an image object
* @param line pointer to an line object
* @return the style an image
*/
static inline lv_style_t* lv_line_get_style(lv_obj_t *img)
{
return lv_obj_get_style(img);
}
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
2017-07-09 15:32:49 +02:00
#endif /*USE_LV_LINE*/
2016-06-08 07:25:08 +02:00
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_LINE_H*/