mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
f753265a79
BREAKING CHANGE This is a huge update which introduces parallel rendering. lv_conf.h needs to be updated too.
40 lines
1008 B
C
40 lines
1008 B
C
#include "../../lv_examples.h"
|
|
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
|
|
|
|
#define CANVAS_WIDTH 50
|
|
#define CANVAS_HEIGHT 50
|
|
|
|
/**
|
|
* Draw an arc to the canvas
|
|
*/
|
|
void lv_example_canvas_5(void)
|
|
{
|
|
/*Create a buffer for the canvas*/
|
|
static uint8_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)];
|
|
|
|
/*Create a canvas and initialize its palette*/
|
|
lv_obj_t * canvas = lv_canvas_create(lv_scr_act());
|
|
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_COLOR_FORMAT_NATIVE);
|
|
lv_canvas_fill_bg(canvas, lv_color_hex3(0xccc), LV_OPA_COVER);
|
|
lv_obj_center(canvas);
|
|
|
|
lv_layer_t layer;
|
|
lv_canvas_init_layer(canvas, &layer);
|
|
|
|
lv_draw_arc_dsc_t dsc;
|
|
lv_draw_arc_dsc_init(&dsc);
|
|
dsc.color = lv_palette_main(LV_PALETTE_RED);
|
|
dsc.width = 5;
|
|
dsc.center.x = 25;
|
|
dsc.center.y = 25;
|
|
dsc.width = 15;
|
|
dsc.start_angle = 0;
|
|
dsc.end_angle = 220;
|
|
|
|
lv_draw_arc(&layer, &dsc);
|
|
|
|
lv_canvas_finish_layer(canvas, &layer);
|
|
|
|
}
|
|
#endif
|