What MCU/Processor/Board and compiler are you using?
STM32
What LVGL version are you using?
V7.9
What do you want to achieve?
Draw the customer btn.
What have you tried so far?
As the code, the btn is fine if no obj creating on it .If some obj created on it(not fully covered) and during pressing , there have large chance to flash on the background btn. Anything wrong?
Best Regards,
Code to reproduce
if(mode == LV_DESIGN_COVER_CHK) {
/*Use the original function for cover check*/
return old_btn_design(obj, mask, mode);
} else
if(mode == LV_DESIGN_DRAW_MAIN) {
lv_disp_buf_t * vdb_p = lv_disp_get_buf(_lv_refr_get_disp_refreshing());
lv_color_t * vdb_buf_tmp= vdb_p->buf_act;
draw_buf(vdb_buf_tmp);
);
} else if(mode == LV_DESIGN_DRAW_POST) {
/*Use the original function for post draw*/
old_btn_design(obj, mask, mode);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
Hi, embeddedt,
I doubt the issue is in the mode == LV_DESIGN_COVER_CHK , right? When the top obj is pressing, the button behind ,Which is not fully covered , should totally redraw before the top obj being drawing. But there have chance to invert the order. How can I debug?
I don’t fully understand your question but it looks to me like you’re accessing the VDB directly from the widget, instead of using the standard lv_draw APIs. That might be the problem.
Hi, embeddedt,
Many Thanks!
Yes I am copy the drawn buffer to the VDB in the object area. The flash means the part of the backgroud button will have chance to jump to the top in the covered area, likely the fault of the mode == LV_DESIGN_COVER_CHK. When an obj is covered partly , doed the obj being drawing fully when updating?
If I understand it correctly, a partially covered object will be redrawn fully from a logical perspective, but the expectation is that LV_DESIGN_DRAW_MAIN will skip drawing the fully covered areas of the object. The lv_draw functions also use the mask parameter to only redraw the necessary portions of the rectangle/arc/etc. However, I don’t know how to make that work when manipulating the VDB. I don’t think that’s the intended use case.
Hi, embeddedt,
Many Thanks!
It might due to the directly copying the VDB without the cover check in the LV_DESIGN_DRAW_MAIN. The back button will show the live picture and need to be clickable or pressable.I decode the picture in a buffer and copy to the VDB. What obj would you suggest to realise that purpose SAFETY?
I had tried the canvas and it works but a little slower than the direct buffer copy.
It is worth to find out the issue of my original code. What is the main purpose of the LV_DESIGN_COVER_CHK state in the design function? Must I use the MASK when drawing in the LV_DESIGN_DRAW_MAIN mode?
If so, the old_btn_design(obj, mask, mode) should work within the design function. Right?
Flash means the partially covered area of the background btn will show on the top instead of the part of the top obj ,which created on the btn, sometime when pressing the top obj . In my old customer design function , I just copy the whole drawn buffer to the position of the background btn should be in the VDB, regardless of the clip area. So that might be the reason? Per my understanding, the partially covered obj will be redraw wholly in each refresh cycle and so the clip area should equal to the object position and size ,then will have no use in that design function calling. Right?