Description
I’d like to display a line meter arched over a 90 degrees angle but with a different orientation from the default “top” one.
What MCU/Processor/Board and compiler are you using?
Currently working on SDL2.
What do you want to achieve?
Using a clock as reference, I would like my meter to span from hours 9 to 12.
What have you tried so far?
The function lv_lmeter_set_scale
allows me to specify an angle, but said angle is always centered on the topmost point of the circle. I would like to have it rotated 45 degrees left, for example.
I’m not sure wether this is possible with the current API (if it is I couldn’t find a reference). If not I guess it would be pretty simple to implement.
Code to reproduce
void lv_ex_lmeter_1(void)
{
/*Create a style for the line meter*/
static lv_style_t style_lmeter;
lv_style_copy(&style_lmeter, &lv_style_pretty_color);
style_lmeter.line.width = 2;
style_lmeter.line.color = LV_COLOR_SILVER;
style_lmeter.body.main_color = lv_color_hex(0x91bfed); /*Light blue*/
style_lmeter.body.grad_color = lv_color_hex(0x04386c); /*Dark blue*/
style_lmeter.body.padding.left = 16; /*Line length*/
/*Create a line meter */
lv_obj_t * lmeter;
lmeter = lv_lmeter_create(lv_scr_act(), NULL);
lv_lmeter_set_range(lmeter, 0, 100); /*Set the range*/
lv_lmeter_set_value(lmeter, 80); /*Set the current value*/
lv_lmeter_set_scale(lmeter, 90, 30); /*Set the angle and number of lines*/
lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/
lv_obj_set_size(lmeter, 150, 150);
lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0);
}