mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve fill_rect_gradient
This commit is contained in:
parent
cc6d46cd83
commit
1936f74e11
@ -5,6 +5,7 @@
|
||||
* 修改为禁用和不接受用户消息的滚动条不响应滚动消息(感谢智明提供补丁)
|
||||
* list view 增加check button示例
|
||||
* 修复资源问题(感谢泽武提供补丁)
|
||||
* 修正计算渐变色offset错误的问题(感谢颖健提供补丁)
|
||||
|
||||
2024/04/03
|
||||
* list_view 屏蔽组合键功能(感谢兆坤提供补丁)
|
||||
|
@ -581,6 +581,8 @@ ret_t canvas_fill_rect(canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
static ret_t canvas_fill_rect_gradient_impl(canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h,
|
||||
gradient_t* gradient) {
|
||||
rect_t r;
|
||||
xy_t widget_y = y;
|
||||
wh_t widget_h = h;
|
||||
xy_t x2 = x + w - 1;
|
||||
xy_t y2 = y + h - 1;
|
||||
vgcanvas_t* vg = NULL;
|
||||
@ -610,8 +612,15 @@ static ret_t canvas_fill_rect_gradient_impl(canvas_t* c, xy_t x, xy_t y, wh_t w,
|
||||
if (gradient->degree == 180) {
|
||||
uint32_t i = 0;
|
||||
lcd_t* lcd = c->lcd;
|
||||
float_t offset = 0.0f;
|
||||
float_t base_y = 0.0f;
|
||||
|
||||
if (r.y > widget_y && r.h < widget_h) {
|
||||
base_y = (float_t)(tk_abs(r.y - widget_y));
|
||||
}
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
float offset = (float)i / (float)h;
|
||||
offset = (float_t)(base_y + i) / (float_t)widget_h;
|
||||
color_t color = gradient_get_color(gradient, offset);
|
||||
lcd_set_stroke_color(lcd, color);
|
||||
lcd_draw_hline(lcd, x, y + i, w);
|
||||
|
Loading…
Reference in New Issue
Block a user