mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Merge 150f44ed13137d99998d744e49c48c39f7555d80 into dev
This commit is contained in:
commit
53c6b1f5b2
@ -44,14 +44,14 @@ Before every function have a comment like this:
|
||||
lv_obj_t * lv_obj_get_scr(lv_obj_t * obj);
|
||||
```
|
||||
|
||||
Always use `/* Something */` format and NOT `//Something`
|
||||
Always use `/*Something*/` format and NOT `//Something`
|
||||
|
||||
Write readable code to avoid descriptive comments like:
|
||||
`x++; /* Add 1 to x */`.
|
||||
`x++; /*Add 1 to x*/`.
|
||||
The code should show clearly what you are doing.
|
||||
|
||||
You should write **why** have you done this:
|
||||
`x++; /*Because of closing '\0' of the string */`
|
||||
`x++; /*Because of closing '\0' of the string*/`
|
||||
|
||||
Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/`
|
||||
|
||||
@ -66,7 +66,7 @@ Here is example to show bracket placing and using of white spaces:
|
||||
* @param text '\0' terminated character string. NULL to refresh with the current text.
|
||||
*/
|
||||
void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
{ /* Main brackets of functions in new line*/
|
||||
{ /*Main brackets of functions in new line*/
|
||||
|
||||
if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/
|
||||
|
||||
@ -74,7 +74,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
|
||||
lv_label_ext_t * ext = lv_obj_get_ext(label);
|
||||
|
||||
/*Comment before a section */
|
||||
/*Comment before a section*/
|
||||
if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/
|
||||
lv_label_refr_text(label);
|
||||
return;
|
||||
|
@ -1,25 +1,21 @@
|
||||
#include <lvgl.h>
|
||||
#include <TFT_eSPI.h>
|
||||
/* If you want to use the LVGL examples,
|
||||
make sure to install the lv_examples Arduino library
|
||||
and uncomment the following line.
|
||||
#include <lv_examples.h> */
|
||||
/*If you want to use the LVGL examples,
|
||||
make sure to install the lv_examples Arduino library
|
||||
and uncomment the following line.
|
||||
#include <lv_examples.h>*/
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
|
||||
TFT_eSPI tft = TFT_eSPI(); /*TFT instance*/
|
||||
|
||||
/* Change to your screen resolution */
|
||||
/*Change to your screen resolution*/
|
||||
static uint32_t screenWidth = 320;
|
||||
static uint32_t screenHeight = 240;
|
||||
|
||||
<<<<<<< HEAD
|
||||
static lv_disp_buf_t disp_buf;
|
||||
=======
|
||||
static lv_draw_buf_t draw_buf;
|
||||
>>>>>>> xiaoxiang781216-disp
|
||||
static lv_color_t buf[screenWidth * 10];
|
||||
|
||||
#if LV_USE_LOG != 0
|
||||
/* Serial debugging */
|
||||
/*Serial debugging*/
|
||||
void my_print(lv_log_level_t level, const char *file, uint32_t line, const char *fn_name, const char *dsc)
|
||||
{
|
||||
Serial.printf("%s(%s)@%d->%s\r\n", file, fn_name, line, dsc);
|
||||
@ -27,7 +23,7 @@ void my_print(lv_log_level_t level, const char *file, uint32_t line, const char
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Display flushing */
|
||||
/*Display flushing*/
|
||||
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
uint32_t w = (area->x2 - area->x1 + 1);
|
||||
@ -69,49 +65,49 @@ bool my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200); /* prepare for possible serial debug */
|
||||
Serial.begin(115200); /*prepare for possible serial debug*/
|
||||
|
||||
lv_init();
|
||||
|
||||
#if LV_USE_LOG != 0
|
||||
lv_log_register_print_cb(my_print); /* register print function for debugging */
|
||||
lv_log_register_print_cb(my_print); /*register print function for debugging*/
|
||||
#endif
|
||||
|
||||
tft.begin(); /* TFT init */
|
||||
tft.setRotation(1); /* Landscape orientation */
|
||||
tft.begin(); /*TFT init*/
|
||||
tft.setRotation(1); /*Landscape orientation*/
|
||||
|
||||
/* Set the touchscreen calibration data,
|
||||
the actual data for your display can be aquired using
|
||||
the Generic -> Touch_calibrate example from the TFT_eSPI library */
|
||||
/*Set the touchscreen calibration data,
|
||||
the actual data for your display can be aquired using
|
||||
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
|
||||
uint16_t calData[5] = {275, 3620, 264, 3532, 1};
|
||||
tft.setTouch(calData);
|
||||
|
||||
lv_draw_buf_init(&draw_buf, buf, NULL, screenWidth * 10);
|
||||
|
||||
/* Initialize the display */
|
||||
/*Initialize the display*/
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
/* Change the following line to your display resolution */
|
||||
/*Change the following line to your display resolution*/
|
||||
disp_drv.hor_res = screenWidth;
|
||||
disp_drv.ver_res = screenHeight;
|
||||
disp_drv.flush_cb = my_disp_flush;
|
||||
disp_drv.draw_buf = &draw_buf;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
/* Initialize the (dummy) input device driver */
|
||||
/*Initialize the (dummy) input device driver*/
|
||||
lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Try an example from the lv_examples Arduino library
|
||||
make sure to include it as written above.
|
||||
lv_example_btn_1(); */
|
||||
/*Try an example from the lv_examples Arduino library
|
||||
make sure to include it as written above.
|
||||
lv_example_btn_1();*/
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lv_timer_handler(); /* let the GUI do its work */
|
||||
lv_timer_handler(); /*let the GUI do its work*/
|
||||
delay(5);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ void lv_example_get_started_3(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_GET_STARTED_H*/
|
||||
|
@ -17,13 +17,13 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
|
||||
*/
|
||||
void lv_example_get_started_3(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_width(slider, 200); /*Set the width*/
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, NULL); /*Assign an event function*/
|
||||
|
||||
/* Create a label below the slider */
|
||||
/*Create a label below the slider*/
|
||||
label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label, "0");
|
||||
lv_obj_align(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/
|
||||
|
@ -37,7 +37,7 @@ void lv_example_flex_6(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_FLEX_H*/
|
||||
|
@ -37,7 +37,7 @@ void lv_example_grid_6(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_GRID_H*/
|
||||
|
@ -28,8 +28,8 @@ void lv_example_grid_1(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -23,7 +23,7 @@ void lv_example_grid_2(void)
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * obj;
|
||||
|
||||
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too */
|
||||
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1,
|
||||
@ -31,7 +31,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c0, r0");
|
||||
|
||||
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too */
|
||||
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1,
|
||||
@ -39,7 +39,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c1, r0");
|
||||
|
||||
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too */
|
||||
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1,
|
||||
@ -47,7 +47,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c2, r0");
|
||||
|
||||
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched. */
|
||||
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2,
|
||||
@ -55,7 +55,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c1-2, r1");
|
||||
|
||||
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched. */
|
||||
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1,
|
||||
|
@ -6,14 +6,14 @@
|
||||
*/
|
||||
void lv_example_grid_3(void)
|
||||
{
|
||||
/* Column 1: fix width 60 px
|
||||
* Column 2: 1 unit from the remaining free space
|
||||
* Column 3: 2 unit from the remaining free space */
|
||||
/*Column 1: fix width 60 px
|
||||
*Column 2: 1 unit from the remaining free space
|
||||
*Column 3: 2 unit from the remaining free space*/
|
||||
static lv_coord_t col_dsc[3] = {60, LV_GRID_FR(1), LV_GRID_FR(2)};
|
||||
|
||||
/* Row 1: fix width 60 px
|
||||
* Row 2: 1 unit from the remaining free space
|
||||
* Row 3: fix width 60 px */
|
||||
/*Row 1: fix width 60 px
|
||||
*Row 2: 1 unit from the remaining free space
|
||||
*Row 3: fix width 60 px*/
|
||||
static lv_coord_t row_dsc[3] = {40, LV_GRID_FR(1), 40};
|
||||
|
||||
static lv_grid_t grid;
|
||||
@ -34,8 +34,8 @@ void lv_example_grid_3(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -30,8 +30,8 @@ void lv_example_grid_4(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -29,8 +29,8 @@ void lv_example_grid_6(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_LAYOUT_H*/
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLES_H*/
|
||||
|
@ -54,7 +54,8 @@ void lv_port_disp_init(void)
|
||||
* Create a buffer for drawing
|
||||
*----------------------------*/
|
||||
|
||||
/* LVGL requires a buffer where it internally draws the widgets.
|
||||
/**
|
||||
* LVGL requires a buffer where it internally draws the widgets.
|
||||
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your display.
|
||||
* The buffer has to be greater than 1 display row
|
||||
*
|
||||
@ -72,7 +73,7 @@ void lv_port_disp_init(void)
|
||||
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
|
||||
* whole frame to display. This way you only need to change the frame buffer's address instead of
|
||||
* copying the pixels.
|
||||
* */
|
||||
*/
|
||||
|
||||
/* Example for 1) */
|
||||
static lv_draw_buf_t draw_buf_dsc_1;
|
||||
@ -123,15 +124,15 @@ void lv_port_disp_init(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/* Initialize your display and the required peripherals. */
|
||||
/*Initialize your display and the required peripherals.*/
|
||||
static void disp_init(void)
|
||||
{
|
||||
/*You code here*/
|
||||
}
|
||||
|
||||
/* Flush the content of the internal buffer the specific area on the display
|
||||
* You can use DMA or any hardware acceleration to do this operation in the background but
|
||||
* 'lv_disp_flush_ready()' has to be called when finished. */
|
||||
/*Flush the content of the internal buffer the specific area on the display
|
||||
*You can use DMA or any hardware acceleration to do this operation in the background but
|
||||
*'lv_disp_flush_ready()' has to be called when finished.*/
|
||||
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
|
||||
@ -140,21 +141,21 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
|
||||
int32_t y;
|
||||
for(y = area->y1; y <= area->y2; y++) {
|
||||
for(x = area->x1; x <= area->x2; x++) {
|
||||
/* Put a pixel to the display. For example: */
|
||||
/* put_px(x, y, *color_p)*/
|
||||
/*Put a pixel to the display. For example:*/
|
||||
/*put_px(x, y, *color_p)*/
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
|
||||
/* IMPORTANT!!!
|
||||
* Inform the graphics library that you are ready with the flushing*/
|
||||
/*IMPORTANT!!!
|
||||
*Inform the graphics library that you are ready with the flushing*/
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
|
||||
/*OPTIONAL: GPU INTERFACE*/
|
||||
#if LV_USE_GPU
|
||||
|
||||
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
|
||||
/*If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
|
||||
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
|
||||
const lv_area_t * fill_area, lv_color_t color)
|
||||
{
|
||||
@ -172,8 +173,8 @@ static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t
|
||||
|
||||
#endif /*LV_USE_GPU*/
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_DISP_TEMPL_H*/
|
||||
|
@ -19,17 +19,17 @@
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Create a type to store the required data about your file.
|
||||
* If you are using a File System library
|
||||
* it already should have a File type.
|
||||
* For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
|
||||
/*Create a type to store the required data about your file.
|
||||
*If you are using a File System library
|
||||
*it already should have a File type.
|
||||
*For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
|
||||
typedef struct {
|
||||
/*Add the data you need to store about a file*/
|
||||
uint32_t dummy1;
|
||||
uint32_t dummy2;
|
||||
}file_t;
|
||||
|
||||
/*Similarly to `file_t` create a type for directory reading too */
|
||||
/*Similarly to `file_t` create a type for directory reading too*/
|
||||
typedef struct {
|
||||
/*Add the data you need to store about directory reading*/
|
||||
uint32_t dummy1;
|
||||
@ -83,7 +83,7 @@ void lv_port_fs_init(void)
|
||||
* Register the file system interface in LVGL
|
||||
*--------------------------------------------------*/
|
||||
|
||||
/* Add a simple drive to open images */
|
||||
/*Add a simple drive to open images*/
|
||||
lv_fs_drv_t fs_drv;
|
||||
lv_fs_drv_init(&fs_drv);
|
||||
|
||||
@ -114,7 +114,7 @@ void lv_port_fs_init(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/* Initialize your Storage device and File system. */
|
||||
/*Initialize your Storage device and File system.*/
|
||||
static void fs_init(void)
|
||||
{
|
||||
/*E.g. for FatFS initialize the SD card and FatFS itself*/
|
||||
@ -138,19 +138,19 @@ static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path,
|
||||
{
|
||||
/*Open a file for write*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
else if(mode == LV_FS_MODE_RD)
|
||||
{
|
||||
/*Open a file for read*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
|
||||
{
|
||||
/*Open a file for read and write*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -167,7 +167,7 @@ static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -186,7 +186,7 @@ static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -204,7 +204,7 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -221,7 +221,7 @@ static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -237,7 +237,7 @@ static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -253,7 +253,7 @@ static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -268,7 +268,7 @@ static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -284,7 +284,7 @@ static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -300,7 +300,7 @@ static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const cha
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -317,7 +317,7 @@ static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * fr
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -333,7 +333,7 @@ static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *p
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -350,7 +350,7 @@ static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -365,13 +365,13 @@ static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_FS_TEMPL_H*/
|
||||
|
@ -68,7 +68,8 @@ static lv_indev_state_t encoder_state;
|
||||
|
||||
void lv_port_indev_init(void)
|
||||
{
|
||||
/* Here you will find example implementation of input devices supported by LittelvGL:
|
||||
/**
|
||||
* Here you will find example implementation of input devices supported by LittelvGL:
|
||||
* - Touchpad
|
||||
* - Mouse (with cursor support)
|
||||
* - Keypad (supports GUI usage only with key)
|
||||
@ -125,10 +126,10 @@ void lv_port_indev_init(void)
|
||||
indev_drv.read_cb = keypad_read;
|
||||
indev_keypad = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_keypad, group);` */
|
||||
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
*add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
*and assign this input device to group to navigate in it:
|
||||
*`lv_indev_set_group(indev_keypad, group);`*/
|
||||
|
||||
/*------------------
|
||||
* Encoder
|
||||
@ -143,10 +144,10 @@ void lv_port_indev_init(void)
|
||||
indev_drv.read_cb = encoder_read;
|
||||
indev_encoder = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_encoder, group);` */
|
||||
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
*add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
*and assign this input device to group to navigate in it:
|
||||
*`lv_indev_set_group(indev_encoder, group);`*/
|
||||
|
||||
/*------------------
|
||||
* Button
|
||||
@ -183,7 +184,7 @@ static void touchpad_init(void)
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the touchpad */
|
||||
/*Will be called by the library to read the touchpad*/
|
||||
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
static lv_coord_t last_x = 0;
|
||||
@ -226,13 +227,13 @@ static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
* Mouse
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your mouse */
|
||||
/*Initialize your mouse*/
|
||||
static void mouse_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the mouse */
|
||||
/*Will be called by the library to read the mouse*/
|
||||
static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
/*Get the current x and y coordinates*/
|
||||
@ -270,13 +271,13 @@ static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
* Keypad
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your keypad */
|
||||
/*Initialize your keypad*/
|
||||
static void keypad_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the mouse */
|
||||
/*Will be called by the library to read the mouse*/
|
||||
static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
static uint32_t last_key = 0;
|
||||
@ -331,13 +332,13 @@ static uint32_t keypad_get_key(void)
|
||||
* Encoder
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your keypad */
|
||||
/*Initialize your keypad*/
|
||||
static void encoder_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the encoder */
|
||||
/*Will be called by the library to read the encoder*/
|
||||
static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
|
||||
@ -361,13 +362,13 @@ static void encoder_handler(void)
|
||||
* Button
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your buttons */
|
||||
/*Initialize your buttons*/
|
||||
static void button_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the button */
|
||||
/*Will be called by the library to read the button*/
|
||||
static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
|
||||
@ -416,8 +417,8 @@ static bool button_is_pressed(uint8_t id)
|
||||
return false;
|
||||
}
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_INDEV_TEMPL_H*/
|
||||
|
@ -34,7 +34,7 @@ void lv_example_scroll_3(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_SCROLL_H*/
|
||||
|
@ -39,6 +39,7 @@ void lv_example_scroll_2(void)
|
||||
}
|
||||
lv_obj_update_snap(panel, LV_ANIM_ON);
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
/*Switch between "One scroll" and "Normal scroll" mode*/
|
||||
lv_obj_t * sw = lv_switch_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(sw, NULL, LV_ALIGN_IN_TOP_RIGHT, -20, 10);
|
||||
@ -46,6 +47,7 @@ void lv_example_scroll_2(void)
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label, "One scroll");
|
||||
lv_obj_align(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -42,7 +42,7 @@ void lv_example_style_11(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_STYLE_H*/
|
||||
|
@ -31,8 +31,8 @@ void lv_example_arc_2(void)
|
||||
lv_arc_set_angles(arc, 270, 270);
|
||||
lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Create an `lv_timer` to update the arc.
|
||||
* Store the `arc` in the user data*/
|
||||
/*Create an `lv_timer` to update the arc.
|
||||
*Store the `arc` in the user data*/
|
||||
lv_timer_create(arc_loader, 20, arc);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
txt_area.x1 = txt_area.x2 - txt_size.x + 1;
|
||||
dsc.color = lv_color_white();
|
||||
}
|
||||
/*If the indicator is still short put the text out of it on the right */
|
||||
/*If the indicator is still short put the text out of it on the right*/
|
||||
else {
|
||||
txt_area.x1 = bar->indic_area.x2 + 5;
|
||||
txt_area.x2 = txt_area.x1 + txt_size.x - 1;
|
||||
|
@ -22,13 +22,13 @@ void lv_example_btn_3(void)
|
||||
lv_anim_path_set_cb(&path_overshoot, lv_anim_path_overshoot);
|
||||
|
||||
|
||||
/* Transition descriptor when going back to the default state.
|
||||
* Add some delay to be sure the press transition is visible even if the press was very short*/
|
||||
/*Transition descriptor when going back to the default state.
|
||||
*Add some delay to be sure the press transition is visible even if the press was very short*/
|
||||
static lv_style_transition_dsc_t transition_dsc_def;
|
||||
lv_style_transition_dsc_init(&transition_dsc_def, props, &path_overshoot, 250, 100);
|
||||
|
||||
/* Transition descriptor when going to pressed state.
|
||||
* No delay, go to presses state immediately*/
|
||||
/*Transition descriptor when going to pressed state.
|
||||
*No delay, go to presses state immediately*/
|
||||
static lv_style_transition_dsc_t transition_dsc_pr;
|
||||
lv_style_transition_dsc_init(&transition_dsc_pr, props, &path_ease_in_out, 250, 0);
|
||||
|
||||
|
@ -7,7 +7,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
if(e == LV_EVENT_DRAW_PART_BEGIN) {
|
||||
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
|
||||
|
||||
/*Change the draw descriptor the 2nd button */
|
||||
/*Change the draw descriptor the 2nd button*/
|
||||
if(dsc->id == 1) {
|
||||
dsc->rect_dsc->radius = 0;
|
||||
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3();
|
||||
@ -18,7 +18,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
dsc->rect_dsc->shadow_ofs_y = 3;
|
||||
dsc->label_dsc->color = lv_color_white();
|
||||
}
|
||||
/*Change the draw descriptor the 3rd button */
|
||||
/*Change the draw descriptor the 3rd button*/
|
||||
else if(dsc->id == 2) {
|
||||
dsc->rect_dsc->radius = LV_RADIUS_CIRCLE;
|
||||
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3();
|
||||
|
@ -36,8 +36,8 @@ void lv_example_canvas_1(void)
|
||||
|
||||
lv_canvas_draw_text(canvas, 40, 20, 100, &label_dsc, "Some text on text canvas");
|
||||
|
||||
/* Test the rotation. It requires an other buffer where the orignal image is stored.
|
||||
* So copy the current image to buffer and rotate it to the canvas */
|
||||
/*Test the rotation. It requires an other buffer where the orignal image is stored.
|
||||
*So copy the current image to buffer and rotate it to the canvas*/
|
||||
static lv_color_t cbuf_tmp[CANVAS_WIDTH * CANVAS_HEIGHT];
|
||||
memcpy(cbuf_tmp, cbuf, sizeof(cbuf_tmp));
|
||||
lv_img_dsc_t img;
|
||||
|
@ -7,7 +7,7 @@ static lv_chart_series_t * ser2;
|
||||
|
||||
static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
{
|
||||
/*Add the faded area before the lines are drawn */
|
||||
/*Add the faded area before the lines are drawn*/
|
||||
if(e == LV_EVENT_DRAW_PART_BEGIN) {
|
||||
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
|
||||
if(dsc->part != LV_PART_ITEMS) return;
|
||||
|
@ -33,7 +33,7 @@ void lv_example_dropdown_3(void)
|
||||
lv_dropdown_set_symbol(dropdown, &img_caret_down);
|
||||
lv_obj_set_style_transform_angle(dropdown, LV_PART_MAIN, LV_STATE_CHECKED, 1800);
|
||||
|
||||
/* In a menu we don't need to show the last clicked item*/
|
||||
/*In a menu we don't need to show the last clicked item*/
|
||||
lv_dropdown_set_selected_highlight(dropdown, false);
|
||||
|
||||
lv_obj_add_event_cb(dropdown, event_cb, NULL);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../../lvgl.h"
|
||||
#if LV_USE_IMG && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_IMG && LV_USE_SLIDER && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * create_slider(lv_color_t color);
|
||||
static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
|
||||
@ -29,7 +29,7 @@ void lv_example_img_2(void)
|
||||
lv_obj_align(blue_slider, green_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
|
||||
/* Now create the actual image */
|
||||
/*Now create the actual image*/
|
||||
LV_IMG_DECLARE(img_cogwheel_argb)
|
||||
img1 = lv_img_create(lv_scr_act(), NULL);
|
||||
lv_img_set_src(img1, &img_cogwheel_argb);
|
||||
@ -43,7 +43,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
|
||||
LV_UNUSED(slider);
|
||||
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
/* Recolor the image based on the sliders' values */
|
||||
/*Recolor the image based on the sliders' values*/
|
||||
lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider));
|
||||
lv_opa_t intense = lv_slider_get_value(intense_slider);
|
||||
lv_obj_set_style_img_recolor_opa(img1, LV_PART_MAIN, LV_STATE_DEFAULT, intense);
|
||||
|
@ -19,7 +19,7 @@ void lv_example_img_3(void)
|
||||
{
|
||||
LV_IMG_DECLARE(img_cogwheel_argb);
|
||||
|
||||
/* Now create the actual image */
|
||||
/*Now create the actual image*/
|
||||
lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
|
||||
lv_img_set_src(img, &img_cogwheel_argb);
|
||||
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 50, 50);
|
||||
|
@ -7,7 +7,7 @@ void lv_example_imgbtn_1(void)
|
||||
LV_IMG_DECLARE(imgbtn_right);
|
||||
LV_IMG_DECLARE(imgbtn_mid);
|
||||
|
||||
/* Create a transition animation on width transformation and recolor.*/
|
||||
/*Create a transition animation on width transformation and recolor.*/
|
||||
static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0};
|
||||
static lv_style_transition_dsc_t tr;
|
||||
lv_style_transition_dsc_init(&tr, tr_prop, &lv_anim_path_def, 200, 0);
|
||||
|
@ -6,17 +6,17 @@
|
||||
*/
|
||||
void lv_example_label_2(void)
|
||||
{
|
||||
/* Create a style for the shadow*/
|
||||
/*Create a style for the shadow*/
|
||||
static lv_style_t style_shadow;
|
||||
lv_style_init(&style_shadow);
|
||||
lv_style_set_text_opa(&style_shadow, LV_OPA_30);
|
||||
lv_style_set_text_color(&style_shadow, lv_color_black());
|
||||
|
||||
/*Create a label for the shadow first (it's in the background) */
|
||||
/*Create a label for the shadow first (it's in the background)*/
|
||||
lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_add_style(shadow_label, LV_PART_MAIN, LV_STATE_DEFAULT, &style_shadow);
|
||||
|
||||
/* Create the main label */
|
||||
/*Create the main label*/
|
||||
lv_obj_t * main_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(main_label, "A simple method to create\n"
|
||||
"shadows on a text.\n"
|
||||
@ -26,10 +26,10 @@ void lv_example_label_2(void)
|
||||
/*Set the same text for the shadow label*/
|
||||
lv_label_set_text(shadow_label, lv_label_get_text(main_label));
|
||||
|
||||
/* Position the main label */
|
||||
/*Position the main label*/
|
||||
lv_obj_align(main_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Shift the second label down and to the right by 2 pixel */
|
||||
/*Shift the second label down and to the right by 2 pixel*/
|
||||
lv_obj_align(shadow_label, main_label, LV_ALIGN_IN_TOP_LEFT, 2, 2);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void lv_example_win_1(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_WIDGETS_H*/
|
||||
|
@ -23,7 +23,7 @@ void lv_example_meter_1(void)
|
||||
|
||||
lv_meter_indicator_t * indic;
|
||||
|
||||
/*Add a blue arc to the start */
|
||||
/*Add a blue arc to the start*/
|
||||
indic = lv_meter_add_arc(meter, scale, 3, lv_color_blue(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic, 0);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 20);
|
||||
@ -33,7 +33,7 @@ void lv_example_meter_1(void)
|
||||
lv_meter_set_indicator_start_value(meter, indic, 0);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 20);
|
||||
|
||||
/*Add a red arc to the end */
|
||||
/*Add a red arc to the end*/
|
||||
indic = lv_meter_add_arc(meter, scale, 3, lv_color_red(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic, 80);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 100);
|
||||
|
@ -26,7 +26,7 @@ void lv_example_meter_2(void)
|
||||
lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10);
|
||||
lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90);
|
||||
|
||||
/*Add a three arc indicator */
|
||||
/*Add a three arc indicator*/
|
||||
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_color_red(), 0);
|
||||
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_color_green(), -10);
|
||||
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_color_blue(), -20);
|
||||
|
@ -31,7 +31,7 @@ void lv_example_meter_3(void)
|
||||
|
||||
LV_IMG_DECLARE(img_hand)
|
||||
|
||||
/*Add a the hands from images */
|
||||
/*Add a the hands from images*/
|
||||
lv_meter_indicator_t * indic_min = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
|
||||
lv_meter_indicator_t * indic_hour = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
|
||||
|
||||
|
@ -18,7 +18,7 @@ void lv_example_meter_4(void)
|
||||
lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black());
|
||||
lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0);
|
||||
|
||||
/*Add a three arc indicator */
|
||||
/*Add a three arc indicator*/
|
||||
lv_coord_t indic_w = lv_obj_get_width(meter) / 2;
|
||||
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_color_orange(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic1, 0);
|
||||
|
@ -9,12 +9,12 @@ static lv_obj_t * slider_label;
|
||||
*/
|
||||
void lv_example_slider_1(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, NULL);
|
||||
|
||||
/* Create a label below the slider */
|
||||
/*Create a label below the slider*/
|
||||
slider_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(slider_label, "0%");
|
||||
|
||||
|
@ -19,7 +19,7 @@ void lv_example_slider_2(void)
|
||||
lv_style_set_content_opa(&style_pr, LV_OPA_COVER);
|
||||
lv_style_set_content_ofs_y(&style_pr, -15);
|
||||
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider;
|
||||
slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
@ -9,7 +9,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
|
||||
*/
|
||||
void lv_example_slider_3(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider;
|
||||
slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
@ -64,7 +64,7 @@ void lv_example_table_2(void)
|
||||
lv_obj_set_size(table, 150, 200);
|
||||
|
||||
lv_table_set_col_width(table, 0, 150);
|
||||
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value */
|
||||
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
|
||||
lv_table_set_col_cnt(table, 1);
|
||||
|
||||
/*Don't make the cell pressed, we will draw something different in the event*/
|
||||
|
@ -7,7 +7,7 @@ static lv_obj_t * kb;
|
||||
|
||||
void lv_example_textarea_2(void)
|
||||
{
|
||||
/* Create the password box */
|
||||
/*Create the password box*/
|
||||
lv_obj_t * pwd_ta = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_textarea_set_text(pwd_ta, "");
|
||||
lv_textarea_set_password_mode(pwd_ta, true);
|
||||
@ -16,33 +16,33 @@ void lv_example_textarea_2(void)
|
||||
lv_obj_set_pos(pwd_ta, 5, 20);
|
||||
lv_obj_add_event_cb(pwd_ta, ta_event_cb, NULL);
|
||||
|
||||
/* Create a label and position it above the text box */
|
||||
/*Create a label and position it above the text box*/
|
||||
lv_obj_t * pwd_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(pwd_label, "Password:");
|
||||
lv_obj_align(pwd_label, pwd_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
/* Create the one-line mode text area */
|
||||
/*Create the one-line mode text area*/
|
||||
lv_obj_t * oneline_ta = lv_textarea_create(lv_scr_act(), pwd_ta);
|
||||
lv_textarea_set_password_mode(oneline_ta, false);
|
||||
lv_obj_align(oneline_ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20);
|
||||
|
||||
|
||||
/* Create a label and position it above the text box */
|
||||
/*Create a label and position it above the text box*/
|
||||
lv_obj_t * oneline_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(oneline_label, "Text:");
|
||||
lv_obj_align(oneline_label, oneline_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
/* Create a keyboard */
|
||||
/*Create a keyboard*/
|
||||
kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
|
||||
lv_keyboard_set_textarea(kb, pwd_ta); /* Focus it on one of the text areas to start */
|
||||
lv_keyboard_set_textarea(kb, pwd_ta); /*Focus it on one of the text areas to start*/
|
||||
}
|
||||
|
||||
static void ta_event_cb(lv_obj_t * ta, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
/* Focus on the clicked text area */
|
||||
/*Focus on the clicked text area*/
|
||||
if(kb != NULL)
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ static lv_obj_t * kb;
|
||||
*/
|
||||
void lv_example_textarea_3(void)
|
||||
{
|
||||
/* Create the text area */
|
||||
/*Create the text area*/
|
||||
lv_obj_t * ta = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_obj_add_event_cb(ta, ta_event_cb, NULL);
|
||||
lv_textarea_set_accepted_chars(ta, "0123456789:");
|
||||
@ -19,7 +19,7 @@ void lv_example_textarea_3(void)
|
||||
lv_textarea_set_one_line(ta, true);
|
||||
lv_textarea_set_text(ta, "");
|
||||
|
||||
/* Create a keyboard*/
|
||||
/*Create a keyboard*/
|
||||
kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
/* clang-format off */
|
||||
/*clang-format off*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -20,15 +20,15 @@
|
||||
COLOR SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888) */
|
||||
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
|
||||
#define LV_COLOR_DEPTH 32
|
||||
|
||||
/* Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
/*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 0
|
||||
|
||||
/* Enable more complex drawing routines to manage screens transparency.
|
||||
* Can be used if the UI is above an other layer, e.g. an OSD menu or video player.
|
||||
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value */
|
||||
/*Enable more complex drawing routines to manage screens transparency.
|
||||
*Can be used if the UI is above an other layer, e.g. an OSD menu or video player.
|
||||
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
@ -38,13 +38,13 @@
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()` */
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/* Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U) /* [bytes] */
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/
|
||||
|
||||
/* Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
# define LV_MEM_ADR 0 /*0: unused*/
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
@ -53,29 +53,29 @@
|
||||
# define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/* Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster). */
|
||||
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
|
||||
#define LV_MEMCPY_MEMSET_STD 0
|
||||
|
||||
/*====================
|
||||
HAL SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* Default display refresh period. LVG will redraw changed ares with this period time */
|
||||
/*Default display refresh period. LVG will redraw changed ares with this period time*/
|
||||
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
|
||||
|
||||
/* Input device read period in milliseconds */
|
||||
/*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
|
||||
|
||||
/* Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
* It removes the need to manually update the tick with `lv_tick_inc()`) */
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 0
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
/* Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
* (Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
*(Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI_DEF 130 /*[px/inch]*/
|
||||
|
||||
/*=======================
|
||||
@ -86,25 +86,25 @@
|
||||
* Drawing
|
||||
*-----------*/
|
||||
|
||||
/* Enable complex draw engine.
|
||||
* Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks */
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
|
||||
/* Allow buffering some shadow calculation.
|
||||
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/* Default image cache size. Image caching keeps the images opened.
|
||||
* If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
* However the opened images might consume additional RAM.
|
||||
* 0: to disable caching */
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
*However the opened images might consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
/* Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver. */
|
||||
/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
/*-------------
|
||||
* GPU
|
||||
@ -114,22 +114,22 @@
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/* Use NXP's PXP GPU iMX RTxxx platforms */
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
|
||||
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS
|
||||
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
|
||||
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
|
||||
* */
|
||||
*/
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#endif
|
||||
|
||||
/* Use NXP's VG-Lite GPU iMX RTxxx platforms */
|
||||
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_VG_LITE 0
|
||||
|
||||
/*-------------
|
||||
@ -137,29 +137,28 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
*-----------*/
|
||||
|
||||
/*Enable the log module*/
|
||||
#define LV_USE_LOG 1
|
||||
#define LV_USE_LOG 0
|
||||
#if LV_USE_LOG
|
||||
|
||||
/* How important log should be added:
|
||||
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
* LV_LOG_LEVEL_INFO Log important events
|
||||
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
* LV_LOG_LEVEL_USER Only logs added by the user
|
||||
* LV_LOG_LEVEL_NONE Do not log anything */
|
||||
/*How important log should be added:
|
||||
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
*LV_LOG_LEVEL_INFO Log important events
|
||||
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*LV_LOG_LEVEL_USER Only logs added by the user
|
||||
*LV_LOG_LEVEL_NONE Do not log anything*/
|
||||
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
|
||||
/* 1: Print the log with 'printf';
|
||||
* 0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
# define LV_LOG_PRINTF 1
|
||||
/*1: Print the log with 'printf';
|
||||
*0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
# define LV_LOG_PRINTF 0
|
||||
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs */
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
# define LV_LOG_TRACE_MEM 1
|
||||
# define LV_LOG_TRACE_TIMER 1
|
||||
# define LV_LOG_TRACE_INDEV 1
|
||||
# define LV_LOG_TRACE_DISP_REFR 1
|
||||
# define LV_LOG_TRACE_EVENT 1
|
||||
# define LV_LOG_TRACE_SIGNAL 1
|
||||
# define LV_LOG_TRACE_OBJ_CREATE 1
|
||||
# define LV_LOG_TRACE_LAYOUT 1
|
||||
# define LV_LOG_TRACE_ANIM 1
|
||||
@ -170,13 +169,13 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
* Asserts
|
||||
*-----------*/
|
||||
|
||||
/* Enable asserts if an operation is failed or an invalid data is found.
|
||||
* If LV_USE_LOG is enabled an error message will be printed on failure*/
|
||||
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended) */
|
||||
/*Enable asserts if an operation is failed or an invalid data is found.
|
||||
*If LV_USE_LOG is enabled an error message will be printed on failure*/
|
||||
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
|
||||
#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow) */
|
||||
#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
|
||||
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
|
||||
|
||||
/*Add a custom handler when assert happens e.g. to restart the MCU*/
|
||||
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
|
||||
@ -208,50 +207,50 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
typedef void * lv_user_data_t;
|
||||
#endif
|
||||
|
||||
/* Garbage Collector settings
|
||||
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
||||
/*Garbage Collector settings
|
||||
*Used if lvgl is binded to higher level language and the memory is managed by that language*/
|
||||
#define LV_ENABLE_GC 0
|
||||
#if LV_ENABLE_GC != 0
|
||||
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#endif /* LV_ENABLE_GC */
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*=====================
|
||||
* COMPILER SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* For big endian systems set to 1 */
|
||||
/*For big endian systems set to 1*/
|
||||
#define LV_BIG_ENDIAN_SYSTEM 0
|
||||
|
||||
/* Define a custom attribute to `lv_tick_inc` function */
|
||||
/*Define a custom attribute to `lv_tick_inc` function*/
|
||||
#define LV_ATTRIBUTE_TICK_INC
|
||||
|
||||
/* Define a custom attribute to `lv_timer_handler` function */
|
||||
/*Define a custom attribute to `lv_timer_handler` function*/
|
||||
#define LV_ATTRIBUTE_TIMER_HANDLER
|
||||
|
||||
/* Define a custom attribute to `lv_disp_flush_ready` function */
|
||||
/*Define a custom attribute to `lv_disp_flush_ready` function*/
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
|
||||
/* Required alignment size for buffers */
|
||||
/*Required alignment size for buffers*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE
|
||||
|
||||
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
|
||||
* E.g. __attribute__((aligned(4)))*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
|
||||
/* Attribute to mark large constant arrays for example font's bitmaps */
|
||||
/*Attribute to mark large constant arrays for example font's bitmaps*/
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
|
||||
/* Complier prefix for a big array declaration in RAM*/
|
||||
/*Complier prefix for a big array declaration in RAM*/
|
||||
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
|
||||
|
||||
/* Place performance critical functions into a faster memory (e.g RAM) */
|
||||
/*Place performance critical functions into a faster memory (e.g RAM)*/
|
||||
#define LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
/* Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible */
|
||||
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
|
||||
#define LV_ATTRIBUTE_DMA
|
||||
|
||||
/* Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
* should also appear on LVGL binding API such as Micropython.*/
|
||||
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
*should also appear on LVGL binding API such as Micropython.*/
|
||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
|
||||
|
||||
/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
|
||||
@ -261,8 +260,8 @@ typedef void * lv_user_data_t;
|
||||
* FONT USAGE
|
||||
*===================*/
|
||||
|
||||
/* Montserrat fonts with ASCII range and some symbols using bpp = 4
|
||||
* https://fonts.google.com/specimen/Montserrat */
|
||||
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
|
||||
*https://fonts.google.com/specimen/Montserrat*/
|
||||
#define LV_FONT_MONTSERRAT_8 0
|
||||
#define LV_FONT_MONTSERRAT_10 0
|
||||
#define LV_FONT_MONTSERRAT_12 0
|
||||
@ -285,37 +284,37 @@ typedef void * lv_user_data_t;
|
||||
#define LV_FONT_MONTSERRAT_46 0
|
||||
#define LV_FONT_MONTSERRAT_48 0
|
||||
|
||||
/* Demonstrate special features */
|
||||
/*Demonstrate special features*/
|
||||
#define LV_FONT_MONTSERRAT_12_SUBPX 0
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
|
||||
|
||||
/*Pixel perfect monospace fonts
|
||||
* http://pelulamu.net/unscii/ */
|
||||
*http://pelulamu.net/unscii/*/
|
||||
#define LV_FONT_UNSCII_8 0
|
||||
#define LV_FONT_UNSCII_16 0
|
||||
|
||||
/* Optionally declare custom fonts here.
|
||||
* You can use these fonts as default font too and they will be available globally.
|
||||
* E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) */
|
||||
/*Optionally declare custom fonts here.
|
||||
*You can use these fonts as default font too and they will be available globally.
|
||||
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
|
||||
#define LV_FONT_CUSTOM_DECLARE
|
||||
|
||||
/*Always set a default font*/
|
||||
#define LV_FONT_DEFAULT &lv_font_montserrat_14
|
||||
|
||||
/* Enable handling large font and/or fonts with a lot of characters.
|
||||
* The limit depends on the font size, font face and bpp.
|
||||
* Compiler error will be triggered if a font needs it.*/
|
||||
/*Enable handling large font and/or fonts with a lot of characters.
|
||||
*The limit depends on the font size, font face and bpp.
|
||||
*Compiler error will be triggered if a font needs it.*/
|
||||
#define LV_FONT_FMT_TXT_LARGE 0
|
||||
|
||||
/* Enables/disables support for compressed fonts. */
|
||||
/*Enables/disables support for compressed fonts.*/
|
||||
#define LV_USE_FONT_COMPRESSED 0
|
||||
|
||||
/* Enable subpixel rendering */
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
/* Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
@ -323,52 +322,53 @@ typedef void * lv_user_data_t;
|
||||
* TEXT SETTINGS
|
||||
*=================*/
|
||||
|
||||
/* Select a character encoding for strings.
|
||||
/**
|
||||
* Select a character encoding for strings.
|
||||
* Your IDE or editor should have the same character encoding
|
||||
* - LV_TXT_ENC_UTF8
|
||||
* - LV_TXT_ENC_ASCII
|
||||
* */
|
||||
*/
|
||||
#define LV_TXT_ENC LV_TXT_ENC_UTF8
|
||||
|
||||
/*Can break (wrap) texts on these chars*/
|
||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||
|
||||
/* If a word is at least this long, will break wherever "prettiest"
|
||||
* To disable, set to a value <= 0 */
|
||||
/*If a word is at least this long, will break wherever "prettiest"
|
||||
*To disable, set to a value <= 0*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 0
|
||||
|
||||
/* Minimum number of characters in a long word to put on a line before a break.
|
||||
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
||||
/*Minimum number of characters in a long word to put on a line before a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
|
||||
|
||||
/* Minimum number of characters in a long word to put on a line after a break.
|
||||
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
||||
/*Minimum number of characters in a long word to put on a line after a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||
|
||||
/* The control character to use for signalling text recoloring. */
|
||||
/*The control character to use for signalling text recoloring.*/
|
||||
#define LV_TXT_COLOR_CMD "#"
|
||||
|
||||
/* Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
*The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#define LV_USE_BIDI 0
|
||||
#if LV_USE_BIDI
|
||||
/* Set the default direction. Supported values:
|
||||
* `LV_BIDI_DIR_LTR` Left-to-Right
|
||||
* `LV_BIDI_DIR_RTL` Right-to-Left
|
||||
* `LV_BIDI_DIR_AUTO` detect texts base direction */
|
||||
/*Set the default direction. Supported values:
|
||||
*`LV_BIDI_DIR_LTR` Left-to-Right
|
||||
*`LV_BIDI_DIR_RTL` Right-to-Left
|
||||
*`LV_BIDI_DIR_AUTO` detect texts base direction*/
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/* Enable Arabic/Persian processing
|
||||
* In these languages characters should be replaced with an other form based on their position in the text */
|
||||
/*Enable Arabic/Persian processing
|
||||
*In these languages characters should be replaced with an other form based on their position in the text*/
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
|
||||
/*==================
|
||||
* WIDGET USAGE
|
||||
*================*/
|
||||
|
||||
/* Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */
|
||||
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
@ -390,7 +390,7 @@ typedef void * lv_user_data_t;
|
||||
|
||||
#define LV_USE_LABEL 1
|
||||
#if LV_USE_LABEL
|
||||
# define LV_LABEL_TEXT_SEL 1 /*Enable selecting text of the label */
|
||||
# define LV_LABEL_TEXT_SEL 1 /*Enable selecting text of the label*/
|
||||
# define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
|
||||
#endif
|
||||
|
||||
@ -460,14 +460,14 @@ typedef void * lv_user_data_t;
|
||||
/*-----------
|
||||
* Themes
|
||||
*----------*/
|
||||
/* A simple, impressive and very complete theme */
|
||||
/*A simple, impressive and very complete theme*/
|
||||
#define LV_USE_THEME_DEFAULT 1
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/* 1: Light mode; 0: Dark mode*/
|
||||
/*1: Light mode; 0: Dark mode*/
|
||||
# define LV_THEME_DEFAULT_PALETTE_LIGHT 1
|
||||
|
||||
/* 1: Enable grow on press*/
|
||||
/*1: Enable grow on press*/
|
||||
# define LV_THEME_DEFAULT_GROW 1
|
||||
|
||||
/*Default transition time in [ms]*/
|
||||
|
4
lvgl.h
4
lvgl.h
@ -109,7 +109,7 @@ extern "C" {
|
||||
* bugfix_in_v5_3_2();
|
||||
* #endif
|
||||
*
|
||||
* */
|
||||
*/
|
||||
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ static inline const char *lv_version_info(void)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LVGL_H*/
|
||||
|
@ -23,18 +23,18 @@ fout.write(
|
||||
|
||||
#ifndef LV_CONF_INTERNAL_H
|
||||
#define LV_CONF_INTERNAL_H
|
||||
/* clang-format off */
|
||||
/*clang-format off*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Handle special Kconfig options */
|
||||
/*Handle special Kconfig options*/
|
||||
#include "lv_conf_kconfig.h"
|
||||
|
||||
#ifdef CONFIG_LV_CONF_SKIP
|
||||
#define LV_CONF_SKIP
|
||||
#endif
|
||||
|
||||
/* If "lv_conf.h" is available from here try to use it later.*/
|
||||
/*If "lv_conf.h" is available from here try to use it later.*/
|
||||
#if defined __has_include
|
||||
# if __has_include("lv_conf.h")
|
||||
# ifndef LV_CONF_INCLUDE_SIMPLE
|
||||
@ -54,7 +54,7 @@ fout.write(
|
||||
# elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/
|
||||
# include "lv_conf.h"
|
||||
# else
|
||||
# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder */
|
||||
# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -113,7 +113,7 @@ fout.write(
|
||||
typedef void * lv_obj_user_data_t;
|
||||
# endif
|
||||
|
||||
# if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
|
||||
# if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# endif
|
||||
|
||||
|
@ -258,7 +258,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
|
||||
switch(anim_type) {
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
/*Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, set_x_anim);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
|
@ -225,7 +225,7 @@ static inline lv_coord_t lv_dpx(lv_coord_t n)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DISP_H*/
|
||||
|
@ -81,7 +81,7 @@ void lv_group_del(lv_group_t * group)
|
||||
{
|
||||
/*Defocus the currently focused object*/
|
||||
if(group->obj_focus != NULL) {
|
||||
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
if(next == NULL) return;
|
||||
*next = obj;
|
||||
|
||||
/* If the head and the tail is equal then there is only one object in the linked list.
|
||||
* In this case automatically activate it*/
|
||||
/*If the head and the tail is equal then there is only one object in the linked list.
|
||||
*In this case automatically activate it*/
|
||||
if(_lv_ll_get_head(&group->obj_ll) == next) {
|
||||
lv_group_refocus(group);
|
||||
}
|
||||
@ -160,7 +160,7 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
|
||||
/*If this is the only object in the group then focus to nothing.*/
|
||||
if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
|
||||
lv_signal_send(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, NULL);
|
||||
}
|
||||
/*If there more objects in the group then focus to the next/prev object*/
|
||||
else {
|
||||
@ -168,14 +168,14 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
/* If the focuses object is still the same then it was the only object in the group but it will
|
||||
* be deleted. Set the `obj_focus` to NULL to get back to the initial state of the group with
|
||||
* zero objects*/
|
||||
/*If the focuses object is still the same then it was the only object in the group but it will
|
||||
*be deleted. Set the `obj_focus` to NULL to get back to the initial state of the group with
|
||||
*zero objects*/
|
||||
if(*g->obj_focus == obj) {
|
||||
g->obj_focus = NULL;
|
||||
}
|
||||
|
||||
/*Search the object and remove it from its group */
|
||||
/*Search the object and remove it from its group*/
|
||||
lv_obj_t ** i;
|
||||
_LV_LL_READ(&g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
@ -196,7 +196,7 @@ void lv_group_remove_all_objs(lv_group_t * group)
|
||||
{
|
||||
/*Defocus the currently focused object*/
|
||||
if(group->obj_focus != NULL) {
|
||||
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
group->obj_focus = NULL;
|
||||
}
|
||||
@ -231,7 +231,6 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
_LV_LL_READ(&g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
if(g->obj_focus != NULL) {
|
||||
lv_signal_send(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(*g->obj_focus);
|
||||
@ -240,7 +239,6 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
g->obj_focus = i;
|
||||
|
||||
if(g->obj_focus != NULL) {
|
||||
lv_signal_send(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(g->focus_cb) g->focus_cb(g);
|
||||
lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
@ -295,9 +293,6 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
|
||||
|
||||
lv_res_t res;
|
||||
|
||||
res = lv_signal_send(act, LV_SIGNAL_CONTROL, &c);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
res = lv_event_send(act, LV_EVENT_KEY, &c);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
@ -330,7 +325,6 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
lv_obj_t * focused = lv_group_get_focused(group);
|
||||
|
||||
if(focused) {
|
||||
lv_signal_send(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
@ -486,7 +480,6 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
||||
if(obj_next == group->obj_focus) return; /*There's only one visible object and it's already focused*/
|
||||
|
||||
if(group->obj_focus) {
|
||||
lv_signal_send(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
@ -494,10 +487,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
||||
|
||||
group->obj_focus = obj_next;
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_signal_send(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
|
@ -55,7 +55,7 @@ typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
|
||||
* They are NOT for laying out objects on a screen (try `lv_cont` for that).
|
||||
*/
|
||||
typedef struct _lv_group_t {
|
||||
lv_ll_t obj_ll; /**< Linked list to store the objects in the group */
|
||||
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
|
||||
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
|
||||
|
||||
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
|
||||
@ -66,7 +66,7 @@ typedef struct _lv_group_t {
|
||||
uint8_t frozen : 1; /**< 1: can't focus to new object*/
|
||||
uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/
|
||||
uint8_t click_focus : 1; /**< 1: If an object in a group is clicked by an indev then it will be
|
||||
focused */
|
||||
focused*/
|
||||
uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on
|
||||
deletion.*/
|
||||
uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end
|
||||
@ -226,7 +226,7 @@ bool lv_group_get_wrap(lv_group_t * group);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GROUP_H*/
|
||||
|
@ -379,13 +379,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*Save the last key to compare it with the current latter on RELEASE*/
|
||||
uint32_t prev_key = i->proc.types.keypad.last_key;
|
||||
|
||||
/* Save the last key.
|
||||
* It must be done here else `lv_indev_get_key` will return the last key in events and signals*/
|
||||
/*Save the last key.
|
||||
*It must be done here else `lv_indev_get_key` will return the last key in events*/
|
||||
i->proc.types.keypad.last_key = data->key;
|
||||
|
||||
/* Save the previous state so we can detect state changes below and also set the last state now
|
||||
* so if any signal/event handler on the way returns `LV_RES_INV` the last state is remembered
|
||||
* for the next time*/
|
||||
/*Save the previous state so we can detect state changes below and also set the last state now
|
||||
*so if any event handler on the way returns `LV_RES_INV` the last state is remembered
|
||||
*for the next time*/
|
||||
uint32_t prev_state = i->proc.types.keypad.last_state;
|
||||
i->proc.types.keypad.last_state = data->state;
|
||||
|
||||
@ -399,8 +399,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*Send the ENTER as a normal KEY*/
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -432,8 +430,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
else if(data->state == LV_INDEV_STATE_PRESSED && prev_state == LV_INDEV_STATE_PRESSED) {
|
||||
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_PRESSING, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -443,8 +439,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
i->proc.long_pr_sent = 1;
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
i->proc.longpr_rep_timestamp = lv_tick_get();
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -457,8 +451,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
/*Send LONG_PRESS_REP on ENTER*/
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -488,7 +480,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
data->key = prev_key;
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
if(i->proc.long_pr_sent == 0) {
|
||||
@ -499,8 +491,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
i->proc.pr_timestamp = 0;
|
||||
i->proc.long_pr_sent = 0;
|
||||
@ -524,8 +514,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
i->proc.types.keypad.last_state = LV_INDEV_STATE_RELEASED; /*To skip the processing of release*/
|
||||
}
|
||||
|
||||
/* Save the last keys before anything else.
|
||||
* They need to be already saved if the function returns for any reason*/
|
||||
/*Save the last keys before anything else.
|
||||
*They need to be already saved if the function returns for any reason*/
|
||||
lv_indev_state_t last_state = i->proc.types.keypad.last_state;
|
||||
i->proc.types.keypad.last_state = data->state;
|
||||
i->proc.types.keypad.last_key = data->key;
|
||||
@ -555,9 +545,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
bool editable = lv_obj_is_editable(indev_obj_act);
|
||||
|
||||
if(lv_group_get_editing(g) == true || editable == false) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -584,7 +571,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
/*Pressing*/
|
||||
else if(data->state == LV_INDEV_STATE_PRESSED && last_state == LV_INDEV_STATE_PRESSED) {
|
||||
/* Long press*/
|
||||
/*Long press*/
|
||||
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver->long_press_time) {
|
||||
|
||||
i->proc.long_pr_sent = 1;
|
||||
@ -600,10 +587,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
|
||||
}
|
||||
}
|
||||
/*If not editable then just send a long press signal*/
|
||||
/*If not editable then just send a long press Call the ancestor's event handler*/
|
||||
else {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -617,8 +602,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
i->proc.longpr_rep_timestamp = lv_tick_get();
|
||||
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
@ -647,7 +630,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
/*The button was released on a non-editable object. Just send enter*/
|
||||
if(editable == false) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
||||
@ -656,14 +639,12 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*An object is being edited and the button is released. */
|
||||
/*An object is being edited and the button is released.*/
|
||||
else if(g->editing) {
|
||||
/*Ignore long pressed enter release because it comes from mode switch*/
|
||||
if(!i->proc.long_pr_sent || _lv_ll_get_len(&g->obj_ll) <= 1) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
|
||||
@ -672,8 +653,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
}
|
||||
@ -724,7 +703,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
*/
|
||||
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
/* Die gracefully if i->btn_points is NULL */
|
||||
/*Die gracefully if i->btn_points is NULL*/
|
||||
if(i->btn_points == NULL) {
|
||||
LV_LOG_WARN("btn_points is NULL");
|
||||
return;
|
||||
@ -809,18 +788,16 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
/*If a new object was found reset some variables and send a pressed signal*/
|
||||
/*If a new object was found reset some variables and send a pressed Call the ancestor's event handler*/
|
||||
if(indev_obj_act != proc->types.pointer.act_obj) {
|
||||
proc->types.pointer.last_point.x = proc->types.pointer.act_point.x;
|
||||
proc->types.pointer.last_point.y = proc->types.pointer.act_point.y;
|
||||
|
||||
/*If a new object found the previous was lost, so send a signal*/
|
||||
/*If a new object found the previous was lost, so send a Call the ancestor's event handler*/
|
||||
if(proc->types.pointer.act_obj != NULL) {
|
||||
/*Save the obj because in special cases `act_obj` can change in the signal function*/
|
||||
/*Save the obj because in special cases `act_obj` can change in the Call the ancestor's event handler function*/
|
||||
lv_obj_t * last_obj = proc->types.pointer.act_obj;
|
||||
|
||||
lv_signal_send(last_obj, LV_SIGNAL_PRESS_LOST, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(last_obj, LV_EVENT_PRESS_LOST, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
@ -829,7 +806,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.last_obj = indev_obj_act;
|
||||
|
||||
if(indev_obj_act != NULL) {
|
||||
/* Save the time when the obj pressed to count long press time.*/
|
||||
/*Save the time when the obj pressed to count long press time.*/
|
||||
proc->pr_timestamp = lv_tick_get();
|
||||
proc->long_pr_sent = 0;
|
||||
proc->types.pointer.scroll_sum.x = 0;
|
||||
@ -841,10 +818,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.vect.x = 0;
|
||||
proc->types.pointer.vect.y = 0;
|
||||
|
||||
/*Send a signal about the press*/
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_PRESSED, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
/*Send a Call the ancestor's event handler about the press*/
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
@ -870,9 +844,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.scroll_throw_vect_ori = proc->types.pointer.scroll_throw_vect;
|
||||
|
||||
if(indev_obj_act) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_PRESSING, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL);
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
if(indev_act->proc.wait_until_release) return;
|
||||
@ -884,14 +856,12 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
|
||||
/*If there is no scrolling then check for long press time*/
|
||||
if(proc->types.pointer.scroll_obj == NULL && proc->long_pr_sent == 0) {
|
||||
/*Send a signal about the long press if enough time elapsed*/
|
||||
/*Send a Call the ancestor's event handler about the long press if enough time elapsed*/
|
||||
if(lv_tick_elaps(proc->pr_timestamp) > indev_act->driver->long_press_time) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
/*Mark the signal sending to do not send it again*/
|
||||
/*Mark the Call the ancestor's event handler sending to do not send it again*/
|
||||
proc->long_pr_sent = 1;
|
||||
|
||||
/*Save the long press time stamp for the long press repeat handler*/
|
||||
@ -899,12 +869,10 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
}
|
||||
}
|
||||
|
||||
/*Send long press repeated signal*/
|
||||
/*Send long press repeated Call the ancestor's event handler*/
|
||||
if(proc->types.pointer.scroll_obj == NULL && proc->long_pr_sent == 1) {
|
||||
/*Send a signal about the long press repeat if enough time elapsed*/
|
||||
/*Send a Call the ancestor's event handler about the long press repeat if enough time elapsed*/
|
||||
if(lv_tick_elaps(proc->longpr_rep_timestamp) > indev_act->driver->long_press_rep_time) {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
proc->longpr_rep_timestamp = lv_tick_get();
|
||||
@ -929,14 +897,11 @@ static void indev_proc_release(lv_indev_proc_t * proc)
|
||||
indev_obj_act = proc->types.pointer.act_obj;
|
||||
lv_obj_t * scroll_obj = proc->types.pointer.scroll_obj;
|
||||
|
||||
/*Forget the act obj and send a released signal */
|
||||
/*Forget the act obj and send a released Call the ancestor's event handler*/
|
||||
if(indev_obj_act) {
|
||||
LV_LOG_INFO("released");
|
||||
|
||||
/*Send RELEASE signal and event*/
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
/*Send RELEASE Call the ancestor's event handler and event*/
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
|
||||
@ -957,7 +922,7 @@ static void indev_proc_release(lv_indev_proc_t * proc)
|
||||
|
||||
}
|
||||
|
||||
/*The reset can be set in the signal function.
|
||||
/*The reset can be set in the Call the ancestor's event handler function.
|
||||
* In case of reset query ignore the remaining parts.*/
|
||||
if(scroll_obj) {
|
||||
_lv_indev_scroll_throw_handler(proc);
|
||||
@ -1006,7 +971,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
lv_group_t * g_act = lv_obj_get_group(obj_to_focus);
|
||||
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
|
||||
|
||||
/*If both the last and act. obj. are in the same group (or no group but it's also the same) */
|
||||
/*If both the last and act. obj. are in the same group (or no group but it's also the same)*/
|
||||
if(g_act == g_prev) {
|
||||
/*The objects are in a group*/
|
||||
if(g_act) {
|
||||
@ -1016,14 +981,10 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
/*The object are not in group*/
|
||||
else {
|
||||
if(proc->types.pointer.last_pressed) {
|
||||
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
@ -1032,8 +993,6 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
else {
|
||||
/*If the prev. obj. is not in a group then defocus it.*/
|
||||
if(g_prev == NULL && proc->types.pointer.last_pressed) {
|
||||
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
@ -1042,15 +1001,11 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(proc->types.pointer.last_pressed) {
|
||||
/*If the prev. object also wasn't in a group defocus it*/
|
||||
if(g_prev == NULL) {
|
||||
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
/*If the prev. object also was in a group at least "LEAVE" it instead of defocus*/
|
||||
else {
|
||||
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_LEAVE, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_LEAVE, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
@ -1063,8 +1018,6 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
else {
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
@ -1121,8 +1074,6 @@ void indev_gesture(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.gesture_dir = LV_GESTURE_DIR_TOP;
|
||||
}
|
||||
|
||||
lv_signal_send(gesture_obj, LV_SIGNAL_GESTURE, indev_act);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(gesture_obj, LV_EVENT_GESTURE, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_H*/
|
||||
|
@ -56,8 +56,6 @@ void _lv_indev_scroll_handler(lv_indev_proc_t * proc)
|
||||
init_scroll_limits(proc);
|
||||
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_signal_send(scroll_obj, LV_SIGNAL_SCROLL_BEGIN, indev_act);
|
||||
if(proc->reset_query) return;
|
||||
lv_event_send(scroll_obj, LV_EVENT_SCROLL_BEGIN, indev_act);
|
||||
if(proc->reset_query) return;
|
||||
}
|
||||
@ -158,7 +156,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_proc_t * proc)
|
||||
}
|
||||
}
|
||||
|
||||
/*Check if the scroll has finished */
|
||||
/*Check if the scroll has finished*/
|
||||
if(proc->types.pointer.scroll_throw_vect.x == 0 && proc->types.pointer.scroll_throw_vect.y == 0) {
|
||||
/*Revert if scrolled in*/
|
||||
/*If vertically scrollable and not controlled by snap*/
|
||||
@ -189,8 +187,6 @@ void _lv_indev_scroll_throw_handler(lv_indev_proc_t * proc)
|
||||
}
|
||||
}
|
||||
|
||||
lv_signal_send(scroll_obj, LV_SIGNAL_SCROLL_END, indev_act);
|
||||
if(proc->reset_query) return;
|
||||
lv_event_send(scroll_obj, LV_EVENT_SCROLL_END, indev_act);
|
||||
if(proc->reset_query) return;
|
||||
|
||||
@ -247,13 +243,13 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_coord_t scroll_limit = indev_act->driver->scroll_limit;
|
||||
|
||||
/* Go until find an scrollable object in the current direction
|
||||
* More precisely:
|
||||
* 1. Check the pressed object and all of its ancestors and try to find an object which is scrollable
|
||||
* 2. Scrollable means it has some content out of it's area
|
||||
* 3. If an object can be scrolled into the current direction then use it ("real match"")
|
||||
* 4. If can be scrolled on the current axis (hor/ver) save it as candidate (at least show an elastic scroll effect)
|
||||
* 5. Use the last candidate. Always the "deepest" parent or the object from point 3 */
|
||||
/*Go until find an scrollable object in the current direction
|
||||
*More precisely:
|
||||
* 1. Check the pressed object and all of its ancestors and try to find an object which is scrollable
|
||||
* 2. Scrollable means it has some content out of it's area
|
||||
* 3. If an object can be scrolled into the current direction then use it ("real match"")
|
||||
* 4. If can be scrolled on the current axis (hor/ver) save it as candidate (at least show an elastic scroll effect)
|
||||
* 5. Use the last candidate. Always the "deepest" parent or the object from point 3*/
|
||||
lv_obj_t * obj_act = proc->types.pointer.act_obj;
|
||||
while(obj_act) {
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLLABLE) == false) {
|
||||
@ -286,16 +282,16 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
if((scroll_dir & LV_DIR_TOP) == 0) up_en = false;
|
||||
if((scroll_dir & LV_DIR_BOTTOM) == 0) down_en = false;
|
||||
|
||||
/*The object is scrollable to a direction if its content overflow in that direction. */
|
||||
/*The object is scrollable to a direction if its content overflow in that direction.*/
|
||||
lv_coord_t st = lv_obj_get_scroll_top(obj_act);
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(obj_act);
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(obj_act);
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(obj_act);
|
||||
|
||||
/* If this object is scrollable into the current scroll direction then save it as a candidate.
|
||||
* It's important only to be scrollable on the current axis (hor/ver) because if the scroll
|
||||
* is propagated to this object it can show at least elastic scroll effect.
|
||||
* But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate) */
|
||||
/*If this object is scrollable into the current scroll direction then save it as a candidate.
|
||||
*It's important only to be scrollable on the current axis (hor/ver) because if the scroll
|
||||
*is propagated to this object it can show at least elastic scroll effect.
|
||||
*But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate)*/
|
||||
if((st > 0 || sb > 0) &&
|
||||
((up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit)))
|
||||
@ -317,7 +313,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
if(sl <= 0) left_en = false;
|
||||
if(sr <= 0) right_en = false;
|
||||
|
||||
/*If the object really can be scrolled into the current direction the use it. */
|
||||
/*If the object really can be scrolled into the current direction the use it.*/
|
||||
if((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
@ -330,7 +326,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
/*If this object don't want to chain the scroll ot the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN) == false) break;
|
||||
|
||||
/*Try the parent */
|
||||
/*Try the parent*/
|
||||
obj_act = lv_obj_get_parent(obj_act);
|
||||
}
|
||||
|
||||
@ -563,8 +559,8 @@ static lv_coord_t scroll_throw_predict_x(lv_indev_proc_t * proc)
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, lv_dir_t dir)
|
||||
{
|
||||
if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_ELASTIC)) {
|
||||
/* If there is snapping in the current direction don't use the elastic factor because
|
||||
* it's natural that the first and last items are scrolled (snapped) in. */
|
||||
/*If there is snapping in the current direction don't use the elastic factor because
|
||||
*it's natural that the first and last items are scrolled (snapped) in.*/
|
||||
lv_scroll_snap_t snap;
|
||||
snap = dir == LV_DIR_HOR ? lv_obj_get_scroll_snap_x(scroll_obj) : lv_obj_get_scroll_snap_y(scroll_obj);
|
||||
|
||||
|
@ -59,7 +59,7 @@ void lv_indev_scroll_get_snap_dist(lv_obj_t * obj, lv_point_t * p);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_SCROLL_H*/
|
||||
|
@ -61,8 +61,8 @@ typedef struct {
|
||||
**********************/
|
||||
static void lv_obj_constructor(lv_obj_t * obj, const lv_obj_t * copy);
|
||||
static void lv_obj_destructor(lv_obj_t * obj);
|
||||
static lv_draw_res_t lv_obj_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode);
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
static void lv_obj_draw(lv_obj_t * obj, lv_event_t e);
|
||||
static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e);
|
||||
static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area);
|
||||
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
|
||||
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
|
||||
@ -79,8 +79,7 @@ static void * event_act_user_data_cb;
|
||||
const lv_obj_class_t lv_obj_class = {
|
||||
.constructor_cb = lv_obj_constructor,
|
||||
.destructor_cb = lv_obj_destructor,
|
||||
.signal_cb = lv_obj_signal,
|
||||
.draw_cb = lv_obj_draw,
|
||||
.event_cb = lv_obj_event_cb,
|
||||
.instance_size = (sizeof(lv_obj_t)),
|
||||
.base_class = NULL,
|
||||
};
|
||||
@ -94,19 +93,13 @@ const lv_obj_class_t lv_obj_class = {
|
||||
# define EVENT_TRACE(...)
|
||||
#endif
|
||||
|
||||
#if LV_LOG_TRACE_SIGNAL
|
||||
# define SIGNAL_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define SIGNAL_TRACE(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_init(void)
|
||||
{
|
||||
/* Do nothing if already initialized */
|
||||
/*Do nothing if already initialized*/
|
||||
if(lv_initialized) {
|
||||
LV_LOG_WARN("lv_init: already inited");
|
||||
return;
|
||||
@ -201,15 +194,9 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
|
||||
EVENT_TRACE("Sending event %d to 0x%p with 0x%p param", event, obj, param);
|
||||
|
||||
/*Nothing to do if no event function and not bubbled*/
|
||||
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0);
|
||||
if(event_dsc == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) == false) {
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/* Build a simple linked list from the objects used in the events
|
||||
* It's important to know if an this object was deleted by a nested event
|
||||
* called from this `event_cb`. */
|
||||
/*Build a simple linked list from the objects used in the events
|
||||
*It's important to know if an this object was deleted by a nested event
|
||||
*called from this `event_cb`.*/
|
||||
lv_event_temp_data_t event_temp_data;
|
||||
event_temp_data.obj = obj;
|
||||
event_temp_data.deleted = false;
|
||||
@ -220,8 +207,8 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
}
|
||||
event_temp_data_head = &event_temp_data;
|
||||
|
||||
/* There could be nested event sending with different param.
|
||||
* It needs to be saved for the current event context because `lv_event_get_data` returns a global param. */
|
||||
/*There could be nested event sending with different param.
|
||||
*It needs to be saved for the current event context because `lv_event_get_data` returns a global param.*/
|
||||
void * event_act_param_save = event_act_param;
|
||||
event_act_param = param;
|
||||
|
||||
@ -231,9 +218,12 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, event);
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0);
|
||||
lv_res_t res = LV_RES_OK;
|
||||
while(event_dsc) {
|
||||
res = lv_obj_event_base(NULL, obj, event);
|
||||
|
||||
uint32_t i = 0;
|
||||
while(event_dsc && res == LV_RES_OK) {
|
||||
if(event_dsc->cb) {
|
||||
void * event_act_user_data_cb_save = event_act_user_data_cb;
|
||||
event_act_user_data_cb = event_dsc->user_data;
|
||||
@ -269,6 +259,48 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e)
|
||||
{
|
||||
const lv_obj_class_t * base;
|
||||
if(class_p == NULL) base = obj->class_p;
|
||||
else base = class_p->base_class;
|
||||
|
||||
/*Find a base in which Call the ancestor's event handler_cb is set*/
|
||||
while(base && base->event_cb == NULL) base = base->base_class;
|
||||
|
||||
if(base == NULL) return LV_RES_OK;
|
||||
if(base->event_cb == NULL) return LV_RES_OK;
|
||||
|
||||
|
||||
/* Build a simple linked list from the objects used in the events
|
||||
* It's important to know if an this object was deleted by a nested event
|
||||
* called from this `event_cb`. */
|
||||
lv_event_temp_data_t event_temp_data;
|
||||
event_temp_data.obj = obj;
|
||||
event_temp_data.deleted = false;
|
||||
event_temp_data.prev = NULL;
|
||||
|
||||
if(event_temp_data_head) {
|
||||
event_temp_data.prev = event_temp_data_head;
|
||||
}
|
||||
event_temp_data_head = &event_temp_data;
|
||||
|
||||
/*Call the actual event callback*/
|
||||
base->event_cb(obj, e);
|
||||
|
||||
lv_res_t res = LV_RES_OK;
|
||||
/*Stop if the object is deleted*/
|
||||
if(event_temp_data.deleted) res = LV_RES_INV;
|
||||
|
||||
/*Remove this element from the list*/
|
||||
event_temp_data_head = event_temp_data_head->prev;
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void * lv_event_get_param(void)
|
||||
{
|
||||
return event_act_param;
|
||||
@ -296,23 +328,6 @@ void _lv_event_mark_deleted(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param)
|
||||
{
|
||||
if(obj == NULL) return LV_RES_OK;
|
||||
|
||||
SIGNAL_TRACE("Sending signal %d to 0x%p with 0x%p param", signal, obj, param);
|
||||
|
||||
const lv_obj_class_t * class_p = obj->class_p;
|
||||
while(class_p && class_p->signal_cb == NULL) class_p = class_p->base_class;
|
||||
|
||||
if(class_p == NULL) return LV_RES_OK;
|
||||
|
||||
lv_res_t res = LV_RES_OK;
|
||||
if(class_p->signal_cb) res = class_p->signal_cb(obj, signal, param);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
@ -435,10 +450,10 @@ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir)
|
||||
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
obj->spec_attr->base_dir = dir;
|
||||
lv_signal_send(obj, LV_SIGNAL_BASE_DIR_CHG, NULL);
|
||||
lv_event_send(obj, LV_EVENT_BASE_DIR_CHANGED, NULL);
|
||||
|
||||
/* Notify the children about the parent base dir has changed.
|
||||
* (The children might have `LV_BIDI_DIR_INHERIT`)*/
|
||||
/*Notify the children about the parent base dir has changed.
|
||||
*(The children might have `LV_BIDI_DIR_INHERIT`)*/
|
||||
base_dir_refr_children(obj);
|
||||
}
|
||||
|
||||
@ -679,7 +694,7 @@ static void lv_obj_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
||||
}
|
||||
/*Add to the same group*/
|
||||
if(copy->spec_attr && copy->spec_attr->group_p) {
|
||||
obj->spec_attr->group_p = NULL; /*It was simply copied */
|
||||
obj->spec_attr->group_p = NULL; /*It was simply copied*/
|
||||
lv_group_add_obj(copy->spec_attr->group_p, obj);
|
||||
}
|
||||
|
||||
@ -713,10 +728,15 @@ static void lv_obj_destructor(lv_obj_t * p)
|
||||
|
||||
}
|
||||
|
||||
static lv_draw_res_t lv_obj_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode)
|
||||
static void lv_obj_draw(lv_obj_t * obj, lv_event_t e)
|
||||
{
|
||||
if(mode == LV_DRAW_MODE_COVER_CHECK) {
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) return LV_DRAW_RES_MASKED;
|
||||
if(e == LV_EVENT_COVER_CHECK) {
|
||||
lv_cover_check_info_t * info = lv_event_get_param();
|
||||
if(info->res == LV_DRAW_RES_MASKED) return;
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
|
||||
info->res = LV_DRAW_RES_MASKED;
|
||||
return;
|
||||
}
|
||||
|
||||
/*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/
|
||||
lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN);
|
||||
@ -729,19 +749,32 @@ static lv_draw_res_t lv_obj_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv
|
||||
coords.y1 -= h;
|
||||
coords.y2 += h;
|
||||
|
||||
if(_lv_area_is_in(clip_area, &coords, r) == false) return LV_DRAW_RES_NOT_COVER;
|
||||
if(_lv_area_is_in(info->clip_area, &coords, r) == false) {
|
||||
info->res = LV_DRAW_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_bg_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return LV_DRAW_RES_NOT_COVER;
|
||||
if(lv_obj_get_style_bg_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
info->res = LV_DRAW_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DRAW_RES_NOT_COVER;
|
||||
if(lv_obj_get_style_blend_mode(obj, LV_PART_MAIN) != LV_BLEND_MODE_NORMAL) {
|
||||
info->res = LV_DRAW_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) return LV_DRAW_RES_NOT_COVER;
|
||||
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
info->res = LV_DRAW_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
return LV_DRAW_RES_COVER;
|
||||
info->res = LV_DRAW_RES_COVER;
|
||||
|
||||
}
|
||||
else if(mode == LV_DRAW_MODE_MAIN_DRAW) {
|
||||
else if(e == LV_EVENT_DRAW_MAIN) {
|
||||
const lv_area_t * clip_area = lv_event_get_param();
|
||||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_draw_rect_dsc_init(&draw_dsc);
|
||||
/*If the border is drawn later disable loading its properties*/
|
||||
@ -772,7 +805,8 @@ static lv_draw_res_t lv_obj_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(mode == LV_DRAW_MODE_POST_DRAW) {
|
||||
else if(e == LV_EVENT_DRAW_POST) {
|
||||
const lv_area_t * clip_area = lv_event_get_param();
|
||||
draw_scrollbar(obj, clip_area);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
@ -803,8 +837,6 @@ static lv_draw_res_t lv_obj_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv
|
||||
lv_draw_rect(&coords, clip_area, &draw_dsc);
|
||||
}
|
||||
}
|
||||
|
||||
return LV_DRAW_RES_OK;
|
||||
}
|
||||
|
||||
static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
@ -868,29 +900,27 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
|
||||
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
{
|
||||
lv_res_t res = LV_RES_OK;
|
||||
|
||||
if(sign == LV_SIGNAL_PRESSED) {
|
||||
if(e == LV_EVENT_PRESSED) {
|
||||
lv_obj_add_state(obj, LV_STATE_PRESSED);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
else if(e == LV_EVENT_RELEASED) {
|
||||
lv_obj_clear_state(obj, LV_STATE_PRESSED);
|
||||
|
||||
void * param = lv_event_get_param();
|
||||
/*Go the checked state if enabled*/
|
||||
if(lv_indev_get_scroll_obj(param) == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) {
|
||||
if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED);
|
||||
else lv_obj_clear_state(obj, LV_STATE_CHECKED);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST) {
|
||||
else if(e == LV_EVENT_PRESS_LOST) {
|
||||
lv_obj_clear_state(obj, LV_STATE_PRESSED);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
else if(e == LV_EVENT_KEY) {
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) {
|
||||
uint32_t state = 0;
|
||||
char c = *((char *)param);
|
||||
char c = *((char *)lv_event_get_param());
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
lv_obj_add_state(obj, LV_STATE_CHECKED);
|
||||
state = 1;
|
||||
@ -899,11 +929,11 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
lv_obj_clear_state(obj, LV_STATE_CHECKED);
|
||||
state = 0;
|
||||
}
|
||||
res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return res;
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &state);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS) {
|
||||
else if(e == LV_EVENT_FOCUSED) {
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS)) {
|
||||
lv_obj_scroll_to_view_recursive(obj, LV_ANIM_ON);
|
||||
}
|
||||
@ -929,21 +959,22 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
lv_obj_clear_state(obj, LV_STATE_EDITED);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_SCROLL_BEGIN) {
|
||||
else if(e == LV_EVENT_SCROLL_BEGIN) {
|
||||
lv_obj_add_state(obj, LV_STATE_SCROLLED);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_SCROLL_END) {
|
||||
else if(e == LV_EVENT_SCROLL_END) {
|
||||
lv_obj_clear_state(obj, LV_STATE_SCROLLED);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
else if(e == LV_EVENT_DEFOCUSED) {
|
||||
/*if using focus mode, change target to parent*/
|
||||
obj = lv_obj_get_focused_obj(obj);
|
||||
|
||||
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED | LV_STATE_FOCUS_KEY);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_COORD_CHG) {
|
||||
else if(e == LV_EVENT_COORD_CHANGED) {
|
||||
bool w_new = true;
|
||||
bool h_new = true;
|
||||
void * param = lv_event_get_param();
|
||||
if(param) {
|
||||
if(lv_area_get_width(param) == lv_obj_get_width(obj)) w_new = false;
|
||||
if(lv_area_get_height(param) == lv_obj_get_height(obj)) h_new = false;
|
||||
@ -991,34 +1022,30 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CHILD_CHG) {
|
||||
else if(e == LV_EVENT_CHILD_CHANGED) {
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
|
||||
if(obj->w_set == LV_SIZE_CONTENT || obj->h_set == LV_SIZE_CONTENT) {
|
||||
lv_obj_set_size(obj, obj->w_set, obj->h_set);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_BASE_DIR_CHG) {
|
||||
/* The layout might depend on the base dir.
|
||||
* E.g. the first is element is on the left or right*/
|
||||
else if(e == LV_EVENT_BASE_DIR_CHANGED) {
|
||||
/*The layout might depend on the base dir.
|
||||
*E.g. the first is element is on the left or right*/
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_SCROLL) {
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_SCROLL_END) {
|
||||
else if(e == LV_EVENT_SCROLL_END) {
|
||||
if(lv_obj_get_scrollbar_mode(obj) == LV_SCROLLBAR_MODE_ACTIVE) {
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t * s = param;
|
||||
else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t * s = lv_event_get_param();
|
||||
lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN);
|
||||
*s = LV_MAX(*s, d);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
/* Padding might have changed so the layout should be recalculated*/
|
||||
else if(e == LV_EVENT_STYLE_CHANGED) {
|
||||
/*Padding might have changed so the layout should be recalculated*/
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
|
||||
/*Reposition non grid objects on by one*/
|
||||
@ -1035,7 +1062,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
}
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
}
|
||||
return res;
|
||||
else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST || e == LV_EVENT_COVER_CHECK) {
|
||||
lv_obj_draw(obj, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1114,7 +1143,7 @@ static void base_dir_refr_children(lv_obj_t * obj)
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
if(lv_obj_get_base_dir(child) == LV_BIDI_DIR_INHERIT) {
|
||||
lv_signal_send(child, LV_SIGNAL_BASE_DIR_CHG, NULL);
|
||||
lv_event_send(child, LV_EVENT_BASE_DIR_CHANGED, NULL);
|
||||
base_dir_refr_children(child);
|
||||
}
|
||||
}
|
||||
|
@ -42,40 +42,49 @@ struct _lv_obj_t;
|
||||
* Type of event being sent to the object.
|
||||
*/
|
||||
typedef enum {
|
||||
/** Input device events*/
|
||||
LV_EVENT_PRESSED, /**< The object has been pressed*/
|
||||
LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
||||
LV_EVENT_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
||||
LV_EVENT_SHORT_CLICKED, /**< User pressed object for a short period of time, then released it. Not called if scrolled. */
|
||||
LV_EVENT_PRESS_LOST, /**< User is still being pressed but slid cursor/finger off of the object */
|
||||
LV_EVENT_SHORT_CLICKED, /**< User pressed object for a short period of time, then released it. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every
|
||||
`LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every `LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if scrolled.*/
|
||||
LV_EVENT_CLICKED, /**< Called on release if not scrolled (regardless to long press)*/
|
||||
LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/
|
||||
LV_EVENT_SCROLL_BEGIN,
|
||||
LV_EVENT_SCROLL_END,
|
||||
LV_EVENT_SCROLL,
|
||||
LV_EVENT_GESTURE, /**< The object has been gesture*/
|
||||
LV_EVENT_KEY,
|
||||
LV_EVENT_FOCUSED,
|
||||
LV_EVENT_DEFOCUSED,
|
||||
LV_EVENT_LEAVE,
|
||||
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */
|
||||
LV_EVENT_INSERT,
|
||||
LV_EVENT_REFRESH,
|
||||
LV_EVENT_DELETE, /**< Object is being deleted */
|
||||
LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins*/
|
||||
LV_EVENT_SCROLL_END, /**< Scrolling ends*/
|
||||
LV_EVENT_SCROLL, /**< Scrolling*/
|
||||
LV_EVENT_GESTURE, /**< Gesture detected*/
|
||||
LV_EVENT_KEY, /**< A key is sent to the object*/
|
||||
LV_EVENT_FOCUSED, /**< Focused */
|
||||
LV_EVENT_DEFOCUSED, /**< Defocused*/
|
||||
LV_EVENT_LEAVE, /**< Defocused but still selected*/
|
||||
LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing*/
|
||||
|
||||
LV_EVENT_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area */
|
||||
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Draw extras on the object */
|
||||
/** Drawing events*/
|
||||
LV_EVENT_COVER_CHECK, /**< Check if the object fully covers an area*/
|
||||
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow)*/
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase*/
|
||||
LV_EVENT_DRAW_MAIN, /**< Perform the main drawing*/
|
||||
LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase*/
|
||||
LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_PART_BEGIN, /**< Starting to draw a part*/
|
||||
LV_EVENT_DRAW_PART_END, /**< Finishing to draw a part*/
|
||||
|
||||
LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
LV_EVENT_DRAW_MAIN_END,
|
||||
LV_EVENT_DRAW_POST_BEGIN,
|
||||
LV_EVENT_DRAW_POST_END,
|
||||
LV_EVENT_DRAW_PART_BEGIN,
|
||||
LV_EVENT_DRAW_PART_END,
|
||||
|
||||
LV_EVENT_READY, /**< A process has finished */
|
||||
LV_EVENT_CANCEL, /**< A process has been cancelled */
|
||||
/** General events*/
|
||||
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/
|
||||
LV_EVENT_INSERT, /**< A text is inserted to the object*/
|
||||
LV_EVENT_REFRESH, /**< Notify the object to refresh something on it (for the user)*/
|
||||
LV_EVENT_DELETE, /**< Object is being deleted*/
|
||||
LV_EVENT_READY, /**< A process has finished*/
|
||||
LV_EVENT_CANCEL, /**< A process has been cancelled */
|
||||
LV_EVENT_CHILD_CHANGED, /**< Child was removed/added*/
|
||||
LV_EVENT_COORD_CHANGED, /**< Object coordinates/size have changed*/
|
||||
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
|
||||
LV_EVENT_BASE_DIR_CHANGED, /**< The base dir has changed*/
|
||||
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
_LV_EVENT_LAST /** Number of default events*/
|
||||
}lv_event_t;
|
||||
@ -96,45 +105,6 @@ typedef struct {
|
||||
* EVENTS
|
||||
*---------------------*/
|
||||
|
||||
|
||||
/** Signals are for use by the object itself or to extend the object's functionality.
|
||||
* They determine a widget with a given type should behave.
|
||||
* Applications should use ::lv_obj_set_event_cb to be notified of events that occur
|
||||
* on the object. */
|
||||
typedef enum {
|
||||
/*General signals*/
|
||||
LV_SIGNAL_CHILD_CHG, /**< Child was removed/added */
|
||||
LV_SIGNAL_COORD_CHG, /**< Object coordinates/size have changed */
|
||||
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */
|
||||
LV_SIGNAL_BASE_DIR_CHG, /**< The base dir has changed*/
|
||||
LV_SIGNAL_REFR_EXT_DRAW_SIZE, /**< Object's extra padding has changed */
|
||||
LV_SIGNAL_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
/*Input device related*/
|
||||
LV_SIGNAL_HIT_TEST, /**< Advanced hit-testing */
|
||||
LV_SIGNAL_PRESSED, /**< The object has been pressed*/
|
||||
LV_SIGNAL_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
||||
LV_SIGNAL_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
||||
LV_SIGNAL_RELEASED, /**< User pressed object for a short period of time, then released it. Not called if scrolled. */
|
||||
LV_SIGNAL_LONG_PRESS, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if scrolled.*/
|
||||
LV_SIGNAL_LONG_PRESS_REP, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every `LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if scrolled.*/
|
||||
LV_SIGNAL_SCROLL_BEGIN, /**< The scrolling has just begun */
|
||||
LV_SIGNAL_SCROLL, /**< The object has been scrolled */
|
||||
LV_SIGNAL_SCROLL_END, /**< The scrolling has ended */
|
||||
LV_SIGNAL_GESTURE, /**< The object has been gesture*/
|
||||
LV_SIGNAL_LEAVE, /**< Another object is clicked or chosen via an input device */
|
||||
LV_SIGNAL_FOCUS, /**< The object was focused */
|
||||
LV_SIGNAL_DEFOCUS, /**< The object was de-focused */
|
||||
LV_SIGNAL_CONTROL, /**< Send a (control) character to the widget */
|
||||
} lv_signal_t;
|
||||
|
||||
/**
|
||||
* @brief Signal callback.
|
||||
* Signals are used to notify the widget of the action related to the object.
|
||||
* For details, see ::lv_signal_t.
|
||||
*/
|
||||
typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Possible states of a widget.
|
||||
* OR-ed values are possible
|
||||
@ -155,7 +125,7 @@ enum {
|
||||
LV_STATE_USER_3 = 0x4000,
|
||||
LV_STATE_USER_4 = 0x8000,
|
||||
|
||||
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states */
|
||||
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_state_t;
|
||||
@ -169,8 +139,8 @@ typedef uint16_t lv_state_t;
|
||||
enum {
|
||||
LV_PART_MAIN, /**< A background like rectangle*/
|
||||
LV_PART_SCROLLBAR, /**< The scrollbar(s)*/
|
||||
LV_PART_INDICATOR, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox */
|
||||
LV_PART_KNOB, /**< Like handle to grab to adjust the value */
|
||||
LV_PART_INDICATOR, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/
|
||||
LV_PART_KNOB, /**< Like handle to grab to adjust the value*/
|
||||
LV_PART_SELECTED, /**< Indicate the currently selected option or section*/
|
||||
LV_PART_ITEMS, /**< Used if the widget has multiple similar elements (e.g. tabel cells)*/
|
||||
LV_PART_TICKS, /**< Ticks on scale e.g. for a chart or meter*/
|
||||
@ -185,7 +155,7 @@ enum {
|
||||
LV_PART_CUSTOM_7, /**< Extension point for custom widgets*/
|
||||
LV_PART_CUSTOM_8, /**< Extension point for custom widgets*/
|
||||
|
||||
LV_PART_ANY = 0xFF, /**< Special value can be used in some functions to target all parts */
|
||||
LV_PART_ANY = 0xFF, /**< Special value can be used in some functions to target all parts*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_part_t;
|
||||
@ -195,24 +165,24 @@ typedef uint16_t lv_part_t;
|
||||
* OR-ed values are possible
|
||||
*/
|
||||
enum {
|
||||
LV_OBJ_FLAG_HIDDEN = (1 << 0), /**< Make the object hidden. (Like it wasn't there at all) */
|
||||
LV_OBJ_FLAG_CLICKABLE = (1 << 1), /**< Make the object clickable by the input devices */
|
||||
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1 << 2), /**< Add focused state to the object when clicked */
|
||||
LV_OBJ_FLAG_CHECKABLE = (1 << 3), /**< Toggle checked state when the object is clicked */
|
||||
LV_OBJ_FLAG_HIDDEN = (1 << 0), /**< Make the object hidden. (Like it wasn't there at all)*/
|
||||
LV_OBJ_FLAG_CLICKABLE = (1 << 1), /**< Make the object clickable by the input devices*/
|
||||
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1 << 2), /**< Add focused state to the object when clicked*/
|
||||
LV_OBJ_FLAG_CHECKABLE = (1 << 3), /**< Toggle checked state when the object is clicked*/
|
||||
LV_OBJ_FLAG_SCROLLABLE = (1 << 4), /**< Make the object scrollable*/
|
||||
LV_OBJ_FLAG_SCROLL_ELASTIC = (1 << 5), /**< Allow scrolling inside but with slower speed*/
|
||||
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1 << 6), /**< Make the object scroll further when "thrown"*/
|
||||
LV_OBJ_FLAG_SCROLL_ONE = (1 << 7), /**< Allow scrolling only one snapable children*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /**< Allow propagating the scroll to a parent */
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /**< Allow propagating the scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1 << 9), /**< Automatically scroll object to make it visible when focused*/
|
||||
LV_OBJ_FLAG_SNAPABLE = (1 << 10), /**< If scroll snap is enabled on the parent it can snap to this object*/
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1 << 11), /**< Keep the object pressed even if the press slid from the object */
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12), /**< Propagate the events to the parent too */
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13), /**< Propagate the gestures to the parent */
|
||||
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14), /**< Propagate the focus to the parent */
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1 << 15), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners. */
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 16), /**< Make the object position-able by the layouts */
|
||||
LV_OBJ_FLAG_FLOATING = (1 << 17), /**< Do not scroll the object when the parent scrolls and ignore layout */
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1 << 11), /**< Keep the object pressed even if the press slid from the object*/
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12), /**< Propagate the events to the parent too*/
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13), /**< Propagate the gestures to the parent*/
|
||||
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14), /**< Propagate the focus to the parent*/
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1 << 15), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 16), /**< Make the object position-able by the layouts*/
|
||||
LV_OBJ_FLAG_FLOATING = (1 << 17), /**< Do not scroll the object when the parent scrolls and ignore layout*/
|
||||
|
||||
LV_OBJ_FLAG_LAYOUT_1 = (1 << 23), /** Custom flag, free to use by layouts*/
|
||||
LV_OBJ_FLAG_LAYOUT_2 = (1 << 24), /** Custom flag, free to use by layouts*/
|
||||
@ -246,23 +216,23 @@ extern const lv_obj_class_t lv_obj_class;
|
||||
*/
|
||||
typedef struct {
|
||||
struct _lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
|
||||
uint32_t child_cnt; /**< Number of children */
|
||||
uint32_t child_cnt; /**< Number of children*/
|
||||
lv_group_t * group_p;
|
||||
|
||||
const lv_layout_dsc_t * layout_dsc; /**< Pointer to the layout descriptor*/
|
||||
|
||||
lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array */
|
||||
lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array*/
|
||||
lv_point_t scroll; /**< The current X/Y scroll offset*/
|
||||
|
||||
uint8_t ext_click_pad; /**< Extra click padding in all direction */
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing. */
|
||||
uint8_t ext_click_pad; /**< Extra click padding in all direction*/
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
|
||||
|
||||
lv_scrollbar_mode_t scrollbar_mode :2; /**< How to display scrollbars*/
|
||||
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snapable children horizontally*/
|
||||
lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snapable children horizontally*/
|
||||
lv_dir_t scroll_dir :4; /**< The allowed scroll direction(s)*/
|
||||
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
|
||||
uint8_t event_dsc_cnt; /**< Number of event callabcks stored in `event_cb` array */
|
||||
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object*/
|
||||
uint8_t event_dsc_cnt; /**< Number of event callabcks stored in `event_cb` array*/
|
||||
}lv_obj_spec_attr_t;
|
||||
|
||||
typedef struct _lv_obj_t{
|
||||
@ -286,6 +256,11 @@ typedef struct {
|
||||
bool result;
|
||||
} lv_hit_test_info_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_res_t res;
|
||||
const lv_area_t * clip_area;
|
||||
} lv_cover_check_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@ -329,6 +304,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
|
||||
*/
|
||||
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param);
|
||||
|
||||
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e);
|
||||
|
||||
/**
|
||||
* Get the `param` parameter of the current event
|
||||
* @return the `param` parameter
|
||||
@ -361,14 +338,6 @@ uint32_t lv_event_register_id(void);
|
||||
*/
|
||||
void _lv_event_mark_deleted(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Send an event to the object
|
||||
* @param obj pointer to an object
|
||||
* @param event the type of the event from `lv_event_t`.
|
||||
* @return LV_RES_OK or LV_RES_INV
|
||||
*/
|
||||
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
@ -554,7 +523,7 @@ bool lv_obj_is_valid(const lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_H*/
|
||||
|
@ -55,9 +55,9 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p
|
||||
lv_obj_construct(obj, parent, copy);
|
||||
|
||||
if(parent) {
|
||||
/* Send a signal to the parent to notify it about the new child.
|
||||
* Also triggers layout update*/
|
||||
lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
/*Send a Call the ancestor's event handler to the parent to notify it about the new child.
|
||||
*Also triggers layout update*/
|
||||
lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
/*Invalidate the area if not screen created*/
|
||||
lv_obj_invalidate(obj);
|
||||
@ -83,35 +83,6 @@ void _lv_obj_destruct(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_obj_signal_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
{
|
||||
if(class_p == NULL) return LV_RES_OK;
|
||||
|
||||
/*Find a base in which signal_cb is set*/
|
||||
const lv_obj_class_t * base = class_p->base_class;
|
||||
while(base && base->signal_cb == NULL) base = base->base_class;
|
||||
|
||||
if(base == NULL) return LV_RES_OK;
|
||||
if(base->signal_cb == NULL) return LV_RES_OK;
|
||||
|
||||
return base->signal_cb(obj, sign, param);
|
||||
}
|
||||
|
||||
lv_draw_res_t lv_obj_draw_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode)
|
||||
{
|
||||
if(class_p == NULL) return LV_DRAW_RES_OK;
|
||||
|
||||
/*Find a base in which draw_cb is set*/
|
||||
const lv_obj_class_t * base = class_p->base_class;
|
||||
while(base && base->draw_cb == NULL) base = base->base_class;
|
||||
|
||||
if(base == NULL) return LV_DRAW_RES_OK;
|
||||
if(base->draw_cb == NULL) return LV_DRAW_RES_OK;
|
||||
|
||||
return base->draw_cb(obj, clip_area, mode);
|
||||
}
|
||||
|
||||
bool lv_obj_is_editable(struct _lv_obj_t * obj)
|
||||
{
|
||||
const lv_obj_class_t * class_p = obj->class_p;
|
||||
@ -153,7 +124,7 @@ static uint32_t get_instance_size(const lv_obj_class_t * class_p)
|
||||
const lv_obj_class_t * base = class_p;
|
||||
while(base && base->instance_size == 0) base = base->base_class;
|
||||
|
||||
if(base == NULL) return 0; /*Never happens: set at least in `lv_obj` class */
|
||||
if(base == NULL) return 0; /*Never happens: set at least in `lv_obj` class*/
|
||||
|
||||
return base->instance_size;
|
||||
}
|
||||
|
@ -41,9 +41,8 @@ typedef struct _lv_obj_class_t{
|
||||
const struct _lv_obj_class_t * base_class;
|
||||
void (*constructor_cb)(struct _lv_obj_t * obj, const struct _lv_obj_t * copy);
|
||||
void (*destructor_cb)(struct _lv_obj_t * obj);
|
||||
lv_signal_cb_t signal_cb; /**< Object type specific signal function*/
|
||||
lv_draw_cb_t draw_cb; /**< Object type specific draw function*/
|
||||
uint32_t editable :2; /**< Value from ::lv_obj_class_editable_t */
|
||||
lv_event_cb_t event_cb; /**< Object type specific event function*/
|
||||
uint32_t editable :2; /**< Value from ::lv_obj_class_editable_t*/
|
||||
uint32_t instance_size :20;
|
||||
}lv_obj_class_t;
|
||||
|
||||
@ -62,10 +61,6 @@ struct _lv_obj_t * lv_obj_create_from_class(const struct _lv_obj_class_t * class
|
||||
|
||||
void _lv_obj_destruct(struct _lv_obj_t * obj);
|
||||
|
||||
lv_res_t lv_obj_signal_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
|
||||
lv_draw_res_t lv_obj_draw_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode);
|
||||
|
||||
bool lv_obj_is_editable(struct _lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
@ -74,7 +69,7 @@ bool lv_obj_is_editable(struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_CLASS_H*/
|
||||
|
@ -387,7 +387,6 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
|
||||
|
||||
lv_coord_t s_old = _lv_obj_get_ext_draw_size(obj);
|
||||
lv_coord_t s_new = 0;
|
||||
lv_signal_send(obj, LV_SIGNAL_REFR_EXT_DRAW_SIZE, &s_new);
|
||||
lv_event_send(obj, LV_EVENT_REFR_EXT_DRAW_SIZE, &s_new);
|
||||
|
||||
if(s_new != s_old) lv_obj_invalidate(obj);
|
||||
@ -396,8 +395,8 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
|
||||
if(obj->spec_attr) {
|
||||
obj->spec_attr->ext_draw_size = s_new;
|
||||
}
|
||||
/* Allocate spec. attrs. only if the result is not zero.
|
||||
* Zero is the default value if the spec. attr. are not defined. */
|
||||
/*Allocate spec. attrs. only if the result is not zero.
|
||||
*Zero is the default value if the spec. attr. are not defined.*/
|
||||
else if(s_new != 0) {
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
obj->spec_attr->ext_draw_size = s_new;
|
||||
|
@ -25,9 +25,9 @@ extern "C" {
|
||||
|
||||
struct _lv_obj_t;
|
||||
|
||||
/** Design results */
|
||||
/** Design results*/
|
||||
typedef enum {
|
||||
LV_DRAW_RES_OK, /**< Draw ready */
|
||||
LV_DRAW_RES_OK, /**< Draw ready*/
|
||||
LV_DRAW_RES_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is fully covered*/
|
||||
LV_DRAW_RES_NOT_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is not covered*/
|
||||
LV_DRAW_RES_MASKED, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is masked out (children also not cover)*/
|
||||
@ -53,20 +53,6 @@ typedef struct
|
||||
const void * sub_part_ptr;
|
||||
}lv_obj_draw_dsc_t;
|
||||
|
||||
/** Design modes */
|
||||
enum {
|
||||
LV_DRAW_MODE_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area */
|
||||
LV_DRAW_MODE_MAIN_DRAW, /**< Draw the main portion of the object */
|
||||
LV_DRAW_MODE_POST_DRAW, /**< Draw extras on the object */
|
||||
};
|
||||
typedef uint8_t lv_draw_mode_t;
|
||||
|
||||
/**
|
||||
* The draw callback is used to draw the object on the screen.
|
||||
* It accepts the object, a mask area, and the mode in which to draw the object.
|
||||
*/
|
||||
typedef lv_draw_res_t (*lv_draw_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@ -137,7 +123,7 @@ lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint8_t part);
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_dsc_t * dsc, const lv_area_t * clip_area);
|
||||
|
||||
/**
|
||||
* Send a 'LV_SIGNAL_REFR_EXT_DRAW_SIZE' signal to the object to refresh the value of the extended draw size.
|
||||
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
|
||||
* The result will be saved in `obj`.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
@ -155,7 +141,7 @@ lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_DRAW_H*/
|
||||
|
@ -80,8 +80,8 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
obj->w_set = w;
|
||||
obj->h_set = h;
|
||||
|
||||
/* If the width or height is set to special layout related value save them in w_set and h_set
|
||||
* but use the current size on the object width*/
|
||||
/*If the width or height is set to special layout related value save them in w_set and h_set
|
||||
*but use the current size on the object width*/
|
||||
if(LV_COORD_IS_LAYOUT(w)) w = lv_obj_get_width(obj);
|
||||
if(LV_COORD_IS_LAYOUT(h)) h = lv_obj_get_height(obj);
|
||||
|
||||
@ -187,9 +187,9 @@ void lv_obj_update_layout(lv_obj_t * obj)
|
||||
layout_update_core(obj);
|
||||
}while(scr->layout_inv); /*Repeat until there where layout invalidations*/
|
||||
|
||||
/* Restore the global state because other calls of this function needs this info too.
|
||||
* Other calls might use different start object, but they need to know if there is dirty layout somewhere.
|
||||
* However if the screen was updated it's sure that all layouts are ready. */
|
||||
/*Restore the global state because other calls of this function needs this info too.
|
||||
*Other calls might use different start object, but they need to know if there is dirty layout somewhere.
|
||||
*However if the screen was updated it's sure that all layouts are ready.*/
|
||||
if(obj != scr) scr->layout_inv = 1;
|
||||
|
||||
}
|
||||
@ -435,14 +435,14 @@ lv_coord_t lv_obj_get_width_visible(const lv_obj_t * obj)
|
||||
lv_coord_t lv_obj_get_self_width(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_point_t p = {0, LV_COORD_MIN};
|
||||
lv_signal_send((lv_obj_t * )obj, LV_SIGNAL_GET_SELF_SIZE, &p);
|
||||
lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
return p.x;
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_self_height(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_point_t p = {LV_COORD_MIN, 0};
|
||||
lv_signal_send((lv_obj_t * )obj, LV_SIGNAL_GET_SELF_SIZE, &p);
|
||||
lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
return p.y;
|
||||
}
|
||||
|
||||
@ -472,9 +472,9 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
diff.x = x - obj->coords.x1;
|
||||
diff.y = y - obj->coords.y1;
|
||||
|
||||
/* Do nothing if the position is not changed */
|
||||
/* It is very important else recursive positioning can
|
||||
* occur without position change*/
|
||||
/*Do nothing if the position is not changed*/
|
||||
/*It is very important else recursive positioning can
|
||||
*occur without position change*/
|
||||
if(diff.x == 0 && diff.y == 0) return;
|
||||
|
||||
/*Invalidate the original area*/
|
||||
@ -490,8 +490,8 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
if(parent) {
|
||||
lv_obj_get_coords_fit(parent, &parent_fit_area);
|
||||
|
||||
/* If the object is already out of the parent and its position is changes
|
||||
* surely the scrollbars also changes so invalidate them*/
|
||||
/*If the object is already out of the parent and its position is changes
|
||||
*surely the scrollbars also changes so invalidate them*/
|
||||
on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
|
||||
if(!on1) lv_obj_scrollbar_invalidate(parent);
|
||||
}
|
||||
@ -504,16 +504,16 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
lv_obj_move_children_by(obj, diff.x, diff.y, false);
|
||||
|
||||
/*Inform the object about its new coordinates*/
|
||||
lv_signal_send(obj, LV_SIGNAL_COORD_CHG, &ori);
|
||||
lv_event_send(obj, LV_EVENT_COORD_CHANGED, &ori);
|
||||
|
||||
/*Send a signal to the parent too*/
|
||||
if(parent && notify) lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
/*Send a Call the ancestor's event handler to the parent too*/
|
||||
if(parent && notify) lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/* If the object was out of the parent invalidate the new scrollbar area too.
|
||||
* If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
if(parent) {
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
@ -652,7 +652,7 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point)
|
||||
lv_hit_test_info_t hit_info;
|
||||
hit_info.point = point;
|
||||
hit_info.result = true;
|
||||
lv_signal_send(obj, LV_SIGNAL_HIT_TEST, &hit_info);
|
||||
lv_event_send(obj, LV_EVENT_HIT_TEST, &hit_info);
|
||||
return hit_info.result;
|
||||
}
|
||||
|
||||
@ -677,13 +677,13 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent == NULL) return false;
|
||||
|
||||
/* If the size is managed by the layout don't let to overwrite it.*/
|
||||
/*If the size is managed by the layout don't let to overwrite it.*/
|
||||
if(obj->w_set == LV_SIZE_LAYOUT) w = lv_obj_get_width(obj);
|
||||
if(obj->h_set == LV_SIZE_LAYOUT) h = lv_obj_get_height(obj);
|
||||
|
||||
/* Do nothing if the size is not changed */
|
||||
/* It is very important else recursive resizing can
|
||||
* occur without size change*/
|
||||
/*Do nothing if the size is not changed*/
|
||||
/*It is very important else recursive resizing can
|
||||
*occur without size change*/
|
||||
if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) {
|
||||
return false;
|
||||
}
|
||||
@ -698,13 +698,13 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
lv_area_t parent_fit_area;
|
||||
lv_obj_get_coords_fit(parent, &parent_fit_area);
|
||||
|
||||
/* If the object is already out of the parent and its position is changes
|
||||
* surely the scrollbars also changes so invalidate them*/
|
||||
/*If the object is already out of the parent and its position is changes
|
||||
*surely the scrollbars also changes so invalidate them*/
|
||||
bool on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
|
||||
if(!on1) lv_obj_scrollbar_invalidate(parent);
|
||||
|
||||
/* Set the length and height
|
||||
* Be sure the content is not scrolled in an invalid position on the new size*/
|
||||
/*Set the length and height
|
||||
*Be sure the content is not scrolled in an invalid position on the new size*/
|
||||
obj->coords.y2 = obj->coords.y1 + h - 1;
|
||||
if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) {
|
||||
obj->coords.x1 = obj->coords.x2 - w + 1;
|
||||
@ -713,17 +713,17 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
obj->coords.x2 = obj->coords.x1 + w - 1;
|
||||
}
|
||||
|
||||
/*Send a signal to the object with its new coordinates*/
|
||||
lv_signal_send(obj, LV_SIGNAL_COORD_CHG, &ori);
|
||||
/*Send a Call the ancestor's event handler to the object with its new coordinates*/
|
||||
lv_event_send(obj, LV_EVENT_COORD_CHANGED, &ori);
|
||||
|
||||
/*Send a signal to the parent too*/
|
||||
if(parent != NULL) lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
/*Send a Call the ancestor's event handler to the parent too*/
|
||||
if(parent != NULL) lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/* If the object was out of the parent invalidate the new scrollbar area too.
|
||||
* If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
return true;
|
||||
|
@ -327,7 +327,7 @@ bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_POS_H*/
|
||||
|
@ -158,8 +158,8 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
/* Normally can't scroll the object out on the left.
|
||||
* So simply use the current scroll position as "left size"*/
|
||||
/*Normally can't scroll the object out on the left.
|
||||
*So simply use the current scroll position as "left size"*/
|
||||
if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) {
|
||||
if(obj->spec_attr == NULL) return 0;
|
||||
return -obj->spec_attr->scroll.x;
|
||||
@ -196,8 +196,8 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
/* With RTL base dir can't scroll to the object out on the right.
|
||||
* So simply use the current scroll position as "right size"*/
|
||||
/*With RTL base dir can't scroll to the object out on the right.
|
||||
*So simply use the current scroll position as "right size"*/
|
||||
if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) {
|
||||
if(obj->spec_attr == NULL) return 0;
|
||||
return obj->spec_attr->scroll.x;
|
||||
@ -254,9 +254,6 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
||||
|
||||
if(x) {
|
||||
lv_res_t res;
|
||||
res = lv_signal_send(obj, LV_SIGNAL_SCROLL_BEGIN, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
@ -273,9 +270,6 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
||||
|
||||
if(y) {
|
||||
lv_res_t res;
|
||||
res = lv_signal_send(obj, LV_SIGNAL_SCROLL_BEGIN, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
@ -541,7 +535,7 @@ static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
obj->spec_attr->scroll.y += y;
|
||||
|
||||
lv_obj_move_children_by(obj, x, y, true);
|
||||
lv_res_t res = lv_signal_send(obj, LV_SIGNAL_SCROLL, NULL);
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_SCROLL, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
@ -558,9 +552,6 @@ static void scroll_y_anim(void * obj, int32_t v)
|
||||
|
||||
static void scroll_anim_ready_cb(lv_anim_t * a)
|
||||
{
|
||||
lv_res_t res = lv_signal_send(a->var, LV_SIGNAL_SCROLL_END, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
lv_event_send(a->var, LV_EVENT_SCROLL_END, NULL);
|
||||
}
|
||||
|
||||
@ -636,7 +627,7 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove any pending scroll animations.*/
|
||||
/*Remove any pending scroll animations.*/
|
||||
lv_anim_del(parent, scroll_x_anim);
|
||||
lv_anim_del(parent, scroll_y_anim);
|
||||
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
@ -37,12 +37,12 @@ enum {
|
||||
typedef uint8_t lv_scrollbar_mode_t;
|
||||
|
||||
|
||||
/** Scroll span align options. Tells where to align the snapable children when scroll stops. */
|
||||
/** Scroll span align options. Tells where to align the snapable children when scroll stops.*/
|
||||
enum {
|
||||
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is */
|
||||
LV_SCROLL_SNAP_START, /**< Align to to the left/top */
|
||||
LV_SCROLL_SNAP_END, /**< Align to to the right/bottom */
|
||||
LV_SCROLL_SNAP_CENTER /**< Align to to the center */
|
||||
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/
|
||||
LV_SCROLL_SNAP_START, /**< Align to to the left/top*/
|
||||
LV_SCROLL_SNAP_END, /**< Align to to the right/bottom*/
|
||||
LV_SCROLL_SNAP_CENTER /**< Align to to the center*/
|
||||
};
|
||||
typedef uint8_t lv_scroll_snap_t;
|
||||
|
||||
@ -271,7 +271,7 @@ void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_SCROLL_H*/
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
#include LV_GC_INCLUDE
|
||||
#endif /* LV_ENABLE_GC */
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -89,7 +89,7 @@ void lv_obj_add_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_
|
||||
break;
|
||||
}
|
||||
|
||||
/*Now `i` is at the first normal style. Insert the new style before this */
|
||||
/*Now `i` is at the first normal style. Insert the new style before this*/
|
||||
|
||||
/*Allocate space for the new style and shift the rest of the style to the end*/
|
||||
obj->style_list.style_cnt++;
|
||||
@ -141,8 +141,8 @@ void lv_obj_remove_style(lv_obj_t * obj, uint32_t part, uint32_t state, lv_style
|
||||
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t));
|
||||
|
||||
deleted = true;
|
||||
/* The style from the current `i` index is removed, so `i` points to the next style.
|
||||
* Therefore it doesn't needs to be incremented*/
|
||||
/*The style from the current `i` index is removed, so `i` points to the next style.
|
||||
*Therefore it doesn't needs to be incremented*/
|
||||
}
|
||||
if(deleted) {
|
||||
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
@ -171,7 +171,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) {
|
||||
lv_signal_send(obj, LV_SIGNAL_STYLE_CHG, NULL); /*To update layout*/
|
||||
lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/
|
||||
} else if(prop & LV_STYLE_PROP_EXT_DRAW) {
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
}
|
||||
@ -266,7 +266,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8
|
||||
obj->state = new_state;
|
||||
|
||||
lv_obj_style_t * style_trans = get_trans_style(obj, part);
|
||||
lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value */
|
||||
lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value*/
|
||||
|
||||
if(prop == LV_STYLE_RADIUS) {
|
||||
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
|
||||
@ -419,8 +419,8 @@ static lv_style_t * get_local_style(lv_obj_t * obj, uint32_t part, uint32_t stat
|
||||
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t));
|
||||
|
||||
for(i = obj->style_list.style_cnt - 1; i > 0 ; i--) {
|
||||
/* Copy only normal styles (not local and transition).
|
||||
* The new local style will be added as the last local style*/
|
||||
/*Copy only normal styles (not local and transition).
|
||||
*The new local style will be added as the last local style*/
|
||||
if(obj->style_list.styles[i - 1].is_local || obj->style_list.styles[i - 1].is_trans) break;
|
||||
obj->style_list.styles[i] = obj->style_list.styles[i - 1];
|
||||
}
|
||||
@ -497,8 +497,8 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
|
||||
|
||||
if((obj_style->style->has_group & group) == 0) continue;
|
||||
|
||||
/* Be sure the style not specifies other state than the requested.
|
||||
* E.g. For HOVER+PRESS object state, HOVER style only is OK, but HOVER+FOCUS style is not*/
|
||||
/*Be sure the style not specifies other state than the requested.
|
||||
*E.g. For HOVER+PRESS object state, HOVER style only is OK, but HOVER+FOCUS style is not*/
|
||||
if((obj_style->state & state_inv)) continue;
|
||||
|
||||
/*Check only better candidates*/
|
||||
@ -569,7 +569,7 @@ static void refresh_children_style(lv_obj_t * obj)
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
lv_obj_invalidate(child);
|
||||
lv_signal_send(child, LV_SIGNAL_STYLE_CHG, NULL);
|
||||
lv_event_send(child, LV_EVENT_STYLE_CHANGED, NULL);
|
||||
lv_obj_invalidate(child);
|
||||
|
||||
refresh_children_style(child); /*Check children too*/
|
||||
@ -598,8 +598,8 @@ static bool trans_del(lv_obj_t * obj, uint8_t part, lv_style_prop_t prop, trans_
|
||||
tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
|
||||
if(tr->obj == obj && (part == tr->part || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ALL)) {
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
/*Remove the transitioned property from trans. style
|
||||
*to allow changing it by normal styles*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_list.style_cnt; i++) {
|
||||
if(obj->style_list.styles[i].is_trans && (part == LV_PART_ANY || obj->style_list.styles[i].part == part)) {
|
||||
@ -695,7 +695,7 @@ static void trans_anim_start_cb(lv_anim_t * a)
|
||||
tr->prop = prop_tmp;
|
||||
|
||||
lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->part);
|
||||
lv_style_set_prop(style_trans->style, tr->prop, tr->start_value); /*Be sure `trans_style` has a valid value */
|
||||
lv_style_set_prop(style_trans->style, tr->prop, tr->start_value); /*Be sure `trans_style` has a valid value*/
|
||||
|
||||
}
|
||||
|
||||
@ -705,9 +705,9 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
lv_obj_t * obj = tr->obj;
|
||||
lv_style_prop_t prop = tr->prop;
|
||||
|
||||
/* Remove the transitioned property from trans. style
|
||||
* if there no more transitions for this property
|
||||
* It allows changing it by normal styles*/
|
||||
/*Remove the transitioned property from trans. style
|
||||
*if there no more transitions for this property
|
||||
*It allows changing it by normal styles*/
|
||||
bool running = false;
|
||||
trans_t * tr_i;
|
||||
_LV_LL_READ(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) {
|
||||
|
@ -23,7 +23,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -212,7 +212,7 @@ static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, uint32_t par
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#if defined(LV_USER_DATA_FREE_INCLUDE)
|
||||
#include LV_USER_DATA_FREE_INCLUDE
|
||||
#endif /* LV_USE_USER_DATA_FREE */
|
||||
#endif /*LV_USE_USER_DATA_FREE*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -64,7 +64,7 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
|
||||
obj_del_core(obj);
|
||||
|
||||
/*Send a signal to the parent to notify it about the child delete*/
|
||||
/*Send a Call the ancestor's event handler to the parent to notify it about the child delete*/
|
||||
if(par) {
|
||||
/*Just to remove scroll animations if any*/
|
||||
lv_obj_scroll_to(par, 0, 0, LV_ANIM_OFF);
|
||||
@ -72,7 +72,7 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
par->spec_attr->scroll.x = 0;
|
||||
par->spec_attr->scroll.y = 0;
|
||||
}
|
||||
lv_signal_send(par, LV_SIGNAL_CHILD_CHG, NULL);
|
||||
lv_event_send(par, LV_EVENT_CHILD_CHANGED, NULL);
|
||||
}
|
||||
|
||||
/*Handle if the active screen was deleted*/
|
||||
@ -178,10 +178,10 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
}
|
||||
|
||||
/*Notify the original parent because one of its children is lost*/
|
||||
lv_signal_send(old_parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
lv_event_send(old_parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
@ -201,7 +201,7 @@ void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj;
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
}
|
||||
@ -221,7 +221,7 @@ void lv_obj_move_background(lv_obj_t * obj)
|
||||
parent->spec_attr->children[0] = obj;
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
}
|
||||
@ -349,7 +349,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL);
|
||||
lv_obj_enable_style_refresh(true);
|
||||
|
||||
/* Reset all input devices if the object to delete is used*/
|
||||
/*Reset all input devices if the object to delete is used*/
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) {
|
||||
@ -365,7 +365,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
||||
/* All children deleted. Now clean up the object specific data*/
|
||||
/*All children deleted. Now clean up the object specific data*/
|
||||
_lv_obj_destruct(obj);
|
||||
|
||||
/*Remove the screen for the screen list*/
|
||||
|
@ -141,7 +141,7 @@ uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_TREE_H*/
|
||||
|
@ -25,7 +25,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/* Draw translucent random colored areas on the invalidated (redrawn) areas*/
|
||||
/*Draw translucent random colored areas on the invalidated (redrawn) areas*/
|
||||
#define MASK_AREA_DEBUG 0
|
||||
|
||||
/**********************
|
||||
@ -43,7 +43,6 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
|
||||
static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p);
|
||||
static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p);
|
||||
static void draw_buf_flush(void);
|
||||
static lv_draw_res_t call_draw_cb(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode);
|
||||
static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p);
|
||||
|
||||
/**********************
|
||||
@ -192,7 +191,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
disp_refr = tmr->user_data;
|
||||
|
||||
#if LV_USE_PERF_MONITOR == 0
|
||||
/* Ensure the timer does not run again automatically.
|
||||
/**
|
||||
* Ensure the timer does not run again automatically.
|
||||
* This is done before refreshing in case refreshing invalidates something else.
|
||||
*/
|
||||
lv_timer_pause(tmr, true);
|
||||
@ -561,8 +561,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
lv_refr_obj_and_children(lv_disp_get_layer_top(disp_refr), &start_mask);
|
||||
lv_refr_obj_and_children(lv_disp_get_layer_sys(disp_refr), &start_mask);
|
||||
|
||||
/* In true double buffered mode flush only once when all areas were rendered.
|
||||
* In normal mode flush after every area */
|
||||
/*In true double buffered mode flush only once when all areas were rendered.
|
||||
*In normal mode flush after every area*/
|
||||
if(lv_disp_is_true_double_buf(disp_refr) == false) {
|
||||
draw_buf_flush();
|
||||
}
|
||||
@ -578,20 +578,13 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
/*If this object is fully cover the draw area check the children too*/
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) == false) {
|
||||
lv_draw_res_t draw_res = call_draw_cb(obj, area_p, LV_DRAW_MODE_COVER_CHECK);
|
||||
if(draw_res == LV_DRAW_RES_MASKED) return NULL;
|
||||
|
||||
lv_draw_res_t event_draw_res = LV_DRAW_RES_OK;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &event_draw_res);
|
||||
if(event_draw_res == LV_DRAW_RES_MASKED) return NULL;
|
||||
if(event_draw_res == LV_DRAW_RES_NOT_COVER) draw_res = LV_DRAW_RES_NOT_COVER;
|
||||
|
||||
|
||||
if(draw_res == LV_DRAW_RES_COVER && lv_obj_get_style_opa(obj, LV_PART_MAIN) != LV_OPA_COVER) {
|
||||
draw_res = LV_DRAW_RES_NOT_COVER;
|
||||
}
|
||||
lv_cover_check_info_t info;
|
||||
info.res = LV_DRAW_RES_COVER;
|
||||
info.clip_area = area_p;
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_DRAW_RES_MASKED) return NULL;
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
@ -606,7 +599,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
|
||||
/*If no better children use this object*/
|
||||
if(found_p == NULL) {
|
||||
if(draw_res == LV_DRAW_RES_COVER) {
|
||||
if(info.res == LV_DRAW_RES_COVER) {
|
||||
found_p = obj;
|
||||
}
|
||||
}
|
||||
@ -622,16 +615,16 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
*/
|
||||
static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
{
|
||||
/* Normally always will be a top_obj (at least the screen)
|
||||
* but in special cases (e.g. if the screen has alpha) it won't.
|
||||
* In this case use the screen directly */
|
||||
/*Normally always will be a top_obj (at least the screen)
|
||||
*but in special cases (e.g. if the screen has alpha) it won't.
|
||||
*In this case use the screen directly*/
|
||||
if(top_p == NULL) top_p = lv_disp_get_scr_act(disp_refr);
|
||||
if(top_p == NULL) return; /*Shouldn't happen*/
|
||||
|
||||
/*Refresh the top object and its children*/
|
||||
lv_refr_obj(top_p, mask_p);
|
||||
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj */
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj*/
|
||||
lv_obj_t * par;
|
||||
lv_obj_t * border_p = top_p;
|
||||
|
||||
@ -653,7 +646,7 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
|
||||
/*Call the post draw draw function of the parents of the to object*/
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_BEGIN, (void*)mask_p);
|
||||
call_draw_cb(par, mask_p, LV_DRAW_MODE_POST_DRAW);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST, (void*)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_END, (void*)mask_p);
|
||||
|
||||
/*The new border will be the last parents,
|
||||
@ -674,9 +667,9 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
/*Do not refresh hidden objects*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
|
||||
|
||||
bool union_ok; /* Store the return value of area_union */
|
||||
/* Truncate the original mask to the coordinates of the parent
|
||||
* because the parent and its children are visible only here */
|
||||
bool union_ok; /*Store the return value of area_union*/
|
||||
/*Truncate the original mask to the coordinates of the parent
|
||||
*because the parent and its children are visible only here*/
|
||||
lv_area_t obj_mask;
|
||||
lv_area_t obj_ext_mask;
|
||||
lv_area_t obj_area;
|
||||
@ -690,9 +683,9 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
/* Redraw the object */
|
||||
/*Redraw the object*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_BEGIN, &obj_ext_mask);
|
||||
call_draw_cb(obj, &obj_ext_mask, LV_DRAW_MODE_MAIN_DRAW);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, &obj_ext_mask);
|
||||
|
||||
#if MASK_AREA_DEBUG
|
||||
@ -721,11 +714,11 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
child_area.y1 -= ext_size;
|
||||
child_area.x2 += ext_size;
|
||||
child_area.y2 += ext_size;
|
||||
/* Get the union (common parts) of original mask (from obj)
|
||||
* and its child */
|
||||
/*Get the union (common parts) of original mask (from obj)
|
||||
*and its child*/
|
||||
union_ok = _lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
|
||||
/*If the parent and the child has common area then refresh the child */
|
||||
/*If the parent and the child has common area then refresh the child*/
|
||||
if(union_ok) {
|
||||
/*Refresh the next children*/
|
||||
lv_refr_obj(child, &mask_child);
|
||||
@ -733,9 +726,9 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
}
|
||||
}
|
||||
|
||||
/* If all the children are redrawn make 'post draw' draw */
|
||||
/*If all the children are redrawn make 'post draw' draw*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_BEGIN, &obj_ext_mask);
|
||||
call_draw_cb(obj, &obj_ext_mask, LV_DRAW_MODE_POST_DRAW);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST, &obj_ext_mask);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_END, &obj_ext_mask);
|
||||
}
|
||||
}
|
||||
@ -744,7 +737,7 @@ static void draw_buf_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
lv_coord_t area_h = lv_area_get_height(area);
|
||||
uint32_t total = area_w * area_h;
|
||||
/* Swap the beginning and end values */
|
||||
/*Swap the beginning and end values*/
|
||||
lv_color_t tmp;
|
||||
uint32_t i = total - 1, j = 0;
|
||||
while(i > j) {
|
||||
@ -835,7 +828,7 @@ static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
draw_buf_rotate_180(drv, area, color_p);
|
||||
call_flush_cb(drv, area, color_p);
|
||||
} else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) {
|
||||
/*Allocate a temporary buffer to store rotated image */
|
||||
/*Allocate a temporary buffer to store rotated image*/
|
||||
lv_color_t * rot_buf = NULL;
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
@ -932,23 +925,6 @@ static void draw_buf_flush(void)
|
||||
}
|
||||
}
|
||||
|
||||
static lv_draw_res_t call_draw_cb(lv_obj_t * obj, const lv_area_t * clip_area, lv_draw_mode_t mode)
|
||||
{
|
||||
if(obj == NULL) return LV_DRAW_RES_OK;
|
||||
|
||||
const lv_obj_class_t * class_p = obj->class_p;
|
||||
while(class_p && class_p->draw_cb == NULL) class_p = class_p->base_class;
|
||||
|
||||
if(class_p == NULL) return LV_DRAW_RES_OK;
|
||||
|
||||
|
||||
lv_draw_res_t res = LV_DRAW_RES_OK;
|
||||
|
||||
if(class_p->draw_cb) res = class_p->draw_cb(obj, clip_area, mode);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
TRACE_REFR("Calling flush_cb on (%d;%d)(%d;%d) area with 0x%p image pointer", area->x1, area->y1, area->x2, area->y2, color_p);
|
||||
|
@ -97,7 +97,7 @@ void _lv_disp_refr_timer(lv_timer_t * timer);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_REFR_H*/
|
||||
|
@ -114,7 +114,7 @@ lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_H*/
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
*********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_H*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater then this the arc will drawn in quarters. A quarter is drawn only if there is arc in it */
|
||||
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater then this the arc will drawn in quarters. A quarter is drawn only if there is arc in it*/
|
||||
#define SPLIT_ANGLE_GAP_LIMIT 60 /*With small gaps in the arc don't bother with splitting because there is nothing to skip.*/
|
||||
|
||||
/**********************
|
||||
@ -515,7 +515,7 @@ static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness
|
||||
cir_x = ((radius - thick_half) * lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - thick_half) * lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
|
||||
/* Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
/*Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
if(cir_x > 0) {
|
||||
cir_x = (cir_x - pa) >> ps;
|
||||
res_area->x1 = cir_x - thick_half + thick_corr;
|
||||
|
@ -70,7 +70,7 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_ARC*/
|
||||
|
@ -138,15 +138,15 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_
|
||||
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, fill_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -194,8 +194,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) return;
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, map_area);
|
||||
@ -208,8 +208,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -260,9 +260,9 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
/*Get the width of the `draw_area` it will be used to go to the next line of the mask*/
|
||||
@ -326,7 +326,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
if(lv_gpu_nxp_vglite_fill(disp_buf, disp_w, lv_area_get_height(disp_area), draw_area, color, opa) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -358,7 +358,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
if(lv_gpu_nxp_vglite_fill(disp_buf, disp_w, lv_area_get_height(disp_area), draw_area, color, opa) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#endif
|
||||
lv_color_t last_dest_color = lv_color_black();
|
||||
@ -558,9 +558,9 @@ static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, co
|
||||
/*Get the width of the `draw_area` it will be used to go to the next line of the mask*/
|
||||
int32_t draw_area_w = lv_area_get_width(draw_area);
|
||||
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
/*Buffer the result color to avoid recalculating the same color*/
|
||||
@ -622,9 +622,9 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||
@ -718,7 +718,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
if(lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -768,7 +768,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
if(lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -801,7 +801,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
else {
|
||||
/*Only the mask matters*/
|
||||
if(opa > LV_OPA_MAX) {
|
||||
/*Go to the first pixel of the row */
|
||||
/*Go to the first pixel of the row*/
|
||||
|
||||
int32_t x_end4 = draw_area_w - 4;
|
||||
|
||||
@ -941,9 +941,9 @@ static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
}
|
||||
/*Masked*/
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
map_buf_tmp -= draw_area->x1;
|
||||
|
@ -44,7 +44,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_BLEND_H*/
|
||||
|
@ -248,8 +248,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
show_error(coords, clip_area, cdsc->dec_dsc.error_msg);
|
||||
}
|
||||
/* The decoder could open the image and gave the entire uncompressed image.
|
||||
* Just draw it!*/
|
||||
/*The decoder could open the image and gave the entire uncompressed image.
|
||||
*Just draw it!*/
|
||||
else if(cdsc->dec_dsc.img_data) {
|
||||
lv_area_t map_area_rot;
|
||||
lv_area_copy(&map_area_rot, coords);
|
||||
@ -276,7 +276,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
lv_draw_map(coords, &mask_com, cdsc->dec_dsc.img_data, draw_dsc, chroma_keyed, alpha_byte);
|
||||
}
|
||||
/* The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
/*The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
else {
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
@ -339,7 +339,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte)
|
||||
{
|
||||
/* Use the clip area as draw area*/
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, clip_area);
|
||||
|
||||
@ -347,8 +347,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -365,16 +365,16 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
#if LV_DRAW_COMPLEX
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/* Simple case without masking and transformations */
|
||||
/*Simple case without masking and transformations*/
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /* copy with color keying (+ alpha) */
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /*copy with color keying (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_color_key();
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_color_key();
|
||||
}
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /* copy with recolor (+ alpha) */
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /*copy with recolor (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_recolor(draw_dsc->recolor, draw_dsc->recolor_opa);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
|
@ -90,7 +90,7 @@ bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
|
||||
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_IMG_H*/
|
||||
|
@ -274,10 +274,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
cmd_state = CMD_STATE_PAR;
|
||||
continue;
|
||||
}
|
||||
else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
|
||||
else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char*/
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
}
|
||||
else if(cmd_state == CMD_STATE_IN) { /*Command end */
|
||||
else if(cmd_state == CMD_STATE_IN) { /*Command end*/
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
continue;
|
||||
}
|
||||
@ -413,21 +413,21 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const
|
||||
lv_font_glyph_dsc_t g;
|
||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||
if(g_ret == false) {
|
||||
/* Add warning if the dsc is not found
|
||||
* but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20) {
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't draw anything if the character is empty. E.g. space */
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||
|
||||
int32_t pos_x = pos_p->x + g.ofs_x;
|
||||
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
||||
|
||||
/*If the letter is completely out of mask don't draw it */
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(pos_x + g.box_w < clip_area->x1 ||
|
||||
pos_x > clip_area->x2 ||
|
||||
pos_y + g.box_h < clip_area->y1 ||
|
||||
@ -509,7 +509,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/* Calculate the col/row start/end on the map*/
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : clip_area->x1 - pos_x;
|
||||
int32_t col_end = pos_x + box_w <= clip_area->x2 ? box_w : clip_area->x2 - pos_x + 1;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
@ -521,7 +521,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
|
||||
uint8_t letter_px;
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
lv_coord_t hor_res = lv_disp_get_hor_res(_lv_refr_get_disp_refreshing());
|
||||
uint32_t mask_buf_size = box_w * box_h > hor_res ? hor_res : box_w * box_h;
|
||||
@ -649,7 +649,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/* Calculate the col/row start/end on the map*/
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : (clip_area->x1 - pos_x) * 3;
|
||||
int32_t col_end = pos_x + box_w / 3 <= clip_area->x2 ? box_w : (clip_area->x2 - pos_x + 1) * 3;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
@ -662,7 +662,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
uint8_t letter_px;
|
||||
lv_opa_t px_opa;
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > _LV_MASK_BUF_MAX_SIZE ? _LV_MASK_BUF_MAX_SIZE : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
|
@ -59,7 +59,7 @@ typedef struct {
|
||||
int32_t y;
|
||||
|
||||
/** The 'y1' coordinate of the label when the hint was saved.
|
||||
* Used to invalidate the hint if the label has moved too much. */
|
||||
* Used to invalidate the hint if the label has moved too much.*/
|
||||
int32_t coord_y;
|
||||
} lv_draw_label_hint_t;
|
||||
|
||||
@ -99,7 +99,7 @@ extern const uint8_t _lv_bpp8_opa_table[];
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LABEL_H*/
|
||||
|
@ -152,14 +152,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -253,14 +253,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= draw_buf->area.x1;
|
||||
draw_area.y1 -= draw_buf->area.y1;
|
||||
draw_area.x2 -= draw_buf->area.x1;
|
||||
@ -361,9 +361,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
draw_area.y1 = LV_MIN(p1.y, p2.y) - w;
|
||||
draw_area.y2 = LV_MAX(p1.y, p2.y) + w;
|
||||
|
||||
/* Get the union of `coords` and `clip`*/
|
||||
/* `clip` is already truncated to the `draw_buf` size
|
||||
* in 'lv_refr_area' function */
|
||||
/*Get the union of `coords` and `clip`*/
|
||||
/*`clip` is already truncated to the `draw_buf` size
|
||||
*in 'lv_refr_area' function*/
|
||||
bool is_common = _lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
@ -412,15 +412,15 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/*Store the coordinates of the `draw_a` relative to the draw_buf */
|
||||
/*Store the coordinates of the `draw_a` relative to the draw_buf*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
/* The real draw area is around the line.
|
||||
* It's easy to calculate with steep lines, but the area can be very wide with very flat lines.
|
||||
* So deal with it only with steep lines. */
|
||||
/*The real draw area is around the line.
|
||||
*It's easy to calculate with steep lines, but the area can be very wide with very flat lines.
|
||||
*So deal with it only with steep lines.*/
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
/*Draw the background line by line*/
|
||||
|
@ -58,7 +58,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LINE_H*/
|
||||
|
@ -282,10 +282,10 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
|
||||
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle,
|
||||
lv_draw_mask_line_side_t side)
|
||||
{
|
||||
/* Find an optimal degree.
|
||||
* lv_mask_line_points_init will swap the points to keep the smaller y in p1
|
||||
* Theoretically a line with `angle` or `angle+180` is the same only the points are swapped
|
||||
* Find the degree which keeps the origo in place */
|
||||
/*Find an optimal degree.
|
||||
*lv_mask_line_points_init will swap the points to keep the smaller y in p1
|
||||
*Theoretically a line with `angle` or `angle+180` is the same only the points are swapped
|
||||
*Find the degree which keeps the origo in place*/
|
||||
if(angle > 180) angle -= 180; /*> 180 will swap the origo*/
|
||||
|
||||
int32_t p2x;
|
||||
@ -311,7 +311,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
lv_draw_mask_line_side_t start_side;
|
||||
lv_draw_mask_line_side_t end_side;
|
||||
|
||||
/* Constrain the input angles */
|
||||
/*Constrain the input angles*/
|
||||
if(start_angle < 0)
|
||||
start_angle = 0;
|
||||
else if(start_angle > 359)
|
||||
@ -345,7 +345,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT;
|
||||
}
|
||||
else
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /* silence compiler */
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /*silence compiler*/
|
||||
|
||||
LV_ASSERT_MSG(end_angle >= 0 && start_angle <= 360, "Unexpected end angle");
|
||||
|
||||
@ -356,7 +356,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_LEFT;
|
||||
}
|
||||
else
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /* silence compiler */
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /*silence compiler*/
|
||||
|
||||
lv_draw_mask_line_angle_init(¶m->start_line, vertex_x, vertex_y, start_angle, start_side);
|
||||
lv_draw_mask_line_angle_init(¶m->end_line, vertex_x, vertex_y, end_angle, end_side);
|
||||
@ -514,8 +514,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
}
|
||||
}
|
||||
|
||||
/* At the end of the mask if the limit line is smaller then the mask's y.
|
||||
* Then the mask is in the "good" area*/
|
||||
/*At the end of the mask if the limit line is smaller then the mask's y.
|
||||
*Then the mask is in the "good" area*/
|
||||
y_at_x = (int32_t)((int32_t)p->yx_steep * (abs_x + len)) >> 10;
|
||||
if(p->yx_steep > 0) {
|
||||
if(y_at_x < abs_y) {
|
||||
@ -607,8 +607,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
{
|
||||
int32_t k;
|
||||
int32_t x_at_y;
|
||||
/* At the beginning of the mask if the limit line is greater then the mask's y.
|
||||
* Then the mask is in the "wrong" area*/
|
||||
/*At the beginning of the mask if the limit line is greater then the mask's y.
|
||||
*Then the mask is in the "wrong" area*/
|
||||
x_at_y = (int32_t)((int32_t)p->xy_steep * abs_y) >> 10;
|
||||
if(p->xy_steep > 0) x_at_y++;
|
||||
if(x_at_y < abs_x) {
|
||||
@ -620,8 +620,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
}
|
||||
}
|
||||
|
||||
/* At the end of the mask if the limit line is smaller then the mask's y.
|
||||
* Then the mask is in the "good" area*/
|
||||
/*At the end of the mask if the limit line is smaller then the mask's y.
|
||||
*Then the mask is in the "good" area*/
|
||||
x_at_y = (int32_t)((int32_t)p->xy_steep * (abs_y)) >> 10;
|
||||
if(x_at_y > abs_x + len) {
|
||||
if(p->inv) {
|
||||
@ -758,7 +758,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
/*Start angle mask can work only from the end of end angle mask*/
|
||||
int32_t end_angle_first = (rel_y * p->end_line.xy_steep) >> 10;
|
||||
int32_t start_angle_last = ((rel_y + 1) * p->start_line.xy_steep) >> 10;
|
||||
|
||||
@ -800,7 +800,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
/*Start angle mask can work only from the end of end angle mask*/
|
||||
int32_t end_angle_first = (rel_y * p->end_line.xy_steep) >> 10;
|
||||
int32_t start_angle_last = ((rel_y + 1) * p->start_line.xy_steep) >> 10;
|
||||
|
||||
@ -950,14 +950,14 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
lv_sqrt_res_t x0;
|
||||
lv_sqrt_res_t x1;
|
||||
/* y = 0 should mean the top of the circle */
|
||||
/*y = 0 should mean the top of the circle*/
|
||||
int32_t y;
|
||||
if(abs_y < radius) {
|
||||
y = radius - abs_y;
|
||||
|
||||
/* Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
* Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
* Try to use the values from the previous run*/
|
||||
/*Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
*Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
*Try to use the values from the previous run*/
|
||||
if(y == p->y_prev) {
|
||||
x0.f = p->y_prev_x.f;
|
||||
x0.i = p->y_prev_x.i;
|
||||
@ -973,9 +973,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
else {
|
||||
y = radius - (h - abs_y) + 1;
|
||||
|
||||
/* Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
* Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
* Try to use the values from the previous run*/
|
||||
/*Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
*Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
*Try to use the values from the previous run*/
|
||||
if((y - 1) == p->y_prev) {
|
||||
x1.f = p->y_prev_x.f;
|
||||
x1.i = p->y_prev_x.i;
|
||||
@ -990,8 +990,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
p->y_prev_x.i = x0.i;
|
||||
}
|
||||
|
||||
/* If x1 is on the next round coordinate (e.g. x0: 3.5, x1:4.0)
|
||||
* then treat x1 as x1: 3.99 to handle them as they were on the same pixel*/
|
||||
/*If x1 is on the next round coordinate (e.g. x0: 3.5, x1:4.0)
|
||||
*then treat x1 as x1: 3.99 to handle them as they were on the same pixel*/
|
||||
if(x0.i == x1.i - 1 && x1.f == 0) {
|
||||
x1.i--;
|
||||
x1.f = 0xFF;
|
||||
@ -1089,8 +1089,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
/*Set all points which are crossed by the circle*/
|
||||
for(; i <= x1.i; i++) {
|
||||
/* These values are very close to each other. It's enough to approximate sqrt
|
||||
* The non-approximated version is lv_sqrt(r2 - (i * i), &y_next, sqrt_mask); */
|
||||
/*These values are very close to each other. It's enough to approximate sqrt
|
||||
*The non-approximated version is lv_sqrt(r2 - (i * i), &y_next, sqrt_mask);*/
|
||||
sqrt_approx(&y_next, &y_prev, r2 - (i * i));
|
||||
|
||||
m = (y_prev.f + y_next.f) >> 1;
|
||||
|
@ -99,7 +99,7 @@ typedef struct {
|
||||
lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
/*First point */
|
||||
/*First point*/
|
||||
lv_point_t p1;
|
||||
|
||||
/*Second point*/
|
||||
@ -112,23 +112,23 @@ typedef struct {
|
||||
/*A point of the line*/
|
||||
lv_point_t origo;
|
||||
|
||||
/* X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
|
||||
/*X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
|
||||
int32_t xy_steep;
|
||||
|
||||
/* Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
|
||||
/*Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
|
||||
int32_t yx_steep;
|
||||
|
||||
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines */
|
||||
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines*/
|
||||
int32_t steep;
|
||||
|
||||
/*Steepness in 1 px in 0..255 range. Used only by flat lines. */
|
||||
/*Steepness in 1 px in 0..255 range. Used only by flat lines.*/
|
||||
int32_t spx;
|
||||
|
||||
/*1: It's a flat line? (Near to horizontal)*/
|
||||
uint8_t flat : 1;
|
||||
|
||||
/* Invert the mask. The default is: Keep the left part.
|
||||
* It is used to select left/right/top/bottom*/
|
||||
/*Invert the mask. The default is: Keep the left part.
|
||||
*It is used to select left/right/top/bottom*/
|
||||
uint8_t inv: 1;
|
||||
} lv_draw_mask_line_param_t;
|
||||
|
||||
@ -154,7 +154,7 @@ typedef struct {
|
||||
struct {
|
||||
lv_area_t rect;
|
||||
lv_coord_t radius;
|
||||
/* Invert the mask. 0: Keep the pixels inside.*/
|
||||
/*Invert the mask. 0: Keep the pixels inside.*/
|
||||
uint8_t outer: 1;
|
||||
} cfg;
|
||||
int32_t y_prev;
|
||||
@ -318,7 +318,7 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_MASK_H*/
|
||||
|
@ -142,8 +142,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, &coords_bg, clip);
|
||||
@ -151,8 +151,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -251,8 +251,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
grad_color = grad_get(dsc, lv_area_get_height(&coords_bg), y - coords_bg.y1);
|
||||
}
|
||||
|
||||
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||
* because it the middle mask shouldn't be taken into account (therefore its faster)*/
|
||||
/*If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||
*because it the middle mask shouldn't be taken into account (therefore its faster)*/
|
||||
if(simple_mode && split &&
|
||||
(y < coords_bg.y1 + rout + 1 ||
|
||||
y > coords_bg.y2 - rout - 1)) {
|
||||
@ -423,8 +423,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, coords, clip);
|
||||
@ -432,8 +432,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -554,8 +554,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, &sh_area, clip);
|
||||
@ -563,8 +563,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -598,7 +598,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
|
||||
}
|
||||
else {
|
||||
/*A larger buffer is required for calculation */
|
||||
/*A larger buffer is required for calculation*/
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
|
||||
|
||||
@ -1288,8 +1288,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, area_outer, clip);
|
||||
@ -1297,8 +1297,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -1364,7 +1364,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
fill_area.y2++;
|
||||
}
|
||||
|
||||
/*Draw the lower corner area */
|
||||
/*Draw the lower corner area*/
|
||||
int32_t lower_corner_end = area_outer->y2 - disp_area->y1 - corner_size;
|
||||
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||
|
@ -50,7 +50,7 @@ typedef struct {
|
||||
lv_color_t border_color;
|
||||
lv_coord_t border_width;
|
||||
lv_opa_t border_opa;
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later. */
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later.*/
|
||||
lv_border_side_t border_side :5;
|
||||
|
||||
/*Outline*/
|
||||
@ -109,7 +109,7 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_dra
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_RECT_H*/
|
||||
|
@ -78,7 +78,7 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
pcnt++;
|
||||
}
|
||||
}
|
||||
/*The first and the last points are also adjacent */
|
||||
/*The first and the last points are also adjacent*/
|
||||
if(points[0].x != points[point_cnt - 1].x || points[0].y != points[point_cnt - 1].y) {
|
||||
p[pcnt] = points[point_cnt - 1];
|
||||
pcnt++;
|
||||
@ -133,7 +133,8 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
i_next_right = y_min_i + 1;
|
||||
if(i_next_right > point_cnt - 1) i_next_right = 0;
|
||||
|
||||
/* Check if the order of points is inverted or not.
|
||||
/**
|
||||
* Check if the order of points is inverted or not.
|
||||
* The normal case is when the left point is on `y_min_i - 1`
|
||||
* Explanation:
|
||||
* if angle(p_left) < angle(p_right) -> inverted
|
||||
|
@ -50,7 +50,7 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_TRIANGLE_H*/
|
||||
|
@ -67,9 +67,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8, 16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8, 16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
p_color.full = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
|
||||
}
|
||||
@ -78,9 +78,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
* so the possible real width are 4, 8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
*so the possible real width are 4, 8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
p_color.full = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
|
||||
}
|
||||
@ -89,9 +89,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
* so the possible real width are 2, 4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
*so the possible real width are 2, 4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
p_color.full = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
|
||||
}
|
||||
@ -127,9 +127,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
|
||||
return px_opa ? LV_OPA_TRANSP : LV_OPA_COVER;
|
||||
@ -140,9 +140,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 4 ,8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 4 ,8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
|
||||
return opa_table[px_opa];
|
||||
@ -155,9 +155,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
|
||||
return opa_table[px_opa];
|
||||
@ -192,9 +192,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0x1) << (7 - bit));
|
||||
@ -204,9 +204,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 4 ,8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 4 ,8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0x3) << (6 - bit));
|
||||
@ -216,9 +216,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0xF) << (4 - bit));
|
||||
@ -257,9 +257,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((c.full & 0x1) << (7 - bit));
|
||||
@ -269,9 +269,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
* so the possible real width are 4, 8 ,12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
*so the possible real width are 4, 8 ,12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
|
||||
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
|
||||
@ -282,9 +282,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((c.full & 0xF) << (4 - bit));
|
||||
@ -329,21 +329,21 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
*/
|
||||
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
{
|
||||
/* Allocate image descriptor */
|
||||
/*Allocate image descriptor*/
|
||||
lv_img_dsc_t * dsc = lv_mem_alloc(sizeof(lv_img_dsc_t));
|
||||
if(dsc == NULL)
|
||||
return NULL;
|
||||
|
||||
lv_memset_00(dsc, sizeof(lv_img_dsc_t));
|
||||
|
||||
/* Get image data size */
|
||||
/*Get image data size*/
|
||||
dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
|
||||
if(dsc->data_size == 0) {
|
||||
lv_mem_free(dsc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate raw buffer */
|
||||
/*Allocate raw buffer*/
|
||||
dsc->data = lv_mem_alloc(dsc->data_size);
|
||||
if(dsc->data == NULL) {
|
||||
lv_mem_free(dsc);
|
||||
@ -351,7 +351,7 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
}
|
||||
lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
|
||||
|
||||
/* Fill in header */
|
||||
/*Fill in header*/
|
||||
dsc->header.always_zero = 0;
|
||||
dsc->header.w = w;
|
||||
dsc->header.h = h;
|
||||
@ -453,8 +453,8 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
dsc->tmp.img_dsc.header.w = dsc->cfg.src_w;
|
||||
dsc->tmp.img_dsc.header.h = dsc->cfg.src_h;
|
||||
|
||||
/* The inverse of the zoom will be sued during the transformation
|
||||
* + dsc->cfg.zoom / 2 for rounding*/
|
||||
/*The inverse of the zoom will be sued during the transformation
|
||||
* + dsc->cfg.zoom / 2 for rounding*/
|
||||
dsc->tmp.zoom_inv = (((256 * 256) << _LV_ZOOM_INV_UPSCALE) + dsc->cfg.zoom / 2) / dsc->cfg.zoom;
|
||||
|
||||
dsc->res.opa = LV_OPA_COVER;
|
||||
|
@ -77,35 +77,36 @@ enum {
|
||||
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
|
||||
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_18, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_19, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_20, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_21, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_22, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_23, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_18, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_19, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_20, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_21, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_22, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_23, /**< Reserved for further use.*/
|
||||
|
||||
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format.*/
|
||||
};
|
||||
typedef uint8_t lv_img_cf_t;
|
||||
|
||||
/**
|
||||
* LVGL image header
|
||||
*/
|
||||
/* The first 8 bit is very important to distinguish the different source types.
|
||||
/**
|
||||
* The first 8 bit is very important to distinguish the different source types.
|
||||
* For more info see `lv_img_get_src_type()` in lv_img.c
|
||||
* On big endian systems the order is reversed so cf and always_zero must be at
|
||||
* the end of the struct.
|
||||
* */
|
||||
*/
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
typedef struct {
|
||||
|
||||
@ -114,13 +115,13 @@ typedef struct {
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
|
||||
} lv_img_header_t;
|
||||
#else
|
||||
typedef struct {
|
||||
|
||||
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
|
||||
@ -145,7 +146,7 @@ typedef struct {
|
||||
lv_coord_t src_w; /*width of the image source*/
|
||||
lv_coord_t src_h; /*height of the image source*/
|
||||
lv_coord_t pivot_x; /*pivot x*/
|
||||
lv_coord_t pivot_y; /* pivot y*/
|
||||
lv_coord_t pivot_y; /*pivot y*/
|
||||
int16_t angle; /*angle to rotate*/
|
||||
uint16_t zoom; /*256 no zoom, 128 half size, 512 double size*/
|
||||
lv_color_t color; /*a color used for `LV_IMG_CF_INDEXED_1/2/4/8BIT` color formats*/
|
||||
@ -304,7 +305,7 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_BUF_H*/
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define LV_IMG_CACHE_LIFE_GAIN 1
|
||||
|
||||
/*Don't let life to be greater than this limit because it would require a lot of time to
|
||||
* "die" from very high values */
|
||||
* "die" from very high values*/
|
||||
#define LV_IMG_CACHE_LIFE_LIMIT 1000
|
||||
|
||||
/**********************
|
||||
@ -84,9 +84,9 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
for(i = 0; i < entry_cnt; i++) {
|
||||
if(color.full == cache[i].dec_dsc.color.full &&
|
||||
lv_img_cache_match(src, cache[i].dec_dsc.src)) {
|
||||
/* If opened increment its life.
|
||||
* Image difficult to open should live longer to keep avoid frequent their recaching.
|
||||
* Therefore increase `life` with `time_to_open`*/
|
||||
/*If opened increment its life.
|
||||
*Image difficult to open should live longer to keep avoid frequent their recaching.
|
||||
*Therefore increase `life` with `time_to_open`*/
|
||||
cached_src = &cache[i];
|
||||
cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN;
|
||||
if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT;
|
||||
@ -123,7 +123,7 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its us*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ extern "C" {
|
||||
* To avoid repeating this heavy load images can be cached.
|
||||
*/
|
||||
typedef struct {
|
||||
lv_img_decoder_dsc_t dec_dsc; /**< Image information */
|
||||
lv_img_decoder_dsc_t dec_dsc; /**< Image information*/
|
||||
|
||||
/** Count the cache entries's life. Add `time_to_open` to `life` when the entry is used.
|
||||
* Decrement all lifes by one every in every ::lv_img_cache_open.
|
||||
* If life == 0 the entry can be reused */
|
||||
* If life == 0 the entry can be reused*/
|
||||
int32_t life;
|
||||
} lv_img_cache_entry_t;
|
||||
|
||||
@ -71,7 +71,7 @@ void lv_img_cache_invalidate_src(const void * src);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_CACHE_H*/
|
||||
|
@ -51,7 +51,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
|
||||
/**
|
||||
* Initialize the image decoder module
|
||||
* */
|
||||
*/
|
||||
void _lv_img_decoder_init(void)
|
||||
{
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_img_decoder_ll), sizeof(lv_img_decoder_t));
|
||||
@ -298,11 +298,11 @@ lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * s
|
||||
}
|
||||
else if(src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/*The size depend on the font but it is unknown here. It should be handled outside of the
|
||||
* function*/
|
||||
*function*/
|
||||
header->w = 1;
|
||||
header->h = 1;
|
||||
/* Symbols always have transparent parts. Important because of cover check in the draw
|
||||
* function. The actual value doesn't matter because lv_draw_label will draw it*/
|
||||
/*Symbols always have transparent parts. Important because of cover check in the draw
|
||||
*function. The actual value doesn't matter because lv_draw_label will draw it*/
|
||||
header->cf = LV_IMG_CF_ALPHA_1BIT;
|
||||
}
|
||||
else {
|
||||
@ -358,8 +358,8 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
/*Process true color formats*/
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA || cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/* In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
* So simply give its pointer*/
|
||||
/*In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
*So simply give its pointer*/
|
||||
dsc->img_data = ((lv_img_dsc_t *)dsc->src)->data;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@ -420,7 +420,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*Alpha indexed images. */
|
||||
/*Alpha indexed images.*/
|
||||
else if(cf == LV_IMG_CF_ALPHA_1BIT || cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_4BIT ||
|
||||
cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
return LV_RES_OK; /*Nothing to process*/
|
||||
@ -455,8 +455,8 @@ lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_de
|
||||
|
||||
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
/* For TRUE_COLOR images read line required only for files.
|
||||
* For variables the image data was returned in `open`*/
|
||||
/*For TRUE_COLOR images read line required only for files.
|
||||
*For variables the image data was returned in `open`*/
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
res = lv_img_decoder_built_in_line_true_color(dsc, x, y, len, buf);
|
||||
}
|
||||
|
@ -30,17 +30,17 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Source of image. */
|
||||
* Source of image.*/
|
||||
enum {
|
||||
LV_IMG_SRC_VARIABLE, /** Binary/C variable */
|
||||
LV_IMG_SRC_FILE, /** File in filesystem */
|
||||
LV_IMG_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h) */
|
||||
LV_IMG_SRC_UNKNOWN, /** Unknown source */
|
||||
LV_IMG_SRC_VARIABLE, /** Binary/C variable*/
|
||||
LV_IMG_SRC_FILE, /** File in filesystem*/
|
||||
LV_IMG_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/
|
||||
LV_IMG_SRC_UNKNOWN, /** Unknown source*/
|
||||
};
|
||||
|
||||
typedef uint8_t lv_img_src_t;
|
||||
|
||||
/* Decoder function definitions */
|
||||
/*Decoder function definitions*/
|
||||
|
||||
struct _lv_img_decoder;
|
||||
struct _lv_img_decoder_dsc;
|
||||
@ -120,7 +120,7 @@ typedef struct _lv_img_decoder_dsc {
|
||||
uint32_t time_to_open;
|
||||
|
||||
/**A text to display instead of the image when the image can't be opened.
|
||||
* Can be set in `open` function or set NULL. */
|
||||
* Can be set in `open` function or set NULL.*/
|
||||
const char * error_msg;
|
||||
|
||||
/**Store any custom data here is required*/
|
||||
@ -263,7 +263,7 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_DECODER_H*/
|
||||
|
@ -191,7 +191,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
track_first_item = f->rev ? cont->spec_attr->child_cnt - 1 : 0;
|
||||
track_t t;
|
||||
while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) {
|
||||
/*Search the first item of the next row */
|
||||
/*Search the first item of the next row*/
|
||||
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, item_gap, &t);
|
||||
total_track_cross_size += t.track_cross_size + track_gap;
|
||||
track_cnt++;
|
||||
@ -200,7 +200,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
|
||||
if(track_cnt) total_track_cross_size -= track_gap; /*No gap after the last track*/
|
||||
|
||||
/* Place the tracks to get the start position */
|
||||
/*Place the tracks to get the start position*/
|
||||
lv_coord_t max_cross_size = (row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont));
|
||||
place_content(track_cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap);
|
||||
}
|
||||
@ -213,7 +213,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
|
||||
while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) {
|
||||
track_t t;
|
||||
/*Search the first item of the next row */
|
||||
/*Search the first item of the next row*/
|
||||
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, item_gap, &t);
|
||||
|
||||
if(rtl && !row) {
|
||||
@ -349,7 +349,7 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
|
||||
if(lv_area_get_height(&old_coords) != area_get_main_size(&item->coords)) {
|
||||
lv_obj_invalidate(item);
|
||||
lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
|
||||
lv_event_send(item, LV_EVENT_COORD_CHANGED, &old_coords);
|
||||
lv_obj_invalidate(item);
|
||||
}
|
||||
}
|
||||
@ -357,8 +357,8 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
lv_coord_t cross_pos = 0;
|
||||
switch(f->cross_place) {
|
||||
case LV_FLEX_PLACE_CENTER:
|
||||
/* Round up the cross size to avoid rounding error when dividing by 2
|
||||
* The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
/*Round up the cross size to avoid rounding error when dividing by 2
|
||||
*The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2;
|
||||
break;
|
||||
case LV_FLEX_PLACE_END:
|
||||
|
@ -31,7 +31,7 @@ LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -119,7 +119,7 @@ extern const lv_flex_t lv_flex_row_even; /**< Place the items evenly
|
||||
#endif /*LV_USE_FLEX*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_FLEX_H*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
*********************/
|
||||
/**
|
||||
* Some helper defines
|
||||
* */
|
||||
*/
|
||||
#define CELL_SHIFT 4
|
||||
#define CELL_POS_MASK ((1 << CELL_SHIFT) - 1)
|
||||
#define CELL_SPAN_MASK (CELL_POS_MASK << CELL_SHIFT)
|
||||
@ -145,8 +145,8 @@ static void full_refresh(lv_obj_t * cont)
|
||||
item_repos_hint_t hint;
|
||||
lv_memset_00(&hint, sizeof(hint));
|
||||
|
||||
/* Calculate the grids absolute x and y coordinates.
|
||||
* It will be used as helper during item repositioning to avoid calculating this value for every children*/
|
||||
/*Calculate the grids absolute x and y coordinates.
|
||||
*It will be used as helper during item repositioning to avoid calculating this value for every children*/
|
||||
lv_coord_t pad_left = lv_obj_get_style_pad_left(cont, LV_PART_MAIN);
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(cont, LV_PART_MAIN);
|
||||
hint.grid_abs.x = pad_left + cont->coords.x1 - lv_obj_get_scroll_x(cont);
|
||||
@ -421,7 +421,7 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t *
|
||||
lv_area_set_width(&item->coords, item_w);
|
||||
lv_area_set_height(&item->coords, item_h);
|
||||
lv_obj_invalidate(item);
|
||||
lv_signal_send(item, LV_SIGNAL_COORD_CHG, &old_coords);
|
||||
lv_event_send(item, LV_EVENT_COORD_CHANGED, &old_coords);
|
||||
|
||||
}
|
||||
bool moved = true;
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -129,7 +129,7 @@ extern const lv_grid_t grid_12;
|
||||
#endif /*LV_USE_GRID*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GRID_H*/
|
||||
|
@ -38,7 +38,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_LAYOUTS_H*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user