mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-29 06:36:05 +08:00
docs(examples): introduce summary and description to examples (#9968)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2531ef7738
commit
d76a346376
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "SVG"
|
||||
order: 15
|
||||
---
|
||||
|
||||
LVGL's built-in SVG parser and renderer for scalable vector graphics. Enable with `LV_USE_SVG` in `lv_conf.h`.
|
||||
@@ -3,7 +3,14 @@
|
||||
#if LV_USE_SVG && LV_USE_VECTOR_GRAPHIC
|
||||
|
||||
/**
|
||||
* Load an SVG from data
|
||||
* @title SVG from inline markup
|
||||
* @brief Render an SVG circle described by a literal string as an image source.
|
||||
*
|
||||
* A static `lv_image_dsc_t` is populated with `LV_IMAGE_HEADER_MAGIC`, a
|
||||
* 450x150 display size, and a pointer to the literal SVG markup drawing
|
||||
* a red circle with a blue stroke. The descriptor is handed to
|
||||
* `lv_image_set_src` on an image widget placed on the active screen so
|
||||
* the SVG decoder renders the markup on demand.
|
||||
*/
|
||||
void lv_example_svg_1(void)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
#if LV_USE_SVG && LV_USE_VECTOR_GRAPHIC
|
||||
|
||||
/**
|
||||
* Load an SVG from a file
|
||||
* @title SVG from filesystem
|
||||
* @brief Load an SVG file through the LVGL filesystem and use it as an image source.
|
||||
*
|
||||
* An image widget is created on the active screen and its source is set to
|
||||
* `A:lvgl/examples/assets/circle.svg`, so the SVG decoder reads the file
|
||||
* through the filesystem driver registered under drive letter `A`.
|
||||
*/
|
||||
void lv_example_svg_2(void)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,16 @@ static void event_cb(lv_event_t * e)
|
||||
lv_svg_node_delete(svg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title Draw SVG in a draw event
|
||||
* @brief Paint SVG markup directly into the screen's draw layer on `LV_EVENT_DRAW_MAIN`.
|
||||
*
|
||||
* `lv_obj_add_event_cb` subscribes a handler to the active screen's
|
||||
* `LV_EVENT_DRAW_MAIN`. The handler parses an inline SVG string with
|
||||
* `lv_svg_load_data`, calls `lv_draw_svg` against the layer returned by
|
||||
* `lv_event_get_layer`, and then releases the node with
|
||||
* `lv_svg_node_delete`.
|
||||
*/
|
||||
void lv_example_svg_3(void)
|
||||
{
|
||||
lv_obj_add_event_cb(lv_screen_active(), event_cb, LV_EVENT_DRAW_MAIN, NULL);
|
||||
|
||||
Reference in New Issue
Block a user