-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draw line got strange effect #6378
Comments
Yep, it seems like a rounding error. |
@FASTSHIFT static void event_cb(lv_event_t *e)
{
lv_layer_t * layer = lv_event_get_layer(e);
lv_vector_dsc_t * dsc = lv_vector_dsc_create(layer);
lv_vector_path_t * path = lv_vector_path_create(LV_VECTOR_PATH_QUALITY_MEDIUM);
lv_fpoint_t pts[] = {{10, 10}, {130, 130}, {10, 130}};
lv_vector_path_move_to(path, &pts[0]);
lv_vector_path_line_to(path, &pts[1]);
lv_vector_path_line_to(path, &pts[2]);
lv_vector_path_close(path);
lv_vector_dsc_set_fill_color(dsc, lv_color_make(0x00, 0x80, 0xff));
lv_vector_dsc_add_path(dsc, path);
lv_draw_vector(dsc);
lv_vector_path_delete(path);
lv_vector_dsc_delete(dsc);
}
...
lv_obj_t * obj = lv_obj_create(lv_screen_active());
lv_obj_center(obj);
lv_obj_add_event_cb(obj, event_cb, LV_EVENT_DRAW_MAIN, NULL);
Should it work with the code above? @liyang5945 Drawing vectors directly without a canvas required ARGB8888 colors format for the display. Is it possible for you? |
Because the vector rendering API uses absolute coordinates relative to the screen, rather than coordinates relative to the component itself, you can use static void event_cb(lv_event_t *e)
{
lv_layer_t * layer = lv_event_get_layer(e);
lv_obj_t * obj = lv_event_get_current_target_obj(e);
lv_vector_dsc_t * dsc = lv_vector_dsc_create(layer);
lv_vector_path_t * path = lv_vector_path_create(LV_VECTOR_PATH_QUALITY_MEDIUM);
lv_fpoint_t pts[] = {{10, 10}, {130, 130}, {10, 130}};
lv_vector_path_move_to(path, &pts[0]);
lv_vector_path_line_to(path, &pts[1]);
lv_vector_path_line_to(path, &pts[2]);
lv_vector_path_close(path);
lv_vector_dsc_translate(dsc, obj->coords.x1, obj->coords.y1);
lv_vector_dsc_set_fill_color(dsc, lv_color_make(0x00, 0x80, 0xff));
lv_vector_dsc_add_path(dsc, path);
lv_draw_vector(dsc);
lv_vector_path_delete(path);
lv_vector_dsc_delete(dsc);
} |
Yes, the code is copy pasted from your comment. I've created a new I thought that it's black because SDL uses XRGB8888 color format by default and ThorVG assumes that a
Questions:
|
Yes, we can consider directly deleting the buffer clearing operation of thorvg: Because the latest thorvg also removes this code: However, it should be noted that The specific reason can be seen in this discussion: thorvg/thorvg#1901
I have enabled |
With bool SwRenderer::preRender()
{
return true;
} it works well indeed. Thank you! Can we remove the |
I think it's OK. |
I've opened #6406 The vector demo is working too: It's a pity that RGB565 is not supported. |
I change color fomat to ARGB888 and use lastet master branch code, if use
output: |
It should be that the draw vector is only adapted to the full-screen buffer mode. For PARTIAL mode, the global matrix in @liyang5945 |
We need some feedback on this issue. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
Is there a way to handle it automatically or in a more generic way? To avoid these kind of issues for other drawing functions (e.g. See lv_line as a similar example. |
We need some feedback on this issue. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
As there was no activity here for a while we close this issue. But don't worry, the conversation is still here and you can get back to it at any time. So feel free to comment if you have remarks or ideas on this topic. |
LVGL version
v9.1.0
What happened?
I want to draw a Bezier curve. but got strange effect
if change this line
to
it seems better,I think the pixels are in the wrong place,for example the calculated Y value is 100.3 but draw on 101?
How to reproduce?
The text was updated successfully, but these errors were encountered: