feat(libs): add barcode widget (#3778)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech
2022-12-11 18:48:03 +08:00
committed by GitHub
parent df2aa08aa4
commit 889634398a
15 changed files with 1151 additions and 0 deletions

30
docs/libs/barcode.md Normal file
View File

@@ -0,0 +1,30 @@
# Barcode
Barcode generation with LVGL. Uses [code128](https://github.com/fhunleth/code128) by [fhunleth](https://github.com/fhunleth).
## Usage
Enable `LV_USE_BARCODE` in `lv_conf.h`.
Use `lv_barcode_create()` to create a barcode object, and use `lv_barcode_update()` to generate a barcode.
Call `lv_barcode_set_scale()` or `lv_barcode_set_dark/light_color()` to adjust scaling and color, and call `lv_barcode_update()` again to regenerate the barcode.
## Notes
- It is best not to manually set the width of the barcode, because when the width of the object is lower than the width of the barcode, the display will be incomplete due to truncation.
- The scale adjustment can only be an integer multiple, for example, `lv_barcode_set_scale(barcode, 2)` means 2x scaling.
## Example
```eval_rst
.. include:: ../../examples/libs/barcode/index.rst
```
## API
```eval_rst
.. doxygenfile:: lv_barcode.h
:project: lvgl