LVGL v8 arcimg
lvsf_arcimg is a custom arc image widget that SiFli built on top of the LVGL lv_img. It uses an SRAM mask to reveal an image as an arc segment (an arc-shaped progress bar). It supports setting the center, outer radius, line width, and the background-arc angle range, and drives the currently displayed angle with floating-point precision, with animated transitions.
Main header: middleware/lvgl/lvsf/gui_widgets/lvsf_arcimg.h
Dependency widget: LVGL img (
LV_USE_IMG)
Note
This widget has no corresponding lvgl_v8_arcimg example yet; refer to the header comments and the SDK configuration for detailed usage.
Features
Uses an SRAM mask to reveal the image as an arc (arc progress bar).
Configurable center coordinates, outer radius, and arc-line width.
The start/end angle and direction (clockwise/counterclockwise) of the background arc can be set.
Supports setting the current angle with floating-point precision and an animated transition duration.
Also provides an integer-angle setting interface.
Supports multiple SRAM mask buffers.
Use Cases
Arc/ring progress bars and dashboard arc segments.
Image-style arc indicators on a watch face.
Arc-shaped value display with smooth animated transitions.
Supported Boards
See the corresponding lvgl_v8 example or SDK configuration.
Configuration and Initialization
lvsf_arcimg depends on the LVGL img component. Confirm it is enabled in menuconfig:
CONFIG_LV_USE_IMG=y
The BSP controls compilation of this widget through the LVSF_USE_ARCIMG macro.
Minimum flow to create an object:
#include "lvsf_arcimg.h"
lv_obj_t *arcimg = lv_arcimg_create(lv_scr_act());
API Reference
Function |
Description |
Parameters / Returns |
|---|---|---|
|
Create an arc image widget |
|
|
Set the arc geometric parameters and the number of SRAM mask buffers |
|
|
Set the background-arc angle range |
|
|
Set the currently displayed angle with floating-point precision |
|
|
Set the currently displayed angle with an integer |
|
|
Get the currently displayed angle |
Returns the current arc span angle (degrees) |
Typical Usage
Based on the header interfaces, the typical usage flow is: create the object → set the geometric parameters → set the background-arc angle range → drive the current angle:
#include "lvsf_arcimg.h"
lv_obj_t *arcimg = lv_arcimg_create(parent);
/* Center (70,70), outer radius 60, line width 8, 2 SRAM mask buffers */
lv_arcimg_set_param(arcimg, 70, 70, 60, 8, 2);
/* Background arc from 135° to 405° (i.e. one full turn), clockwise */
lv_arcimg_set_bg_angles(arcimg, 135, 405, 1);
/* Currently display a 90° arc span, with a 500ms animated transition */
lv_arcimg_set_angle(arcimg, 90.0f, 500);
Refer to the header comments for detailed usage.
Demo
This widget has no corresponding example yet; run the relevant lvgl_v8 example or SDK configuration to see the actual effect.
See Also
Source path:
middleware/lvgl/lvsf/gui_widgets/lvsf_arcimg.h