当前位置:网站首页>ESP32 LVGL8. 1 - roller rolling (roller 24)
ESP32 LVGL8. 1 - roller rolling (roller 24)
2022-04-23 18:38:00 【Please call me Xiao Peng】
Tips : This blog serves as a learning note , If there are mistakes, I hope to correct them
List of articles
One 、Roller brief introduction
1.1 summary Overview
Scrolling allows you to simply select an option to scroll from more .
1.2 Part and style Parts and Styles
• LV_PART_MAIN The background of the roller using all typical background attributes and text style attributes .Style_text_line_space Adjustment selection
Space between items . When the wheel rolls , It won't stop completely on an option , It will automatically scroll to the nearest valid option , With
anim_time Milliseconds , Because it specifies... In the style .
• LV_PART_SELECTED The middle choice . In addition to the typical background properties , It also uses text style properties to change the selected text
The appearance of the text in the area .
1.3 Use Usage
1.3.1 set an option Set options
These options are used as with lv_roller_set_options(Roller, options, LV_ROLLER_MODE_NORMAL/INFINITE) The string passed to Roller. These options should use \n Separate . for example :“ First of all \ nSecond \ nThird”.
LV_ROLLER_MODE_INFINITE Make the roller round .
have access to lv_roller_set_selected Manually select an option (roller, id, LV_ANIM_ON/OFF), among id Is an index of options .
1.3.2 Get the selected option Get selected option
Get the currently selected option to use lv_roller_get_selected(roller), It will return the index of the selected option .
lv_roller_get_selected_str (roller, buf, buf_size) Copy the name of the selected option to buf..
1.3.3 Visible rows Visible rows
The number of visible lines can be through lv_roller_set_visible_row_count(roller, num) To adjust . This function calculates the height of the current style . If the font 、 Row spacing 、 The frame width and other rollers change , You need to call the function again .
1.4 event Events
• LV_EVENT_VALUE_CHANGED Send when a new option is selected .
1.5 Key Keys
• LV_KEY_RIGHT/DOWN Select the next option
• LV_KEY_LEFT/UP Select the previous option
• LY_KEY_ENTER Apply selected options ( send out LV_EVENT_VALUE_CHANGED event )
Two 、Roller API
lv_obj_t * lv_roller_create(lv_obj_t * parent); // Create a wheel object
void lv_roller_set_options(lv_obj_t * obj, const char * options, lv_roller_mode_t mode);// Set options on the wheel
void lv_roller_set_selected(lv_obj_t * obj, uint16_t sel_opt, lv_anim_enable_t anim); // Set the selected options
void lv_roller_set_visible_row_count(lv_obj_t * obj, uint8_t row_cnt); // Set the height to display the given number of rows ( Options )
uint16_t lv_roller_get_selected(const lv_obj_t * obj); // Gets the index of the selected option
void lv_roller_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); // Gets the currently selected option as a string .
const char * lv_roller_get_options(const lv_obj_t * obj); // Get the option of a wheel
uint16_t lv_roller_get_option_cnt(const lv_obj_t * obj); // Get the total number of options
3、 ... and 、 Example
3.1Roller Basic display
/************************************************* * The name of the function : roller_event_handler * ginseng Count : e * The functionality : Scroll the callback display *************************************************/
static void roller_event_handler(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e); // Get callback value
lv_obj_t * obj = lv_event_get_target(e); // Get objects
if(code == LV_EVENT_VALUE_CHANGED){
// Judge the current event
char buf[32];
lv_roller_get_selected_str(obj,buf,sizeof(buf)); // Get options str
LV_LOG_USER("Selected ID:%d Month:%s\n",lv_roller_get_selected(obj),buf);
}
}
/************************************************* * The name of the function : roller_show1_event_hander * ginseng Count : nothing * The functionality : Scroll the callback display *************************************************/
void roller_show_1()
{
lv_obj_t * roller1 = lv_roller_create(lv_scr_act()); // Create a scrolling object
lv_roller_set_options( roller1, // Set the options on the scroll wheel
"January\n"
"February\n"
"March\n"
"April\n"
"May\n"
"June\n"
"July\n"
"August\n"
"September\n"
"October\n"
"November\n"
"December",
LV_ROLLER_MODE_INFINITE);
lv_roller_set_visible_row_count(roller1,4); // Set the height of the display
lv_obj_center(roller1); // centered
lv_obj_add_event_cb(roller1,roller_event_handler,LV_EVENT_ALL,NULL); // Add callback function
}
3.2Roller Font display position of
/************************************************* * The name of the function : roller_show2_event_hander * ginseng Count : e * The functionality : Scroll the callback display *************************************************/
static void roller_show2_event_hander(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e); // Get object value
lv_obj_t * obj = lv_event_get_target(e); // Get events
if(code == LV_EVENT_CHILD_CHANGED){
// Judge events
char buf[32];
lv_roller_get_selected_str(obj,buf,sizeof(buf));// Set option values
LV_LOG_USER("Selected value:%s",buf);
}
}
/************************************************* * The name of the function : roller_show_2 * ginseng Count : nothing * The functionality : Scrolling *************************************************/
void roller_show_2()
{
static lv_style_t style_sel; // Create styles
lv_style_init(&style_sel); // Initialize style
lv_style_set_text_font(&style_sel,&lv_font_montserrat_16); // Initial font
const char * opts = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10"; // Initialization options
lv_obj_t * roller; // Initialize the scrolling object
roller = lv_roller_create(lv_scr_act()); // Create a scrolling object
lv_roller_set_options(roller,opts,LV_ROLLER_MODE_NORMAL); // set an option
lv_roller_set_visible_row_count(roller,2); // Set the width of the scroll
lv_obj_set_width(roller,100); // Set the width of the object
lv_obj_add_style(roller,&style_sel,LV_PART_SELECTED); // Set width
lv_obj_set_style_text_align(roller,LV_TEXT_ALIGN_LEFT,0); // Set font Center
lv_obj_align(roller,LV_ALIGN_LEFT_MID,10,0); // Set location
lv_obj_add_event_cb(roller,roller_show2_event_hander,LV_EVENT_ALL,NULL);// Add a callback
lv_roller_set_selected(roller,2,LV_ANIM_OFF); // Set initial options
roller = lv_roller_create(lv_scr_act()); // Create objects
lv_roller_set_options(roller,opts,LV_ROLLER_MODE_NORMAL); // Initialization options
lv_roller_set_visible_row_count(roller,3); // Set the width distance
lv_obj_add_style(roller,&style_sel,LV_PART_SELECTED); // Add the style
lv_obj_align(roller,LV_ALIGN_CENTER,0,0); // Set location
lv_obj_add_event_cb(roller,roller_show2_event_hander,LV_EVENT_ALL,NULL);// Set callback
lv_roller_set_selected(roller,5,LV_ANIM_OFF); // Set initialization options
roller = lv_roller_create(lv_scr_act()); // Create objects
lv_roller_set_options(roller,opts,LV_ROLLER_MODE_NORMAL); // Initialization options
lv_roller_set_visible_row_count(roller,4); // Set the width distance
lv_obj_set_width(roller,80); // Set the width of the object
lv_obj_add_style(roller,&style_sel,LV_PART_SELECTED); // Add the style
lv_obj_set_style_text_align(roller,LV_TEXT_ALIGN_RIGHT,0); // Center the style font
lv_obj_align(roller,LV_ALIGN_RIGHT_MID,-10,0); // Set location
lv_obj_add_event_cb(roller,roller_show2_event_hander,LV_EVENT_ALL,NULL);// Add a callback
lv_roller_set_selected(roller,8,LV_ANIM_OFF); // Set initialization selection value
}
3.3 Use the slide mask option to zoom in
It's worth noting that something you haven't seen before is used here , Mask , Before font redrawing, I learned in the progress bar , Here are a few for the mask API The parameters of are as follows
/**
* Initialize a fade mask .
* @param initialization lv_draw_mask_param_t Parameter pointer to
* @param Regional influence of coordinates ( Absolute coordinates )
* @param opa_top Opacity at the top
* @param y_top At which coordinates do you start to change the transparency to ' opa_bottom '
* @param opa_bottom Opacity at the bottom
* @param y_bottom where coordinate reach ' opa_bottom '.
*/
Void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * cods,lv_opa_t opa_top,lv_coord_t y_top,lv_opa_t opa_bottom, lv_coord_t y_bottom)
/**
* Add a paint mask . Everything drawn after it ( Until the mask is removed ) Will be affected by the mask .
* Initialize mask parameters . Save only pointers .
* @param custom_id A custom pointer to identify the mask . be used for “lv_draw_mask_remove_custom”.
* @ Returns an integer , Masked ID. Can be in ' lv_draw_mask_remove_id ' Use in .
*/
Int16_t lv_draw_mask_add(void * param, void * custom_id)
Example Code
/************************************************* * The name of the function : mask_event_cb * ginseng Count : e * The functionality : Scroll the callback display *************************************************/
static void mask_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e); // Get events
lv_obj_t * obj = lv_event_get_target(e); // Get current event
static int16_t mask_top_id = -1; // Define the top mask
static int16_t mask_bottom_id = -1; // Define the bottom mask
if (code == LV_EVENT_COVER_CHECK) {
// Event coverage check
lv_event_set_cover_res(e, LV_COVER_RES_MASKED); // Set the cover check result
} else if (code == LV_EVENT_DRAW_MAIN_BEGIN) {
// Execute the main drawing
/* add mask */
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); // Get object font
lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);// Gets the line spacing of the object font
lv_coord_t font_h = lv_font_get_line_height(font); // Get line height
lv_area_t roller_coords; // Set the drawing area variable
lv_obj_get_coords(obj, &roller_coords); // Copy the coordinates of an object to an area
lv_area_t rect_area; // Set the drawing area variable
rect_area.x1 = roller_coords.x1; // Get x1 Value
rect_area.x2 = roller_coords.x2; // Get x2 Value
rect_area.y1 = roller_coords.y1; // Get y1 Value
rect_area.y2 = roller_coords.y1 + (lv_obj_get_height(obj) - font_h - line_space) / 2; // Get y2 Value
lv_draw_mask_fade_param_t * fade_mask_top = lv_mem_buf_get(sizeof(lv_draw_mask_fade_param_t)); // Draw mask fade parameters Top
lv_draw_mask_fade_init(fade_mask_top, &rect_area, LV_OPA_TRANSP, rect_area.y1, LV_OPA_COVER, rect_area.y2); // Initialize a fade mask .
mask_top_id = lv_draw_mask_add(fade_mask_top, NULL); // Add a top draw mask
rect_area.y1 = rect_area.y2 + font_h + line_space - 1; // obtain y1 coordinate
rect_area.y2 = roller_coords.y2; // obtain y2 coordinate
lv_draw_mask_fade_param_t * fade_mask_bottom =lv_mem_buf_get(sizeof(lv_draw_mask_fade_param_t));// Draw mask fade parameters Bottom
lv_draw_mask_fade_init(fade_mask_bottom, &rect_area, LV_OPA_COVER, rect_area.y1, LV_OPA_TRANSP, rect_area.y2); // Initialize a fade mask .
mask_bottom_id = lv_draw_mask_add(fade_mask_bottom, NULL); // Add a top draw mask
} else if (code == LV_EVENT_DRAW_POST_END) {
// complete post Drawing phase ( When all child elements are drawn )
lv_draw_mask_fade_param_t * fade_mask_top = lv_draw_mask_remove_id(mask_top_id); // Remove mask
lv_draw_mask_fade_param_t * fade_mask_bottom = lv_draw_mask_remove_id(mask_bottom_id); // Remove mask
lv_draw_mask_free_param(fade_mask_top); // Release the data in the parameter .
lv_draw_mask_free_param(fade_mask_bottom); // Release the data in the parameter .
lv_mem_buf_release(fade_mask_top); // Manual memory release
lv_mem_buf_release(fade_mask_bottom); // Manual memory release
mask_top_id = -1;
mask_bottom_id = -1;
}
}
/************************************************* * The name of the function : roller_show_3 * ginseng Count : e * The functionality : Scroll the callback display *************************************************/
void roller_show_3(void)
{
static lv_style_t style; // Create a style variable
lv_style_init(&style); // Initialize style
lv_style_set_bg_color(&style, lv_color_black()); // Set the background color
lv_style_set_text_color(&style, lv_color_white()); // Set font color
lv_style_set_border_width(&style, 0); // Set border width
lv_style_set_pad_all(&style, 0); // Set margins
lv_obj_add_style(lv_scr_act(), &style, 0); // Add the style
lv_obj_t *roller1 = lv_roller_create(lv_scr_act()); // establish roller object
lv_obj_add_style(roller1, &style, 0); // Add the style
lv_obj_set_style_bg_opa(roller1, LV_OPA_TRANSP, LV_PART_SELECTED); // Set the transparency of the object
#if LV_FONT_MONTSERRAT_22
lv_obj_set_style_text_font(roller1, &lv_font_montserrat_22, LV_PART_SELECTED); // Set object font
#endif
lv_roller_set_options(roller1, // Set object options
"January\n"
"February\n"
"March\n"
"April\n"
"May\n"
"June\n"
"July\n"
"August\n"
"September\n"
"October\n"
"November\n"
"December",
LV_ROLLER_MODE_NORMAL);
lv_obj_center(roller1); // Center object
lv_roller_set_visible_row_count(roller1, 3); // Set object spacing
lv_obj_add_event_cb(roller1, mask_event_cb, LV_EVENT_ALL, NULL); // Set callback
}
Four 、 First time to know Drawing
4.1Drawing summary
Use LVGL, You don't need to draw anything manually . Just create the object ( Button like 、 label 、 Arc, etc ), Move and change them ,
LVGL Will refresh and redraw the required content .
however , If you draw on LVGL Have a basic understanding of how it works , Then you can better add customization , To make it easier to find loopholes or just out of curiosity .
The basic concept is not to draw directly on the screen , Instead, draw on the internal drawing buffer first . When drawing ( Rendering ) When it's ready , Copy the buffer to the screen .
The draw buffer can be smaller than the size of the screen .LVGL Will simply render the appropriate for a given paint buffer “ Mapping ”.
Compared with drawing directly on the screen , This approach has two main advantages :
- It avoids drawing UI Blink when layer . for example , If you will LVGL Draw directly into the display , When drawing the background + Button + When text ,
Every “ Stage ” Will be visible in a short time .. - In the internal RAM Modify buffer in , Finally, writing only one pixel is better than reading directly on each pixel access / Write display faster .( For example, by taking
Yes SPI Interface display controller )..
Be careful , This concept is different from “ Tradition ” Double buffer , There are two screen size frame buffers : A saved current image is displayed on the display , Rendering takes place in another ( Inactive ) Framebuffer , When rendering is complete , They are exchanged . The main difference is , Use LVGL You don't need to store 2 Framebuffer ( External... Is usually required RAM), But only a smaller draw buffer is needed (s), It can be easily put inside RAM.
4.2 Screen refresh mechanism Mechanism of screen refreshing
Be sure to be familiar with LVGL Buffer mode .
LVGL Follow these steps to refresh the screen :
- UI Something has happened on the that needs to be redrawn . for example , A button is pressed , A chart is changed or an animation occurs , wait .
- LVGL Save the old and new areas of the changed object into a buffer , It is called invalid area buffer . In order to optimize the , In some cases , Object is not added to the buffer :
Do not add hidden objects .
Objects that are completely detached from their parents will not be added
Some areas beyond the parent are clipped to the parent's area .
Do not add objects on other screens . - At every LV_DISP_DEF_REFR_PERIOD(set in lv_conf.h) The following happens in :
•LVGL Check invalid areas and connect adjacent or intersecting areas
Get the first connection area , If it is smaller than the draw buffer , You just need to render the contents of this area into the drawing buffer . If
Area is not suitable for buffer , Drawing as many lines may put the drawing buffer . After rendering the area ,flush_cb Called from the display driver to refresh the display . If the area is larger than the buffer , Also render the rest . Do the same for all connected areas . When an area is redrawn , The library searches for the topmost object that covers the area , And start drawing from this object . for example , If the label of a button changes , The library will see that it is sufficient to draw the button under the text , And you don't need to draw the screen under the button .
The differences between the buffer modes of the drawing mechanism are as follows : - One buffer - LVGL Wait before you start redrawing the next part lv_disp_flush_ready()( from call flush_cb).
- Two buffers - When the first buffer is sent to the second buffer ,LVGL You can immediately draw to the second buffer ,flush_cb Because the refresh should be done by DMA( Or similar hardware ) In the background .
- Double buffering - flush_cb Only the address of the frame buffer should be exchanged .
4.3 Mask Masking
The mask is LVGL Basic concepts of drawing engine . To use LVGL, You don't need to understand the mechanism described here , You may find it interesting to understand how drawing works behind the scenes . If you want to customize the drawing , Understanding the mask will come in handy . Learn to mask , Let's learn the steps of drawing first .LVGL Perform the following steps to render any shape 、 Image or text . It can be considered a drawing pipeline .
- Prepare the draw descriptors According to the style of the object ( for example lv_draw_rect_dsc_t) Create drawing descriptor . It tells the drawing parameters , Such as color 、 Width 、 The opacity 、 typeface 、 Radius, etc .
- Call the draw function Use drawing descriptors and some other parameters ( for example lv_draw_rect()) Call the drawing function . It renders the original shape to the current paint buffer .
- Create masks If the shape is very simple and does not require a mask , Please go to #5. Otherwise, create the required mask ( For example, rounded rectangle mask )
- Calculate all the added mask. It will 0…255 A value is created to a with the mask created “ shape ” In the mask buffer of . for example , Based on the mask parameter “ Line mask ” Under the circumstances , Leave one side of the buffer as it is ( The default is 255) And set the rest to 0 To indicate that the side should be deleted .
- Blend a color or image In the mixed mask ( Make some pixels transparent or opaque )、 Mixed mode ( Add 、 Subtraction, etc )、 Opacity is treated .
LVGL It has the following built-in mask types that can be calculated and applied in real time :
• LV_DRAW_MASK_TYPE_LINE Remove one side... From a row ( Top 、 Bottom 、 Left or right ).lv_draw_line Use one of the 4 individual . Essentially , Every one of them ( tilt ) Lines pass through to form a rectangle to 4 Bounded by a line mask .
• LV_DRAW_MASK_TYPE_RADIUS Delete the inner or outer part of a rectangle with a radius . It is also used by setting the radius to a large value ( LV_RADIUS_CIRCLE) To create a circle
• LV_DRAW_MASK_TYPE_ANGLE Delete a circular sector . It is used for lv_draw_arc Delete “ empty ” A sector
• LV_DRAW_MASK_TYPE_FADE Create vertical fade in and fade out ( Change opacity )
• LV_DRAW_MASK_TYPE_MAP The mask is stored in an array and the necessary partial mask is applied
Used to create almost all basic elements :
• letters Create a mask from the letters , And draw a rectangle with the color of letters according to the mask
• line from 4 individual “ Line mask ” establish , Used to mask the left side of the line 、 Right 、 Upper and lower parts , To get a perfectly vertical tail
• rounded rectangle Create a mask in real time to add a radius to the corner
• clip corner In order to cut the overflow on the fillet ( Usually subclasses ), A rounded rectangle mask is also applied .
• rectangle border Same as rounded rectangle , But the inner part is also shielded
• arc drawing Round border , But arc masks are also applied .
• ARGB images take alpha The channel is separated into a mask , And draw the image as ordinary RGB Images .
4.4 Painting hook Hook drawing
Although widgets can be well customized through styles , But in some cases, you may need to really customize . To ensure a high degree of flexibility ,LVGL Many events are sent during the drawing process , And tell LVGL Parameters of what will be drawn . Some fields of these parameters can be modified to draw other content , Or you can manually add any custom drawing .
A good use case is the button matrix widget . By default , Its buttons can be styled in different states , But you can't style buttons one by one . However , An event will be sent to the forever button , You can tell LVGL For example, use different colors on specific buttons or draw images manually on some buttons .
Each relevant event is described in detail below .
4.4.1 Main painting Main drawing
These events are related to the actual drawing of the object . for example , Button 、 The drawing of text and so on takes place here .
lv_event_get_clip_area(event) Can be used to get the current clip area . The area that needs to be clipped in the drawing function , So that they can only be drawn on a limited area .
LV_EVENT_DRAW_MAIN_BEGIN
Send... Before you start drawing objects . This is a good place to manually add masks . for example , Add one “ Delete ” The line mask on the right side of the object .
LV_EVENT_DRAW_MAIN
The actual drawing of the object occurs in this event . for example , Here is a rectangle of the button . First , Call the internal event of the widget to execute the drawing , Then you can draw anything on top of them . for example , You can add custom text or images .
LV_EVENT_DRAW_MAIN_END
Call... When the main drawing is complete . You can also draw anything here , It is also deleted LV_EVENT_DRAW_MAIN_BEGIN.
4.4.2 Publish drawing Post drawing
When drawing all the children of an object , The post drawing event will be called . for example ,LVGL Use the post draw phase to draw the scroll bar , Because it
They should be above all children .
lv_event_get_clip_area(event) Can be used to get the current clip area .
LV_EVENT_DRAW_POST_BEGIN
Send... Before starting the post drawing phase . You can also add a mask here to mask the content drawn later .
LV_EVENT_DRAW_POST
The actual drawing should take place here .
LV_EVENT_DRAW_POST_END
Call... When post drawing is complete . If the mask is not removed inside ,LV_EVENT_DRAW_MAIN_END Remove... Here .
4.4.3 Part drawing Part drawing
When LVGL Draw a part of an object ( For example, the indicator of the slider 、 The cell of a table or the button of a matrix ) when , It will draw
Send events before and after this section using some context of the drawing . It allows the use of masks 、 Additional drawings or changes LVGL Plan to use
Drawing dependent parameters change the part at a very low level .
In these events , Use lv_obj_draw_part_t Structure to describe the context of the drawing . Not set for every widget and widget
There are fields . To see which fields are set for the widget , Refer to the documentation for the widget .
lv_obj_draw_part_t Has the following fields :
Const lv_area_t * clip_area; // Current clip area , If you need to draw something in the event
uint32_t part; // Send the current part of the event
uint32_t id; // Index of parts . for example , Button index on the button matrix or table cell index .
// Draw descriptor , Set... Only when relevant
lv_draw_rect_dsc_t * rect_dsc; // A drawing descriptor , You can modify LVGL What will be drawn . Set... Only for rectangular parts
lv_draw_label_dsc_t * label_dsc;// A drawing descriptor , You can modify LVGL What will be drawn . Set only for parts like text
lv_draw_line_dsc_t * line_dsc; // A drawing descriptor , You can modify LVGL What will be drawn . Set for linear parts only
lv_draw_img_dsc_t * img_dsc; // A drawing descriptor , You can modify LVGL What will be drawn . Set only for parts similar to the image
lv_draw_arc_dsc_t * arc_dsc; // A drawing descriptor , You can modify LVGL What will be drawn . Set to arc only
// Other purposes
lv_area_t * draw_area; // The area of the drawn part
Const lv_point_t * p1; // A point calculated when drawing . For example, a point on a chart or the center of an arc .
Const lv_point_t * p2; // A point calculated when drawing . for example , A point in the chart .
char text[[16]; // Text calculated when drawing . You can modify . for example , Label the chart axis .
lv_coord_t radius; // for example , The radius of an arc ( Not the radius of the angle ).
int32_t value; // The value calculated when drawing . example : The dash value of the chart .
Const void * sub_part_ptr; // A pointer identifies something in a section . Such as chart series .
lv_event_get_draw_part_dsc(event) Can be used to get a pointer to lv_obj_draw_part_t.
LV_EVENT_DRAW_PART_BEGIN
Start drawing parts . This is to modify the drawing descriptor ( for example rect_dsc) Or a good place to add a mask .
LV_EVENT_DRAW_PART_END
Complete the drawing of parts . This is a good place to draw extra content on the part , Delete or add to LV_EVENT_DRAW_PART_BEGIN.
4.4.4 other Others
LV_EVENT_COVER_CHECK
This event is used to check whether the object completely covers an area .
lv_event_get_cover_area(event) Returns a pointer to the area to be checked , Can be used to set one of the following results :
lv_event_set_cover_res(event, res)
• LV_COVER_RES_COVER These areas are completely covered by objects
• LV_COVER_RES_NOT_COVER The area is not covered by the object
• LV_COVER_RES_MASKED There is a mask on the object , So it can't cover up the area
Some areas cannot be completely covered by objects :
• It's not entirely in that area
• It has a radius
• It has no 100% Background opacity
• This is a ARGB Or chroma keyed image
• It doesn't have a normal mixing mode . under these circumstances ,LVGL You need to know the color under the object to mix correctly
• This is a text, etc
In short , If for some reason , The area below the object is visible , Not that it doesn't cover the area . Before sending this event ,LVGL Check that at least the coordinates of the widget completely cover the area . If not , The event... Will not be called . You just need to check the drawings you added . Existing properties known to the widget are handled in the widget's internal events . for example , If a widget has > 0 radius , It may not cover an area , but radius Only if you modify it and the widget cannot know it , You need to deal with .
LV_EVENT_REFR_EXT_DRAW_SIZE
If you need to draw outside the widget ,LVGL You need to understand it to provide additional drawing space . Suppose you create an event , Writes the current value of the slider above its knob . under these circumstances ,LVGL You need to know that the drawing area of the slider should be the size required by the text
Same as .
You can use Simply set the desired drawing area .lv_event_set_ext_draw_size(e, size)
版权声明
本文为[Please call me Xiao Peng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210609450180.html
边栏推荐
- According to the result set queried by SQL statement, it is encapsulated as JSON
- Quantexa CDI(场景决策智能)Syneo平台介绍
- 【ACM】70. climb stairs
- Notepad + + replaces tabs with spaces
- 机器学习理论之(8):模型集成 Ensemble Learning
- Excel intercept text
- 使用 bitnami/postgresql-repmgr 镜像快速设置 PostgreSQL HA
- SQL中函数 decode()与 replace()的用法
- Machine learning theory (8): model integration ensemble learning
- Gson fastjason Jackson of object to JSON difference modifies the field name
猜你喜欢
纠结
os_authent_prefix
【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))
listener.log
Ctfshow - web362 (ssti)
机器学习实战 -朴素贝叶斯
ctfshow-web362(SSTI)
Tangle
iptables -L执行缓慢
QT tablewidget insert qcombobox drop-down box
随机推荐
使用 bitnami/postgresql-repmgr 镜像快速设置 PostgreSQL HA
Log4j2 cross thread print traceid
STM32学习记录0008——GPIO那些事1
机器学习理论之(8):模型集成 Ensemble Learning
Mysqldump backup database
深入理解 Golang 中的 new 和 make 是什么, 差异在哪?
Imx6 debugging LVDS screen technical notes
Using transmittablethreadlocal to realize parameter cross thread transmission
Daily CISSP certification common mistakes (April 11, 2022)
QT error: no matching member function for call to ‘connect‘
QT notes on qmap container freeing memory
Iptables - L executes slowly
CISSP certified daily knowledge points (April 12, 2022)
Resolution: cnpm: unable to load file \cnpm. PS1, because running scripts is prohibited on this system
Jeecg boot microservice architecture
机器学习实战 -朴素贝叶斯
Daily network security certification test questions (April 12, 2022)
Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système
[mathematical modeling] - analytic hierarchy process (AHP)
ESP32 LVGL8. 1 - anim animation (anim 16)