Hello,
Is there an example that shows how to load an SVG file using the lv_image_set_src()
function?
According to the documentation, this should be possible:
lv_image also supports SVG images, For example:
lv_image_set_src(widget, “S:path/to/example.svg”);
Reference: LVGL SVG Documentation
However, this doesn’t work for me…
I know the SVG is valid because the following code works:
static void drawsvg(lv_event_t * e)
{
std::string svg_data;
convertSvgFileToString(“/usr/local/images/loader.svg”, svg_data);
lv_layer_t * layer = lv_event_get_layer(e);
lv_svg_node_t * svg = lv_svg_load_data(svg_data.c_str(), svg_data.length());
lv_draw_svg(layer, svg);
lv_svg_node_delete(svg);
}
lv_obj_add_event_cb(device_container, drawsvg, LV_EVENT_DRAW_MAIN, NULL);
Do you have any idea what might be missing or misconfigured to make lv_image_set_src()
work with SVG?
Thank you in advance for your help!