■ LVGL-色环部件
■ 示例一
#define scr_act_width() lv_obj_get_width(lv_scr_act())
#define scr_act_height() lv_obj_get_height(lv_scr_act())static lv_obj_t* obj;
static void colorwheel_event_cb(lv_event_t *e)
{lv_obj_t *target = lv_event_get_target(e); lv_obj_set_style_bg_color(obj, lv_colorwheel_get_rgb(target), LV_PART_MAIN);
}
static void lv_example_colorwheel(void)
{lv_obj_t *colorwheel = lv_colorwheel_create(lv_scr_act(), true); lv_obj_set_size(colorwheel, scr_act_height() * 2 / 3, scr_act_height()* 2 / 3); lv_obj_center(colorwheel); lv_obj_set_style_arc_width(colorwheel, scr_act_height() * 0.1, LV_PART_MAIN); lv_colorwheel_set_mode_fixed(colorwheel, true); obj = lv_obj_create(lv_scr_act()); lv_obj_set_size(obj, scr_act_height() / 3, scr_act_height() / 3); lv_obj_align_to(obj, colorwheel, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, LV_PART_MAIN); lv_obj_set_style_bg_color(obj, lv_colorwheel_get_rgb(colorwheel), LV_PART_MAIN); lv_obj_add_event_cb(colorwheel, colorwheel_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
}