README.md
1# Documentation
2
3
4## Building
5
6Building the documentation is pretty easy to do but it does have some requirements that have to be filled prior to building them.
7
8Here are the requirements:
9
10* Doxygen
11* Python >= 3.10
12* C compiler (gcc, msvc, clang, etc...)
13
14There are also some Python specific libraries that need to be installed. You can either install these individually or you can use pip to read the requirements file to install everything that is needed for Python.
15
16* Sphinx
17* breathe
18* imagesize
19* importlib-metadata
20* sphinx-rtd-theme
21* sphinx-sitemap
22* sphinxcontrib-applehelp
23* sphinxcontrib-devhelp
24* sphinxcontrib-htmlhelp
25* sphinxcontrib-jsmath
26* sphinxcontrib-qthelp
27* sphinxcontrib-serializinghtml
28* sphinxcontrib-mermaid==0.9.2
29* sphinx-design
30* sphinx-rtd-dark-mode
31* typing-extensions
32* sphinx-reredirects
33* dirsync
34
35To install using the `requirements.txt` file use the following command:
36
37 pip install -r requirements.txt
38
39Once you have all of the requirements installed you are ready to build the documentation. Use the following command:
40
41 python build.py skip_latex clean
42
43You may have to use the following command if you are on a Unix like OS
44
45 python3 build.py skip_latex clean
46
47The documentation will be output into `./out_html/` in the root directory for LVGL.
48
49
50## For Developers
51
52The most important thing that has to be done when contributing to LVGL is ***EVERYTHING MUST BE DOCUMENTED***.
53
54The below are some rules to follow when updating any of the `.rst` files located in the `./docs/` directory and any of it's subdirectories.
55
56
57### What to Name Your `.rst` File
58
59The documentation-generation logic uses the stem of the file name (i.e. "event" from file name "event.rst") and compares this with code-element names found by Doxygen. If a match is found, then it appends hyperlinks to the API pages that contain those code elements (names of macros, enum/struct/union types, variables, namespaces, typedefs and functions).
60
61If this is appropriate for the .RST file you are creating, ensure the stem of the file name matches the beginning part of the code-element name you want it to be associated with.
62
63If this is *not* appropriate for the .RST file you are creating, ensure the stem of the file name DOES NOT match any code-element names found in the LVGL header files under the ./src/ directory.
64
65In alignment with the above, use a file name stem that is appropriate to the topic being covered.
66
67
68### Text Format
69
70While with `.md` files, it is important to allow paragraphs to flow off to the right with one long line so that when they are formatted as `.html` files, the paragraphs will word-wrap with the width of the browser, this is not true with reStructuredText (`.rst` files). [Sphinx](https://www.sphinx-doc.org/en/master/) and its underlying [docutils parsing engine](https://docutils.sourceforge.io/docs/) conveniently combine grouped text into a proper paragraph with that word-wrapping behavior. This allows the source text documents to be nicely word-wrapped so that they are more readable in text- and code-editors that do not have wide editing windows. So please wrap the text around column 86 or narrower. Wrapping at *exactly* column 86 is not important, but readability and ease of editing is.
71
72
73### index.rst Files
74
75If you create a new directory you MUST have an `index.rst` file in that directory and that index file needs to be pointed to in the `index.rst` file that is located in the parent directory.
76
77Let's take a look at the `index.rst` file that is located in the `docs/layouts` directory.
78
79```
80.. _layouts:
81
82=======
83Layouts
84=======
85
86
87.. toctree::
88 :maxdepth: 2
89
90 flex
91 grid
92```
93
94
95The below explains the parts of this file.
96
97```
98.. _layouts: <=== Creates an explicit link target
99 <=== Empty line -- important!
100=======
101Layouts <=== Heading seen in documentation
102=======
103
104
105.. toctree:: <=== Table of contents
106 :maxdepth: 2 <=== Internal use and needs to always be set this way
107
108 flex <=== .rst files located in directory with index.rst
109 grid
110```
111
112The first line is for the purposes of providing a uniquely-named **link target** that can be referenced elsewhere in the documentation.
113
114 .. _{LINK NAME}:
115
116Note that `{LINK NAME}`:
117
118- **must** be preceded by a single underscore, and
119- **must** be followed by at least one blank line for the doc-generation logic to process it correctly.
120
121Replace `{LINK NAME}` with a link name that is unique among all documents under the `./docs/` directory. It can have multiple words if needed to make it unique or when otherwise appropriate for clarity. If multiple words are used, they can be separated with single spaces, hyphens or underscores. Whatever you use, the `{LINK NAME}` string used to reference it must be identical. `{LINK NAME}` strings are not case sensitive.
122
123That unique name is then used to provide a link reference elsewhere in the documentation using one of two formats.
124
125
126
127##### When "link text" should be a title or section heading from the target document:
128
129```reStructuredText
130:ref:`{LINK NAME}`
131```
132
133This in-line markup (interpreted text using the Sphinx-defined custom `:ref:` role) is then replaced with a hyperlink whose "link text" is the name of the section heading just below the **link target**. For this reason, when using this syntax, `{LINK NAME}` must reference **link target**s that are just above a title or section heading.
134
135
136
137##### When "link text" should be something else:
138
139```reStructuredText
140:ref:`other link text <{LINK NAME}>`
141```
142
143This latter syntax enables you to put a **link target** anywhere in an .RST file (not just above a heading) and link to it using this syntax.
144
145Note: This latter syntax was either added or fixed in Sphinx recently. It did not work in Sphinx 7.3.7.
146
147
148
149
150### Section Headings
151
152[Section headings](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections) are created by underlining (and optionally overlining) the section title with a punctuation character, at least as long as the text. Example:
153
154```
155=================
156This Is a Heading
157=================
158```
159
160reStructuredText does not impose any particular heading levels assigned to certain characters since the structure is determined from the succession of headings. So if you are modifying an existing .RST file, please follow the pattern already in use.
161
162If you are creating a new .RST file, use this convention:
163
164```
165=====
166Title
167=====
168
169Chapter
170*******
171
172Section
173-------
174
175Sub Section
176~~~~~~~~~~~
177
178Sub Sub Section
179^^^^^^^^^^^^^^^
180
181Sub Sub Sub Section
182'''''''''''''''''''
183```
184
185Note that the "underlining" can be longer than the heading title, but if it is shorter, the documentation-generation logic will fail with an error.
186
187For improved readability in the .RST file, place at least 2 blank lines above section headings.
188
189
190### Code Blocks
191
192* Do not use tab characters in code blocks.
193* Each indentation level use 4 spaces.
194* Include at least 1 empty line after a code block.
195* There must be one empty line between the code block directive and the code.
196* `.. code-block::` is the only directive that should be used. Note carefully that unlike the **link target** directive above, this directive has 2 colons. (The only ReST and sphinx directives that are valid with one colon are **link target**s as shown above.) Lone `::`, `:code:` or `.. code:` should not be used.
197* If you want to separate code into easier-to-understand sections you can do so with a single empty line.
198* For syntax highlighting appropriate to the language in the code block, specify the language after the directive. Some examples are:
199
200 - `.. code-block:: c`,
201 - `.. code-block:: cpp`,
202 - `.. code-block:: python`,
203 - `.. code-block:: shell`,
204 - `.. code-block:: kconfig`,
205 - `.. code-block:: json`,
206 - `.. code-block:: yaml`,
207 - `.. code-block:: csharp` (or "cs"),
208 - `.. code-block:: vb.net`,
209 - `.. code-block:: dot` (graphviz),
210 - `.. code-block:: html`,
211 - `.. code-block:: css`,
212 - `.. code-block:: xml`,
213 - `.. code-block:: make`.
214
215The full set of supported lexers are listed here: https://pygments.org/docs/lexers/ .
216
217
218### Bulleted Lists
219
220To create a bulleted list, do the following:
221
222 - First item description
223 - If you want to span multiple lines, indent subsequent
224 lines to align with item text like this.
225 - If you want to include a code block under a list item,
226 it must be intended to align with the list item like this:
227
228 .. code-block: python
229 <=== blank line here is important
230 # this is some code
231 <=== blank line here is important
232 - If you want to have nested bulleted lists, indent each
233 new level to align with its parent list item like this:
234 <=== blank line here is important
235 - level 2 item 1: text
236 - level 2 item 2: text
237 <=== blank line here is important
238 - Last list item. Note that the nested list above is preceded
239 and followed by 1 blank line.
240
241All lists (including nested lists) **must** be preceded and followed with at least 1 blank line. This is mandatory for the documentation-generation logic to process it correctly.
242
243
244### Referencing API Documentation
245
246If you want to reference portions of the LVGL code from the documentation (in .RST files) there are special directives to do this:
247
248 :cpp:func:`lv_init`
249 :c:macro:`LV_USE_FLEX`
250 :cpp:type:`lv_event_t`
251 :cpp:enum:`_lv_event_t`
252 :cpp:enumerator:`LV_EVENT_ALL`
253 :cpp:struct:`lv_image_dsc_t`
254 :cpp:union:`lv_style_value_t`
255
256There is a special directive when wanting to use a more complex expression. For example when showing the arguments passed to a function.
257
258 :cpp:expr:`lv_obj_set_layout(widget, LV_LAYOUT_FLEX)`
259 :cpp:expr:`lv_slider_set_mode(slider, LV_SLIDER_MODE_...)`
260
261Arguments that are expressions (more than one word), or contain non-alphanumeric characters will cause the `:cpp:expr:` interpreted-text to fail. Examples:
262
263 :cpp:expr:`lv_obj_set_layout(widget, LV_LAYOUT_FLEX/GRID)` <== arg with > 1 word
264 :cpp:expr:`lv_obj_set_layout(widget, LV_LAYOUT_*)` <== asterisk
265 :cpp:expr:`lv_obj_set_layout(*widget, LV_LAYOUT_FLEX)` <== asterisk
266 :cpp:expr:`lv_obj_set_layout((lv_obj_t *)widget, LV_LAYOUT_FLEX)` <== cast
267 :cpp:expr:`lv_obj_set_layout(&widget, LV_LAYOUT_FLEX);` <== ampersand & semicolon
268 :cpp:expr:`lv_obj_set_layout(widget, ...)` <== lone ellipsis
269
270For such examples, simply use reStructuredText literal markup like this:
271
272 ``lv_obj_set_layout(widget, LV_LAYOUT_FLEX/GRID)``
273 ``lv_obj_set_layout(widget, LV_LAYOUT_*)``
274 ``lv_obj_set_layout(*widget, LV_LAYOUT_FLEX)``
275 ``lv_obj_set_layout((lv_obj_t *)widget, LV_LAYOUT_FLEX)``
276 ``lv_obj_set_layout(&widget, LV_LAYOUT_FLEX);``
277 ``lv_obj_set_layout(widget, ...)``
278
279
280
README_jp.rst
1.. raw:: html
2
3 <p align="left">
4 <a href="https://github.com/sponsors/lvgl" target="_blank"><img align="left" src="https://lvgl.io/github-assets//sponsor.png" height="32px"></a>
5 </p>
6
7 <p align="right">
8 <a href="../README.md">English</a>| <a href="./README_zh.rst">中文</a>| <a href="./README_pt_BR.rst">Português do Brasil</a> | <b>日本語</b>
9 </p>
10
11.. raw:: html
12
13 </p>
14
15.. raw:: html
16
17 <p align="center">
18
19.. raw:: html
20
21 </p>
22
23.. raw:: html
24
25 <h1 align="center">
26
27Light and Versatile Graphics Library
28
29.. raw:: html
30
31 </h1>
32
33.. raw:: html
34
35 <p align="center">
36
37Website \| Docs \| Forum :gb: \| Demos \| Services \| SquareLine Studio
38:gb:
39
40.. raw:: html
41
42 </p>
43
44:ledger:
45Overview
46--------
47
48**実績**\ LVGL
49は、フリー&オープンソースの組み込み用グラフィックスライブラリです。
50あらゆるMCU、MPU、ディスプレイタイプに対応しており、美しいUI(User
51Interface)を実現できます。 ARM, STM32, NXP, Espressif, Nuvoton, Arduino,
52RT-Thread, Zephyr, NuttX,
53Adafruitなど、業界をリードするベンダーやプロジェクトによりサポートされています。
54
55**機能豊富**\
56モダンで美しいGUIを作成するための機能をすべて備えています。
5730以上の組み込みウィジェット、強力なスタイルシステム、WEB由来のレイアウトマネージャ、多くの言語をサポートする文字グラフィックシステムなどです。
58LVGL のシステム要件は、RAM 32KB、Flash
59128KB、Cコンパイラ、フレームバッファ、1/10スクリーンサイズのレンダリング用バッファです。
60
61**UIエディタ**\ SquareLine Studio
62は、LVGL用のプロフェッショナル&リーズナブルなドラッグ&ドロップ型のUIエディターです。
63Windows、Linux、macOS
64で動作し、ウェブサイトへの登録なしで試すことができます。
65
66**サービス**\ LVGL LLC
67では、グラフィックデザイン、UI実装、コンサルティングサービスに対する技術サポートが可能です。GUIプロジェクトの開発において何らかのサポートが必要な場合には、お気軽にお問い合わせください。
68
69:rocket:
70特徴
71-------------
72
73**フリー & 移植可能** - 外部依存関係がなく、完全に移植可能な
74Cライブラリ。(C++互換) -
75任意の(RT)OS、任意のMCU・MPU用にコンパイル可能。 -
76電子ペーパー、OLEDディスプレイ、TFTディスプレイ、白黒ディスプレイ、モニターに対応。
77`Porting
78Guide <https://docs-lvgl-io.translate.goog/master/intro/add-lvgl-to-your-project/connecting_lvgl.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
79- MITライセンスにより商用利用可能。 - システム要件:RAM 32KB、Flash
80128KB、フレームバッファ、レンダリング用に1/10以上のスクリーンサイズのバッファ。
81- OS、外部メモリ、GPUもサポート。
82
83**ウィジェット、スタイル、レイアウトなど** - 30以上の組み込み
84`ウィジェット <https://docs-lvgl-io.translate.goog/master/details/widgets/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__: ボタン、ラベル、スライダー、グラフ、キーボード、メーター、円弧、表など。
85-
86ウィジェットの任意の部分を任意の状態にカスタマイズ可能な豊富なスタイルプロパティを備えた柔軟な
87`スタイルシステム <https://docs-lvgl-io.translate.goog/master/details/base-widget/styles/style.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__\ 。
88-
89`Flexbox <https://docs-lvgl-io.translate.goog/master/layouts/flex.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
90および
91`グリッド <https://docs-lvgl-io.translate.goog/master/layouts/grid.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
92風のレイアウトエンジンにより、ウィジェットのサイズと位置を自動的に設定。
93-
94テキスト表示(UTF-8対応)は、中国語、日本語、韓国語、タイ語、ヒンディー語、アラビア語、ペルシア語をサポート。
95-
96ワードラッピング、カーニング、テキストスクロール、サブピクセルレンダリング、ピンイン-IME中国語入力、テキスト中の絵文字に対応。
97-
98アニメーション、アンチエイリアシング、不透明度、スムーズスクロール、シャドウ、画像変換などをサポートするレンダリングエンジン。
99-
100マウス、タッチパッド、キーパッド、キーボード、外部ボタン、エンコーダ等の
101`入力デバイス <https://docs-lvgl-io.translate.goog/master/details/main-components/indev.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
102をサポート。 -
103`マルチディスプレイ <https://docs-lvgl-io.translate.goog/master/details/main-components/display.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
104対応。
105
106**Binding と Build をサポート** - `MicroPython
107Binding <https://blog-lvgl-io.translate.goog/2019-02-20/micropython-bindings?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
108が LVGL API を公開。 -
109カスタムビルドシステムは使用せず、プロジェクトの他のファイルをビルドするときに、LVGLをビルド可能。
110- Make と
111`CMake <https://docs-lvgl-io.translate.goog/master/details/integration/building/cmake.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
112が含まれており、すぐ使えるようにサポート。 -
113`PCのシミュレータで開発したUIコード <https://docs-lvgl-io.translate.goog/master/details/integration/ide/pc-simulator.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
114は、そのまま組込み用ハードウェアでも使用可能。 - `Emscripten
115port <https://github.com/lvgl/lv_web_emscripten>`__ :gb:
116によりC言語のUIコードをHTMLファイルに変換。
117
118**ドキュメント, ツール, 技術サービス** -
119`ドキュメント <https://docs-lvgl-io.translate.goog/master/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__\ は\ `100以上の簡単なサンプルプログラム <https://github.com/lvgl/lvgl/tree/master/examples>`__
120:gb: 入り 。 - `SquareLine Studio <https://squareline.io/>`__ :gb: -
121UI開発をスピードアップおよび簡素化するためのプロフェッショナルで使いやすいUIエディターソフトウェア。
122-
123UI開発をよりシンプルかつ迅速にするための、ユーザーインターフェイスの設計、実装、コンサルティングなどの
124`技術サービス <https://lvgl-io.translate.goog/services?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__\ 。
125
126:package:
127パッケージ
128--------------------
129
130LVGL は以下で利用可能です。 - `Arduino
131library <https://docs-lvgl-io.translate.goog/master/details/entegration/framework/arduino.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
132- `PlatformIO
133package <https://registry.platformio.org/libraries/lvgl/lvgl>`__ :gb: -
134`Zephyr
135library <https://docs-zephyrproject-org.translate.goog/latest/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
136- `ESP32
137component <https://docs-lvgl-io.translate.goog/master/details/integration/chip/espressif.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
138- `NXP MCUXpresso
139component <https://www-nxp-com.translate.goog/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
140- `NuttX
141library <https://docs-lvgl-io.translate.goog/master/details/integration/os/nuttx.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
142- `RT-Thread
143RTOS <https://docs-lvgl-io.translate.goog/master/details/integration/os/rt-thread.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
144- NXP MCUXpresso library - CMSIS-Pack
145
146:robot:
147サンプルプログラム
148--------------------------
149
150ウィジェット・レイアウト・スタイルのサンプルプログラムを用意しました。 C
151と MicroPython のコードを選べます。 オンラインの MicroPythonエディタ
152へのリンクにより、サンプルプログラムの動作確認・編集もできます。
153
154その他のサンプルプログラムは `Examples
155フォルダ <https://github.com/lvgl/lvgl/tree/master/examples>`__ :gb:
156を確認してください。
157
158Button with Click Event
159~~~~~~~~~~~~~~~~~~~~~~~
160
161.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_1.gif
162 :alt: ラベル付きボタンのLVGLサンプルプログラム
163
164 ラベル付きボタンのLVGLサンプルプログラム
165
166.. raw:: html
167
168 <details>
169
170.. raw:: html
171
172 <summary>
173
174C code
175
176.. raw:: html
177
178 </summary>
179
180.. code-block:: c
181
182 lv_obj_t * btn = lv_button_create(lv_screen_active()); /*Add a button to the current screen*/
183 lv_obj_center(btn); /*Set its position*/
184 lv_obj_set_size(btn, 100, 50); /*Set its size*/
185 lv_obj_add_event(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
186
187 lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
188 lv_label_set_text(label, "Button"); /*Set the labels text*/
189 lv_obj_center(label); /*Align the label to the center*/
190 ...
191
192 void btn_event_cb(lv_event_t * e)
193 {
194 printf("Clicked\n");
195 }
196
197.. raw:: html
198
199 </details>
200
201.. raw:: html
202
203 <details>
204
205.. raw:: html
206
207 <summary>
208
209MicroPython code \| Online Simulator :gb:
210
211.. raw:: html
212
213 </summary>
214
215.. code-block:: python
216
217 def btn_event_cb(e):
218 print("Clicked")
219
220 # Create a Button and a Label
221 btn = lv.btn(lv.scr_act())
222 btn.center()
223 btn.set_size(100, 50)
224 btn.add_event(btn_event_cb, lv.EVENT.CLICKED, None)
225
226 label = lv.label(btn)
227 label.set_text("Button")
228 label.center()
229
230.. raw:: html
231
232 </details>
233
234Checkboxes with Layout
235~~~~~~~~~~~~~~~~~~~~~~
236
237.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_2.gif
238 :alt: Checkboxes with layout in LVGL
239
240 Checkboxes with layout in LVGL
241
242.. raw:: html
243
244 <details>
245
246.. raw:: html
247
248 <summary>
249
250C code
251
252.. raw:: html
253
254 </summary>
255
256.. code-block:: c
257
258
259 lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
260 lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
261
262 lv_obj_t * cb;
263 cb = lv_checkbox_create(lv_screen_active());
264 lv_checkbox_set_text(cb, "Apple");
265 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
266
267 cb = lv_checkbox_create(lv_screen_active());
268 lv_checkbox_set_text(cb, "Banana");
269 lv_obj_add_state(cb, LV_STATE_CHECKED);
270 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
271
272 cb = lv_checkbox_create(lv_screen_active());
273 lv_checkbox_set_text(cb, "Lemon");
274 lv_obj_add_state(cb, LV_STATE_DISABLED);
275 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
276
277 cb = lv_checkbox_create(lv_screen_active());
278 lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
279 lv_checkbox_set_text(cb, "Melon\nand a new line");
280 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
281
282.. raw:: html
283
284 </details>
285
286.. raw:: html
287
288 <details>
289
290.. raw:: html
291
292 <summary>
293
294MicroPython code \| Online Simulator :gb:
295
296.. raw:: html
297
298 </summary>
299
300.. code-block:: python
301
302 def event_handler(e):
303 code = e.get_code()
304 obj = e.get_target_obj()
305 if code == lv.EVENT.VALUE_CHANGED:
306 txt = obj.get_text()
307 if obj.get_state() & lv.STATE.CHECKED:
308 state = "Checked"
309 else:
310 state = "Unchecked"
311 print(txt + ":" + state)
312
313
314 lv.scr_act().set_flex_flow(lv.FLEX_FLOW.COLUMN)
315 lv.scr_act().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)
316
317 cb = lv.checkbox(lv.scr_act())
318 cb.set_text("Apple")
319 cb.add_event(event_handler, lv.EVENT.ALL, None)
320
321 cb = lv.checkbox(lv.scr_act())
322 cb.set_text("Banana")
323 cb.add_state(lv.STATE.CHECKED)
324 cb.add_event(event_handler, lv.EVENT.ALL, None)
325
326 cb = lv.checkbox(lv.scr_act())
327 cb.set_text("Lemon")
328 cb.add_state(lv.STATE.DISABLED)
329 cb.add_event(event_handler, lv.EVENT.ALL, None)
330
331 cb = lv.checkbox(lv.scr_act())
332 cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
333 cb.set_text("Melon")
334 cb.add_event(event_handler, lv.EVENT.ALL, None)
335
336.. raw:: html
337
338 </details>
339
340Styling a Slider
341~~~~~~~~~~~~~~~~
342
343.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_3.gif
344 :alt: Styling a slider with LVGL
345
346 Styling a slider with LVGL
347
348.. raw:: html
349
350 <details>
351
352.. raw:: html
353
354 <summary>
355
356C code
357
358.. raw:: html
359
360 </summary>
361
362.. code-block:: c
363
364 lv_obj_t * slider = lv_slider_create(lv_screen_active());
365 lv_slider_set_value(slider, 70, LV_ANIM_OFF);
366 lv_obj_set_size(slider, 300, 20);
367 lv_obj_center(slider);
368
369 /*Add local styles to MAIN part (background rectangle)*/
370 lv_obj_set_style_bg_color(slider, lv_color_hex(0x0F1215), LV_PART_MAIN);
371 lv_obj_set_style_bg_opa(slider, 255, LV_PART_MAIN);
372 lv_obj_set_style_border_color(slider, lv_color_hex(0x333943), LV_PART_MAIN);
373 lv_obj_set_style_border_width(slider, 5, LV_PART_MAIN);
374 lv_obj_set_style_pad_all(slider, 5, LV_PART_MAIN);
375
376 /*Create a reusable style sheet for the INDICATOR part*/
377 static lv_style_t style_indicator;
378 lv_style_init(&style_indicator);
379 lv_style_set_bg_color(&style_indicator, lv_color_hex(0x37B9F5));
380 lv_style_set_bg_grad_color(&style_indicator, lv_color_hex(0x1464F0));
381 lv_style_set_bg_grad_dir(&style_indicator, LV_GRAD_DIR_HOR);
382 lv_style_set_shadow_color(&style_indicator, lv_color_hex(0x37B9F5));
383 lv_style_set_shadow_width(&style_indicator, 15);
384 lv_style_set_shadow_spread(&style_indicator, 5);
385
386 /*Add the style sheet to the slider's INDICATOR part*/
387 lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR);
388
389 /*Add the same style to the KNOB part as well and locally overwrite some properties*/
390 lv_obj_add_style(slider, &style_indicator, LV_PART_KNOB);
391
392 lv_obj_set_style_outline_color(slider, lv_color_hex(0x0096FF), LV_PART_KNOB);
393 lv_obj_set_style_outline_width(slider, 3, LV_PART_KNOB);
394 lv_obj_set_style_outline_pad(slider, -5, LV_PART_KNOB);
395 lv_obj_set_style_shadow_spread(slider, 2, LV_PART_KNOB);
396
397.. raw:: html
398
399 </details>
400
401.. raw:: html
402
403 <details>
404
405.. raw:: html
406
407 <summary>
408
409MicroPython code \| Online Simulator :gb:
410
411.. raw:: html
412
413 </summary>
414
415.. code-block:: python
416
417 # Create a slider and add the style
418 slider = lv.slider(lv.scr_act())
419 slider.set_value(70, lv.ANIM.OFF)
420 slider.set_size(300, 20)
421 slider.center()
422
423 # Add local styles to MAIN part (background rectangle)
424 slider.set_style_bg_color(lv.color_hex(0x0F1215), lv.PART.MAIN)
425 slider.set_style_bg_opa(255, lv.PART.MAIN)
426 slider.set_style_border_color(lv.color_hex(0x333943), lv.PART.MAIN)
427 slider.set_style_border_width(5, lv.PART.MAIN)
428 slider.set_style_pad_all(5, lv.PART.MAIN)
429
430 # Create a reusable style sheet for the INDICATOR part
431 style_indicator = lv.style_t()
432 style_indicator.init()
433 style_indicator.set_bg_color(lv.color_hex(0x37B9F5))
434 style_indicator.set_bg_grad_color(lv.color_hex(0x1464F0))
435 style_indicator.set_bg_grad_dir(lv.GRAD_DIR.HOR)
436 style_indicator.set_shadow_color(lv.color_hex(0x37B9F5))
437 style_indicator.set_shadow_width(15)
438 style_indicator.set_shadow_spread(5)
439
440 # Add the style sheet to the slider's INDICATOR part
441 slider.add_style(style_indicator, lv.PART.INDICATOR)
442 slider.add_style(style_indicator, lv.PART.KNOB)
443
444 # Add the same style to the KNOB part as well and locally overwrite some properties
445 slider.set_style_outline_color(lv.color_hex(0x0096FF), lv.PART.KNOB)
446 slider.set_style_outline_width(3, lv.PART.KNOB)
447 slider.set_style_outline_pad(-5, lv.PART.KNOB)
448 slider.set_style_shadow_spread(2, lv.PART.KNOB)
449
450.. raw:: html
451
452 </details>
453
454English, Hebrew (mixed LRT-RTL) and Chinese texts
455~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
456
457.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_4.png
458 :alt: English, Hebrew and Chinese texts with LVGL
459
460 English, Hebrew and Chinese texts with LVGL
461
462.. raw:: html
463
464 <details>
465
466.. raw:: html
467
468 <summary>
469
470C code
471
472.. raw:: html
473
474 </summary>
475
476.. code-block:: c
477
478 lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
479 lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
480 lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
481 lv_obj_set_width(ltr_label, 310);
482 lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
483
484 lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
485 lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
486 lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
487 lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
488 lv_obj_set_width(rtl_label, 310);
489 lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
490
491 lv_obj_t * cz_label = lv_label_create(lv_screen_active());
492 lv_label_set_text(cz_label,
493 "嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
494 lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
495 lv_obj_set_width(cz_label, 310);
496 lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
497
498.. raw:: html
499
500 </details>
501
502.. raw:: html
503
504 <details>
505
506.. raw:: html
507
508 <summary>
509
510MicroPython code \| Online Simulator :gb:
511
512.. raw:: html
513
514 </summary>
515
516.. code-block:: python
517
518 ltr_label = lv.label(lv.scr_act())
519 ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC).")
520 ltr_label.set_style_text_font(lv.font_montserrat_16, 0);
521
522 ltr_label.set_width(310)
523 ltr_label.align(lv.ALIGN.TOP_LEFT, 5, 5)
524
525 rtl_label = lv.label(lv.scr_act())
526 rtl_label.set_text("מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).")
527 rtl_label.set_style_base_dir(lv.BASE_DIR.RTL, 0)
528 rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
529 rtl_label.set_width(310)
530 rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
531
532 font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
533
534 cz_label = lv.label(lv.scr_act())
535 cz_label.set_style_text_font(font_simsun_16_cjk, 0)
536 cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
537 cz_label.set_width(310)
538 cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
539
540.. raw:: html
541
542 </details>
543
544:arrow_forward:
545はじめに
546------------------------
547
548LVGLを使い始める時は、以下の順に進める事をおすすめします。
549
550**LVGLに触れてみましょう**
551
5521. LVGLの動きを
553 `オンラインデモ <https://lvgl-io.translate.goog/demos?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
554 で確認しましょう。 (3分間)
5552. ドキュメントの
556 `Introduction <https://docs-lvgl-io.translate.goog/master/intro/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
557 を読みましょう。 (5分間)
5583. LVGLの基本に慣れるため `Quick
559 overview <https://docs-lvgl-io.translate.goog/master/intro/basics.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
560 を読みましょう。 (15分間)
561
562**LVGLを使ってみましょう**
563
5644. `シミュレータ <https://docs-lvgl-io.translate.goog/master/details/integration/ide/pc-simulator.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
565 をセットアップしましょう。 (10 minutes)
5665. `サンプルプログラム <https://github.com/lvgl/lvgl/tree/master/examples>`__
567 :gb: を動かしてみましょう。
5686. `移植ガイド <https://docs-lvgl-io.translate.goog/master/intro/add-lvgl-to-your-project/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
569 を参考に、LVGLを開発ボードに移植してみましょう。すぐ使える形の
570 `プロジェクト <https://github.com/lvgl?q=lv_port_>`__ :gb:
571 も用意してあります。
572
573**より詳しく体験してみましょう**
574
5757. ライブラリの理解を深めるため
576 `Overview <https://docs-lvgl-io.translate.goog/master/details/main-components/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
577 を読みましょう。 (2~3時間)
5788. ウィジェットの機能や使い方の詳細は
579 `Widgets <https://docs-lvgl-io.translate.goog/master/details/widgets/index.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
580 でご確認ください。
581
582**助け合いましょう**
583
5849. 質問がある場合は `Forum <http://forum.lvgl.io/>`__ :gb:
585 で質問して下さい。
58610. LVGLの改善への協力は大歓迎です。詳細は `Contributing
587 guide <https://docs-lvgl-io.translate.goog/master/CONTRIBUTING.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
588 をご覧ください。 (15分間)
589
590**さらに理解を深めましょう**
591
59211. `SquareLine Studio <https://squareline.io/>`__ :gb:
593 をダウンロードして試用してみましょう。
59412. 技術的サポートが必要であれば、\ `技術サービス <https://lvgl.io/services>`__
595 :gb: に問い合わせて下さい。
596
597:handshake:
598技術サービス
599------------------------
600
601`LVGL
602LLC <https://www.digikey.com/en/design-services-providers/lvgl-kft>`__
603は、LVGLライブラリの確かな背景を元に、UI開発のための様々な技術サービスを提供するために設立されました。
604UIとグラフィックス業界における15年以上の実績を活かし、UIを次のレベルに引き上げるお手伝いを致します。
605
606- **グラフィックデザイン**
607 当社のグラフィックデザイナーは、製品とハードウェアのリソースに合わせて美しくモダンなデザインにするエキスパートです。
608- **UI実装**
609 お客様または弊社で作成したデザインを元に、UIを実装することも可能です。お客様のハードウェアとLVGLを最大限に活用することをお約束します。
610 LVGLにない機能やウィジェットは、私たちが実装しますのでご安心ください。
611- **コンサルタント&技術サポート**
612 UI開発において、価格と時間を要する作業でのリスクを減らすため、コンサルティングも含めてサポート致します。
613- **Board certification** development board または production ready kit
614 を提供している企業に対しては、ボードがLVGLを実行できるようにするためのボード認定を行います。
615
616サンプルは
617`Demos <https://lvgl-io.translate.goog/demos?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
618をご覧ください。 詳しくは `Services
619page <https://lvgl-io.translate.goog/services?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
620をご覧ください。
621
622お問い合わせは `問い合わせフォーム <https://lvgl.io/#contact>`__ :gb:
623より送信して下さい。
624
625:star2:
626協力
627------------
628
629LVGLはオープンプロジェクトであり、協力は大歓迎です。
630色々な方法で協力できます。 協力方法の例 -
631LVGLを使用した作品やプロジェクトの公表 - サンプルプログラムの作成 -
632ドキュメントの改善 - バグの修正
633
634協力方法の詳細については、ドキュメントの `Contributing
635section <https://docs-lvgl-io.translate.goog/master/CONTRIBUTING.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja>`__
636をご覧ください。
637
638すでに 300人以上がLVGLに足跡を残しています。いっしょに活動しましょう!
639:slightly_smiling_face:
640
641… and many other.
642
README_pt_BR.rst
1.. raw:: html
2
3 <p align="left">
4 <a href="https://github.com/sponsors/lvgl" target="_blank"><img align="left" src="https://lvgl.io/github-assets/sponsor.png" height="32px"></a>
5 </p>
6
7 <p align="right">
8 <a href="../README.md">English</a>| <a href="./README_zh.rst">中文</a>| <b>Português do Brasil</b> | <a href="./README_jp.rst">日本語</a>
9 </p>
10
11.. raw:: html
12
13 </p>
14
15.. raw:: html
16
17 <p align="center">
18
19
20
21.. raw:: html
22
23 </p>
24
25
26
27.. raw:: html
28
29 <h1 align="center">
30
31LVGL - Biblioteca gráfica leve e versátil
32
33.. raw:: html
34
35 </h1>
36
37
38
39.. raw:: html
40
41 <p align="center">
42
43 Site \| Documentação \| Fórum \| Serviços \| Demonstrações \| Editor SquareLine Studio
44
45.. raw:: html
46
47 </p>
48
49**Visão Geral**
50---------------
51
52**Maduro e popular**
53
54LVGL é a biblioteca gráfica incorporada gratuita e de código aberto mais
55popular para criar belas interfaces de usuário para qualquer display do
56tipo MCU, MPU. Ela é suportada por fornecedores e projetos líderes do
57setor, como ARM, STM32, NXP, Espressif, Nuvoton, Arduino, RT-Thread,
58Zephyr, NuttX, Adafruit e muitos outros.
59
60**Rico em recursos**
61
62Ela tem todos os recursos para a criação de GUIs modernas e bonitas:
63mais de 30 widgets integrados, um sistema de design poderoso,
64gerenciadores de layout inspirados na web e um sistema de tipografia com
65suporte para vários idiomas. Para integrar o LVGL em sua plataforma,
66tudo que você precisa é de pelo menos 32kB de RAM e 128kB de Flash, um
67compilador C, um frame buffer e pelo menos uma tela de tamanho 1/10 para
68renderização.
69
70**Editor UI profissional**
71
72SquareLine Studio é um editor de interface do usuário de (arrasta e
73solta) profissional para LVGL. Ele roda em Windows, Linux e MacOS também
74e você pode experimentá-lo sem se registrar no site.
75
76**Serviços**
77
78Nossa equipe está pronta para ajudá-lo com design gráfico, implementação
79de UI e serviços de consultoria. Entre em contato conosco se precisar de
80algum suporte durante o desenvolvimento de seu próximo projeto de GUI.
81
82**Recursos**
83------------
84
85**Gratuito e portátil**
86
87- Uma biblioteca C totalmente portátil (compatível com C++) sem
88 dependências externas.
89- Pode ser compilado para qualquer display MCU ou MPU, e qualquer
90 sistema operacional de tempo real (RT-OS).
91- Suporta monitores monocromáticos, ePaper, OLED ou TFT. `Guia de
92 portabilidade <https://docs.lvgl.io/master/intro/add-lvgl-to-your-project/connecting_lvgl.html>`__
93- Distribuído sob a licença do MIT, para que você também possa usá-lo
94 facilmente em projetos comerciais.
95- Precisa de apenas 32 kB de RAM e 128 kB de Flash, um frame buffer e
96 pelo menos uma tela de tamanho 1/10 para renderização.
97- Sistemas operacionais, memória externa e GPU são suportados, mas não
98 obrigatórios.
99
100**Widgets, designs, layouts e muito mais**
101
102- Mais de 30 widgets integrados: botão, etiqueta (label), controle
103 deslizante (slider), gráfico (chart), teclado, medidor (meter),
104 tabelas e muito mais.
105- Sistema de design flexível com pelo menos 100 propriedades de estilo
106 para personalizar qualquer parte dos widgets.
107- Mecanismos de layouts Flexbox e Grid para dimensionar e posicionar
108 automaticamente os widgets de maneira responsiva.
109- Os textos são renderizados com codificação UTF-8, suportando sistemas
110 de escrita CJK (chinês, japonês e coreano), tailandês, hindi, árabe e
111 persa.
112- Quebra de palavras (word wrapping), espaçamento entre letras
113 (kerning), rolagem de texto (scrolling), renderização subpixel,
114 entrada em chinês Pinyin-IME e emojis.
115- Mecanismo de renderização que suporta animações, anti-aliasing,
116 opacidade, rolagem suave (smooth scroll), sombras, transformação de
117 imagens, etc.
118- Suporta mouse, touchpad, teclado, botões externos, dispositivos de
119 entrada codificadores (encoders).
120- Suporta vários monitores.
121
122**Suporte de vinculação (binding) e compilação de arquivos**
123
124- Exposição da API do LVGL com o
125 `Micropython <https://blog.lvgl.io/2019-02-20/micropython-bindings>`__
126- Nenhum sistema de compilação personalizado é usado. Você pode
127 construir o LVGL enquanto constrói os outros arquivos do seu projeto.
128- O suporte para Make e
129 `CMake <https://docs.lvgl.io/master/details/integration/building/cmake.html>`__
130 já vem incluído.
131- `Desenvolva no
132 PC <https://docs.lvgl.io/master/details/integration/ide/pc-simulator.html>`__
133 e use o mesmo código de interface do usuário em hardwares
134 incorporados (embedded hardware).
135- Converta o código C para um arquivo HTML com o `Emscripten
136 port <https://github.com/lvgl/lv_web_emscripten>`__.
137
138**Documentação, ferramentas e serviços**
139
140- Documentação detalhada com `+100 exemplos
141 simples <https://docs.lvgl.io/master/index.html>`__
142- `SquareLine Studio <https://squareline.io>`__ - Um software editor UI
143 profissional e fácil de usar, para acelerar e simplificar o
144 desenvolvimento da interface do usuário.
145- `Serviços <https://lvgl.io/services>`__ como design de UI,
146 implementação e consultoria para tornar o desenvolvimento de UI mais
147 simples e rápido.
148
149**Patrocinador**
150----------------
151
152Se o LVGL economizou muito tempo e dinheiro ou você apenas se divertiu
153ao usá-lo, considere Apoiar o desenvolvimento.
154
155**Como e com o que utilizamos os recursos doados?** Nosso objetivo é
156fornecer compensação financeira para as pessoas que mais fazem pelo
157LVGL. Isso significa que não apenas os mantenedores, mas qualquer pessoa
158que implemente um ótimo recurso deve receber um pagamento com o dinheiro
159acumulado. Usamos as doações para cobrir nossos custos operacionais,
160como servidores e serviços relacionados.
161
162**Como doar?** Usamos o `Open
163Collective <https://opencollective.com/lvgl>`__, onde você pode enviar
164facilmente doações únicas ou recorrentes. Você também pode ver todas as
165nossas despesas de forma transparente.
166
167**Como receber o pagamento de sua contribuição?** Se alguém implementar
168ou corrigir um problema rotulado como
169`Patrocinado <https://github.com/lvgl/lvgl/labels/Sponsored>`__, essa
170pessoa receberá um pagamento por esse trabalho. Estimamos o tempo
171necessário, a complexidade e a importância da questão e definimos um
172preço de acordo. Para entrar, apenas comente sobre um problema
173patrocinado dizendo "Olá, gostaria de lidar com isso. É assim que estou
174planejando corrigi-lo/implementá-lo…". Um trabalho é considerado pronto
175quando é aprovado e mesclado por um mantenedor. Depois disso, você pode
176enviar uma "despesa" (expense) pela plataforma
177`opencollective.com <https://opencollective.com/lvgl>`__ e então
178receberá o pagamento em alguns dias.
179
180**Organizações que apoiam o projeto LVGL**\ |Patrocinadores do LVGL|
181
182**Pessoas que apoiam o projeto LVGL**\ |Backers of LVGL|
183
184**Pacotes**
185-----------
186
187LVGL está disponível para:
188
189- `Arduino
190 library <https://docs.lvgl.io/master/details/entegration/framework/arduino.html>`__
191- `PlatformIO
192 package <https://registry.platformio.org/libraries/lvgl/lvgl>`__
193- `Zephyr
194 library <https://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LVGL>`__
195- `ESP32
196 component <https://docs.lvgl.io/master/details/integration/chip/espressif.html>`__
197- `NXP MCUXpresso
198 component <https://www.nxp.com/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY>`__
199- `NuttX
200 library <https://docs.lvgl.io/master/details/integration/os/nuttx.html>`__
201- `RT-Thread
202 RTOS <https://docs.lvgl.io/master/details/integration/os/rt-thread.html>`__
203- NXP MCUXpresso library
204- CMSIS-Pack
205
206**Exemplos**
207------------
208
209Veja como criar um botão com um evento de clique em C e MicroPython.
210Para mais exemplos, veja a pasta
211`examples <https://github.com/lvgl/lvgl/tree/master/examples>`__.
212
213.. figure:: https://github.com/lvgl/lvgl/raw/master/docs/misc/btn_example.png
214 :alt: LVGL button with label example
215
216 LVGL button with label example
217
218Botão com evento de clique
219~~~~~~~~~~~~~~~~~~~~~~~~~~
220
221.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_1.gif
222 :alt: Botão LVGL com exemplo de rótulo (label)
223
224 Botão LVGL com exemplo de rótulo (label)
225
226.. raw:: html
227
228 <details>
229
230.. raw:: html
231
232 <summary>
233
234Código C
235
236.. raw:: html
237
238 </summary>
239
240.. code-block:: c
241
242 lv_obj_t * btn = lv_button_create(lv_screen_active()); /* Adiciona o botão a tela atual */
243 lv_obj_center(btn); /* Define a posição do botão */
244 lv_obj_set_size(btn, 100, 50); /* Define o tamanho do botão */
245 lv_obj_add_event(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /* Atribui um retorno de chamada (callback) ao botão */
246
247 lv_obj_t * label = lv_label_create(btn); /* Adiciona um rótulo (label) */
248 lv_label_set_text(label, "Botão"); /* Define um texto para o rótulo (label) */
249 lv_obj_center(label); /* Alinha o texto no centro do botão */
250 ...
251
252 void btn_event_cb(lv_event_t * e)
253 {
254 printf("Clicado\n");
255 }
256
257.. raw:: html
258
259 </details>
260
261.. raw:: html
262
263 <details>
264
265.. raw:: html
266
267 <summary>
268
269Código MicroPython \| Simulador online
270
271.. raw:: html
272
273 </summary>
274
275.. code-block:: python
276
277 def btn_event_cb(e):
278 print("Clicado")
279
280 # Cria um botão e um rótulo (label)
281 btn = lv.btn(lv.scr_act())
282 btn.center()
283 btn.set_size(100, 50)
284 btn.add_event(btn_event_cb, lv.EVENT.CLICKED, None)
285
286 label = lv.label(btn)
287 label.set_text("Botão")
288 label.center()
289
290.. raw:: html
291
292 </details>
293
294Caixas de seleção (chackboxes) com layout
295~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296
297.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_2.gif
298 :alt: Caixas de seleção (chackboxes) com layout no LVGL
299
300 Caixas de seleção (chackboxes) com layout no LVGL
301
302.. raw:: html
303
304 <details>
305
306.. raw:: html
307
308 <summary>
309
310Código em C
311
312.. raw:: html
313
314 </summary>
315
316.. code-block:: c
317
318
319 lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
320 lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
321
322 lv_obj_t * cb;
323 cb = lv_checkbox_create(lv_screen_active());
324 lv_checkbox_set_text(cb, "Maça");
325 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
326
327 cb = lv_checkbox_create(lv_screen_active());
328 lv_checkbox_set_text(cb, "Banana");
329 lv_obj_add_state(cb, LV_STATE_CHECKED);
330 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
331
332 cb = lv_checkbox_create(lv_screen_active());
333 lv_checkbox_set_text(cb, "Limão");
334 lv_obj_add_state(cb, LV_STATE_DISABLED);
335 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
336
337 cb = lv_checkbox_create(lv_screen_active());
338 lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
339 lv_checkbox_set_text(cb, "Melão\ne uma nova linha");
340 lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
341
342.. raw:: html
343
344 </details>
345
346.. raw:: html
347
348 <details>
349
350.. raw:: html
351
352 <summary>
353
354Código MicroPython \| Online Simulator
355
356.. raw:: html
357
358 </summary>
359
360.. code-block:: python
361
362 def event_handler(e):
363 code = e.get_code()
364 obj = e.get_target_obj()
365 if code == lv.EVENT.VALUE_CHANGED:
366 txt = obj.get_text()
367 if obj.get_state() & lv.STATE.CHECKED:
368 state = "Marcador"
369 else:
370 state = "Desmarcado"
371 print(txt + ":" + state)
372
373
374 lv.scr_act().set_flex_flow(lv.FLEX_FLOW.COLUMN)
375 lv.scr_act().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)
376
377 cb = lv.checkbox(lv.scr_act())
378 cb.set_text("Maça")
379 cb.add_event(event_handler, lv.EVENT.ALL, None)
380
381 cb = lv.checkbox(lv.scr_act())
382 cb.set_text("Banana")
383 cb.add_state(lv.STATE.CHECKED)
384 cb.add_event(event_handler, lv.EVENT.ALL, None)
385
386 cb = lv.checkbox(lv.scr_act())
387 cb.set_text("Limão")
388 cb.add_state(lv.STATE.DISABLED)
389 cb.add_event(event_handler, lv.EVENT.ALL, None)
390
391 cb = lv.checkbox(lv.scr_act())
392 cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
393 cb.set_text("Melão")
394 cb.add_event(event_handler, lv.EVENT.ALL, None)
395
396.. raw:: html
397
398 </details>
399
400Estilizando um controle deslizante (slider)
401~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
402
403.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_3.gif
404 :alt: Estilizando um controle deslizante (slider) com LVGL
405
406 Estilizando um controle deslizante (slider) com LVGL
407
408.. raw:: html
409
410 <details>
411
412.. raw:: html
413
414 <summary>
415
416Código C
417
418.. raw:: html
419
420 </summary>
421
422.. code-block:: c
423
424 lv_obj_t * slider = lv_slider_create(lv_screen_active());
425 lv_slider_set_value(slider, 70, LV_ANIM_OFF);
426 lv_obj_set_size(slider, 300, 20);
427 lv_obj_center(slider);
428
429 /* Adiciona estilos locais à parte MAIN (retângulo de fundo) */
430 lv_obj_set_style_bg_color(slider, lv_color_hex(0x0F1215), LV_PART_MAIN);
431 lv_obj_set_style_bg_opa(slider, 255, LV_PART_MAIN);
432 lv_obj_set_style_border_color(slider, lv_color_hex(0x333943), LV_PART_MAIN);
433 lv_obj_set_style_border_width(slider, 5, LV_PART_MAIN);
434 lv_obj_set_style_pad_all(slider, 5, LV_PART_MAIN);
435
436 /* Crie uma folha de estilo reutilizável para a parte do (INDICADOR) */
437 static lv_style_t style_indicator;
438 lv_style_init(&style_indicator);
439 lv_style_set_bg_color(&style_indicator, lv_color_hex(0x37B9F5));
440 lv_style_set_bg_grad_color(&style_indicator, lv_color_hex(0x1464F0));
441 lv_style_set_bg_grad_dir(&style_indicator, LV_GRAD_DIR_HOR);
442 lv_style_set_shadow_color(&style_indicator, lv_color_hex(0x37B9F5));
443 lv_style_set_shadow_width(&style_indicator, 15);
444 lv_style_set_shadow_spread(&style_indicator, 5);
445
446 /* Adicione a folha de estilo à parte do INDICATOR do controle deslizante (slider) */
447 lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR);
448
449 /* Adicione o mesmo estilo à parte do KNOB e sobrescreva localmente algumas propriedades */
450 lv_obj_add_style(slider, &style_indicator, LV_PART_KNOB);
451
452 lv_obj_set_style_outline_color(slider, lv_color_hex(0x0096FF), LV_PART_KNOB);
453 lv_obj_set_style_outline_width(slider, 3, LV_PART_KNOB);
454 lv_obj_set_style_outline_pad(slider, -5, LV_PART_KNOB);
455 lv_obj_set_style_shadow_spread(slider, 2, LV_PART_KNOB);
456
457.. raw:: html
458
459 </details>
460
461.. raw:: html
462
463 <details>
464
465.. raw:: html
466
467 <summary>
468
469Código MicroPython \| Simulador online
470
471.. raw:: html
472
473 </summary>
474
475.. code-block:: python
476
477 # Crie um controle deslizante (slider) e adicione o estilo
478 slider = lv.slider(lv.scr_act())
479 slider.set_value(70, lv.ANIM.OFF)
480 slider.set_size(300, 20)
481 slider.center()
482
483 # Adicione estilos locais à parte MAIN (retângulo de fundo)
484 slider.set_style_bg_color(lv.color_hex(0x0F1215), lv.PART.MAIN)
485 slider.set_style_bg_opa(255, lv.PART.MAIN)
486 slider.set_style_border_color(lv.color_hex(0x333943), lv.PART.MAIN)
487 slider.set_style_border_width(5, lv.PART.MAIN)
488 slider.set_style_pad_all(5, lv.PART.MAIN)
489
490 # Crie uma folha de estilo reutilizável para a parte do INDICATOR
491 style_indicator = lv.style_t()
492 style_indicator.init()
493 style_indicator.set_bg_color(lv.color_hex(0x37B9F5))
494 style_indicator.set_bg_grad_color(lv.color_hex(0x1464F0))
495 style_indicator.set_bg_grad_dir(lv.GRAD_DIR.HOR)
496 style_indicator.set_shadow_color(lv.color_hex(0x37B9F5))
497 style_indicator.set_shadow_width(15)
498 style_indicator.set_shadow_spread(5)
499
500 # Adicione a folha de estilo à parte do INDICATOR do controle deslizante (slider)
501 slider.add_style(style_indicator, lv.PART.INDICATOR)
502 slider.add_style(style_indicator, lv.PART.KNOB)
503
504 # Adicione o mesmo estilo à parte do KNOB e sobrescreva localmente algumas propriedades
505 slider.set_style_outline_color(lv.color_hex(0x0096FF), lv.PART.KNOB)
506 slider.set_style_outline_width(3, lv.PART.KNOB)
507 slider.set_style_outline_pad(-5, lv.PART.KNOB)
508 slider.set_style_shadow_spread(2, lv.PART.KNOB)
509
510.. raw:: html
511
512 </details>
513
514Textos em inglês, hebraico (LRT-RTL misto) e chinês
515~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
516
517.. figure:: https://github.com/kisvegabor/test/raw/master/readme_example_4.png
518 :alt: Textos em inglês, hebraico (LRT-RTL misto) e chinês com LVGL
519
520 Textos em inglês, hebraico (LRT-RTL misto) e chinês com LVGL
521
522.. raw:: html
523
524 <details>
525
526.. raw:: html
527
528 <summary>
529
530Código C
531
532.. raw:: html
533
534 </summary>
535
536.. code-block:: c
537
538 lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
539 lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
540 lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
541 lv_obj_set_width(ltr_label, 310);
542 lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
543
544 lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
545 lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
546 lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
547 lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
548 lv_obj_set_width(rtl_label, 310);
549 lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
550
551 lv_obj_t * cz_label = lv_label_create(lv_screen_active());
552 lv_label_set_text(cz_label,
553 "嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
554 lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
555 lv_obj_set_width(cz_label, 310);
556 lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
557
558.. raw:: html
559
560 </details>
561
562.. raw:: html
563
564 <details>
565
566.. raw:: html
567
568 <summary>
569
570Código MicroPython \| Simulador online
571
572.. raw:: html
573
574 </summary>
575
576.. code-block:: python
577
578 ltr_label = lv.label(lv.scr_act())
579 ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC).")
580 ltr_label.set_style_text_font(lv.font_montserrat_16, 0);
581
582 ltr_label.set_width(310)
583 ltr_label.align(lv.ALIGN.TOP_LEFT, 5, 5)
584
585 rtl_label = lv.label(lv.scr_act())
586 rtl_label.set_text("מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).")
587 rtl_label.set_style_base_dir(lv.BASE_DIR.RTL, 0)
588 rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
589 rtl_label.set_width(310)
590 rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
591
592 font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
593
594 cz_label = lv.label(lv.scr_act())
595 cz_label.set_style_text_font(font_simsun_16_cjk, 0)
596 cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
597 cz_label.set_width(310)
598 cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
599
600.. raw:: html
601
602 </details>
603
604**Começando**
605-------------
606
607Esta lista irá guiá-lo para começar com o LVGL passo a passo.
608
609**Familiarize-se com o LVGL**
610
6111. Confira as `demos on-line <https://lvgl.io/demos>`__ para ver o LVGL
612 em ação (~3 minutos)
6132. Leia a página de
614 `introdução <https://docs.lvgl.io/master/intro/index.html>`__ da
615 documentação (~5 minutos)
6163. Familiarize-se com o básico na página de `visão geral
617 rápida <https://docs.lvgl.io/master/intro/basics.html>`__
618 (~15 minutos)
619
620**Começando a usar o LVGL**
621
6224. Configure um
623 `simulador <https://docs.lvgl.io/master/details/integration/ide/pc-simulator.html>`__
624 (~10 minutos)
6255. Experimente alguns
626 `exemplos <https://github.com/lvgl/lvgl/tree/master/examples>`__
6276. Porte o LVGL para uma placa. Veja o guia `portando o
628 LVGL <https://docs.lvgl.io/master/intro/add-lvgl-to-your-project/index.html>`__ ou veja um
629 projeto pronto para usar em
630 `projetos <https://github.com/lvgl?q=lv_port_>`__
631
632**Torne-se um profissional**
633
6347. Leia a página `visão
635 geral <https://docs.lvgl.io/master/details/main-components/index.html>`__ para
636 entender melhor a biblioteca (~2-3 horas)
6378. Verifique a documentação dos
638 `widgets <https://docs.lvgl.io/master/details/widgets/index.html>`__ para ver
639 seus recursos e usabilidade
640
641**Obtenha ajuda e ajude outras pessoas**
642
6439. Se você tiver dúvidas, acesse o `Fórum <http://forum.lvgl.io>`__
64410. Leia o guia de
645 `contribuição <https://docs.lvgl.io/master/CONTRIBUTING.html>`__
646 para ver como você pode ajudar a melhorar o LVGL (~15 minutos)
647
648**E mais**
649
65011. Baixe e experimente o editor `SquareLine
651 Studio <https://squareline.io>`__.
65212. Entre em contato conosco para `serviços e
653 consultoria <https://lvgl.io/services>`__.
654
655**Serviços**
656------------
657
658A LVGL LLC foi criada para fornecer uma base sólida para a biblioteca
659LVGL e oferecer vários tipos de serviços para ajudá-lo no
660desenvolvimento da sua interface do usuário. Com mais de 15 anos de
661experiência na indústria gráfica e de interface do usuário, podemos
662ajudá-lo a levar sua interface do usuário para o próximo nível.
663
664- **Design gráfico**: Nossos designers gráficos internos são
665 especialistas em criar belos designs modernos que se adaptam ao seu
666 produto e aos recursos do seu hardware.
667- **Implementação da interface do usuário**: Também podemos implementar
668 sua interface do usuário com base no design que você ou nós criamos.
669 Você pode ter certeza de que tiraremos o máximo proveito de seu
670 hardware e do LVGL. Se um recurso ou widget estiver faltando no LVGL,
671 não se preocupe, nós o implementaremos para você.
672- **Consultoria e Suporte**: Também podemos apoiá-lo com consultoria
673 para evitar erros que podem te custar caros durante o desenvolvimento
674 da sua interface do usuário.
675- **Certificação**: Para empresas que oferecem placas para
676 desenvolvimento ou kits prontos para produção, fazemos certificação
677 que mostram como uma placa pode executar o LVGL.
678
679Confira nossas `demonstrações <https://lvgl.io/demos>`__ como
680referência. Para obter mais informações, consulte a `página de
681serviços <https://lvgl.io/services>`__.
682
683`Fale conosco <https://lvgl.io/#contact>`__ e conte como podemos ajudar.
684
685**Contribuindo**
686----------------
687
688O LVGL é um projeto aberto e sua contribuição é muito bem-vinda. Há
689muitas maneiras de contribuir, desde simplesmente falando sobre seu
690projeto, escrevendo exemplos, melhorando a documentação, corrigindo bugs
691até hospedar seu próprio projeto sob a organização LVGL.
692
693Para obter uma descrição detalhada das oportunidades de contribuição,
694visite a página de
695`contribuição <https://docs.lvgl.io/master/CONTRIBUTING.html>`__ da
696documentação.
697
698Mais de 300 pessoas já deixaram sua impressão digital no LVGL. Seja um
699deles! Veja o seu aqui! :slightly_smiling_face:
700
701… e muitos outros.
702
703.. |Patrocinadores do LVGL| image:: https://opencollective.com/lvgl/organizations.svg?width=600
704 :target: https://opencollective.com/lvgl
705.. |Backers of LVGL| image:: https://opencollective.com/lvgl/individuals.svg?width=600
706 :target: https://opencollective.com/lvgl
707
README_zh.rst
1.. raw:: html
2
3 <p align="left">
4 <a href="https://github.com/sponsors/lvgl" target="_blank"><img align="left" src="https://lvgl.io/github-assets/sponsor.png" height="32px"></a>
5 </p>
6
7 <p align="right">
8 <a href="../README.md">English</a>| <b>中文</b>| <a href="./README_pt_BR.rst">Português do Brasil</a> | <a href="./README_jp.rst">日本語</a>
9 </p>
10
11.. raw:: html
12
13 <br>
14
15.. raw:: html
16
17 <p align="center">
18 <img src="https://lvgl.io/github-assets/logo-colored.png" width=300px>
19 </p>
20
21.. raw:: html
22
23 <h1 align="center">
24 轻量级通用型图形库
25
26.. raw:: html
27
28 </h1>
29
30.. raw:: html
31
32 <div align="center">
33 <img src="https://lvgl.io/github-assets/smartwatch-demo.gif">
34
35 <img border="1px" src="https://lvgl.io/github-assets/widgets-demo.gif">
36 </div>
37 <br>
38 <p align="center">
39 <a href="https://lvgl.io" title="Homepage of LVGL">官网 </a> |
40 <a href="https://docs.lvgl.io/" title="Detailed documentation with 100+ examples">文档</a> |
41 <a href="https://forum.lvgl.io" title="Get help and help others">论坛</a> |
42 <a href="https://lvgl.io/demos" title="Demos running in your browser">示例</a> |
43 <a href="https://lvgl.io/services" title="Graphics design, UI implementation and consulting">服务</a>
44 </p>
45 <br>
46
47.. _ledger-概况与总览:
48
49 概况与总览
50-------------
51
52**成熟且知名**\
53
54LVGL 是最流行的免费开源嵌入式图形库,可以为任何 MCU、MPU 和显示类型创建漂亮的 UI。它得到了行业领先供应商和项目的支持,如 Arm、STM32、NXP、Espressif、Nuvoton、Arduino、RT-Thread、Zephyr、NuttX、Adafruit 等。
55
56**功能丰富**\
57
58它拥有创建现代美观 GUI 的所有功能:30 多个内置控件、强大的样式系统、Web 启发的布局管理器和支持多种语言的排版系统。要将 LVGL 集成到您的平台中,您只需要至少 32 KB
59RAM 和 128 KB Flash、C 编译器、帧缓冲区和至少 1/10 屏幕大小的渲染缓冲区。
60
61**服务**\
62
63我们的团队随时准备为您提供图形设计、UI 实现和咨询服务。如果您在开发下一个 GUI 项目时需要一些支持,请与我们联系。
64
65.. _rocket-特性:
66
67 特性
68-------
69
70**免费和可移植性**
71
72- 一个完全可移植的 C(C++ 兼容)库,没有外部依赖关系。
73- 可以编译到任何 MCU 或 MPU,使用任何 RTOS 或者操作系统。
74- 支持单色、ePaper、OLED、TFT 显示器或者模拟器。
75 `移植指南 <https://docs.lvgl.io/master/intro/add-lvgl-to-your-project/connecting_lvgl.html>`__
76- 该项目使用 MIT 许可证,因此您可以在商业项目中轻松使用它。
77- 仅需 32 KB RAM 和 128 KB Flash,一个帧缓冲区,以及至少 1/10 屏幕大小的渲染缓冲区。
78- 支持使用可选的操作系统、外部存储器和 GPU。
79
80**控件、样式、布局等**
81
82- 30+ 内置\ `控件 <https://docs.lvgl.io/master/details/widgets/index.html>`__:
83 按钮、标签、滑块、图表、键盘、仪表、弧形、表格等等。
84- 灵活的\ `样式系统 <https://docs.lvgl.io/master/details/base-widget/styles/style.html>`__
85 支持约 100 个样式属性,可在任何状态下自定义控件的任何部分。
86- `Flex 布局 <https://docs.lvgl.io/master/details/base-widget/layouts/flex.html>`__ 和
87 `Grid 布局 <https://docs.lvgl.io/master/details/base-widget/layouts/grid.html>`__
88 可以响应式自动调整控件的大小和位置。
89- 文本支持 UTF-8 编码,支持 CJK、泰语、印地语、阿拉伯语和波斯语书写系统。
90- 支持自动换行、字距调整、文本滚动、亚像素渲染、拼音输入法、文本表情符号。
91- 渲染引擎支持动画、抗锯齿、不透明度、平滑滚动、阴影、图形变换等。
92- 支持鼠标、触摸板、小键盘、键盘、外部按钮、编码器\ `输入设备 <https://docs.lvgl.io/master/details/main-components/indev.html>`__\ 。
93- 支持\ `多显示器 <https://docs.lvgl.io/master/details/main-components/display.html#multiple-display-support>`__\ 。
94
95**绑定和构建支持**
96
97- `MicroPython 绑定 <https://blog.lvgl.io/2019-02-20/micropython-bindings>`__
98 公开 LVGL的API
99- `PikaScript 绑定 <https://blog.lvgl.io/2022-08-24/pikascript-and-lvgl>`__
100 在 MCU 上的更轻更简单的 Python 版本
101- 未使用自定义生成系统。您可以在构建项目的其他文件时构建 LVGL。
102- 支持开箱即用的 Make 和 \ `CMake <https://docs.lvgl.io/master/details/integration/building/cmake.html>`__\ 编译系统。
103- 支持在 \ `PC 上开发 <https://docs.lvgl.io/master/integration/ide/pc-simulator.html>`__\ ,并可以在嵌入式硬件上使用相同的 UI 代码。
104- 支持使用我们的 \ `Emscripten 移植 <https://github.com/lvgl/lv_web_emscripten>`__\ 从而将 C 写的 UI 代码转换为 HTML 文件。
105
106**文档、工具和服务**
107
108- 包含 \ `100 多个简单示例 <https://docs.lvgl.io/master/index.html>`__\ 的详细\ `文档 <https://docs.lvgl.io/>`__
109- `服务 <https://lvgl.io/services>`__
110 如用户界面设计、实施和咨询,使 UI 开发更简单、更快。
111
112.. _heart-赞助:
113
114❤️ 赞助
115-------
116
117如果 LVGL 为您节省了大量时间和金钱,或者您只是在使用它时玩得很开心,请考虑\ `支持它的开发 <https://github.com/sponsors/lvgl>`__\ 。
118
119**我们如何使用捐赠?**\
120
121我们的目标是为 LVGL 做得最多的人提供经济补偿。这意味着不仅维护人员,而且任何实现伟大功能的人都应该从累积的资金中获得报酬。我们用捐款来支付服务器和相关服务等运营成本。
122
123**如何捐赠?**\
124
125我们使用 \ `GitHub Sponsors <https://github.com/sponsors/lvgl>`__\ ,您可以轻松发送一次性或定期捐款。您还可以以透明的方式查看我们的所有费用。
126
127**如何从您的贡献中获取报酬?**\
128
129如果有人实施或修复了一个标记为\ `赞助 <https://github.com/lvgl/lvgl/labels/Sponsored>`__\ 的问题,他或她将获得该工作的报酬。我们估计问题所需的时间、复杂性和重要性,并据此设定价格。直接评论一个赞助的问题,说“嗨,我想处理它。这就是我计划修复/实施它的方式…”。当维护人员批准并合并工作时,就认为它已经准备好了。之后,您可以在 \ `opencollective.com <https://opencollective.com/lvgl>`__\ 上提交并支付费用,几天后您将收到付款。
130
131**支持 LVGL 的组织**\
132
133|Sponsors of LVGL|
134
135**支持 LVGL 的个人**\
136
137|Backers of LVGL|
138
139.. _package-支持包:
140
141 支持包
142---------
143
144LVGL 可用于以下几种:
145
146- `Arduino
147 library <https://docs.lvgl.io/master/integration/framework/arduino.html>`__
148- `PlatformIO
149 package <https://registry.platformio.org/libraries/lvgl/lvgl>`__
150- `Zephyr
151 library <https://docs.lvgl.io/master/integration/os/zephyr.html>`__
152- `ESP-IDF(ESP32)
153 component <https://components.espressif.com/components/lvgl/lvgl>`__
154- `NXP MCUXpresso
155 component <https://www.nxp.com/design/software/embedded-software/lvgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY>`__
156- `NuttX
157 library <https://docs.lvgl.io/master/integration/os/nuttx.html>`__
158- `RT-Thread
159 RTOS <https://docs.lvgl.io/master/integration/os/rt-thread.html>`__
160- CMSIS-Pack
161- `RIOT OS
162 package <https://doc.riot-os.org/group__pkg__lvgl.html#details>`__
163
164.. _robot-示例:
165
166 示例
167-------
168
169请参阅创建控件、使用布局和应用样式的一些示例。您将找到 C 和 MicroPython 代码,以及在在线 MicroPython 编辑器中尝试或编辑示例的链接。
170
171如果要查看更多示例,可查看 \ `Examples <https://github.com/lvgl/lvgl/tree/master/examples>`__ 文件夹。
172
173Hello world 标签
174~~~~~~~~~~~~~~~~
175
176.. image:: https://github.com/kisvegabor/test/raw/master/readme_example_1.png
177 :alt: Simple Hello world label example in LVGL
178
179.. raw:: html
180
181 <details>
182 <summary>C code</summary>
183
184.. code-block:: c
185
186 /* Change Active Screen's background color */
187 lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
188
189 /*Create a white label, set its text and align it to the center*/
190 lv_obj_t * label = lv_label_create(lv_screen_active());
191 lv_label_set_text(label, "Hello world");
192 lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
193 lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
194
195.. raw:: html
196
197 </details>
198
199.. raw:: html
200
201 <details>
202 <summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_direct=4ab7c40c35b0dc349aa2f0c3b00938d7d8e8ac9f" target="_blank">在线模拟器</a></summary>
203
204.. code-block:: python
205
206 # Change Active Screen's background color
207 scr = lv.screen_active()
208 scr.set_style_bg_color(lv.color_hex(0x003a57), lv.PART.MAIN)
209
210 # Create a white label, set its text and align it to the center
211 label = lv.label(lv.screen_active())
212 label.set_text("Hello world")
213 label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
214 label.align(lv.ALIGN.CENTER, 0, 0)
215
216.. raw:: html
217
218 </details>
219 <br>
220
221按钮与点击事件
222~~~~~~~~~~~~~~
223
224.. image:: https://github.com/kisvegabor/test/raw/master/readme_example_2.gif
225 :alt: LVGL button with label example
226
227.. raw:: html
228
229 <details>
230 <summary>C code</summary>
231
232.. code-block:: c
233
234 lv_obj_t * button = lv_button_create(lv_screen_active()); /*Add a button to the current screen*/
235 lv_obj_center(button); /*Set its position*/
236 lv_obj_set_size(button, 100, 50); /*Set its size*/
237 lv_obj_add_event_cb(button, button_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
238
239 lv_obj_t * label = lv_label_create(button); /*Add a label to the button*/
240 lv_label_set_text(label, "Button"); /*Set the labels text*/
241 lv_obj_center(label); /*Align the label to the center*/
242 ...
243
244 void button_event_cb(lv_event_t * e)
245 {
246 printf("Clicked\n");
247 }
248
249.. raw:: html
250
251 </details>
252
253.. raw:: html
254
255 <details>
256 <summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=926bde43ec7af0146c486de470c53f11f167491e" target="_blank">在线模拟器</a></summary>
257
258.. code-block:: python
259
260 def button_event_cb(e):
261 print("Clicked")
262
263 # Create a Button and a Label
264 button = lv.button(lv.screen_active())
265 button.center()
266 button.set_size(100, 50)
267 button.add_event_cb(button_event_cb, lv.EVENT.CLICKED, None)
268
269 label = lv.label(button)
270 label.set_text("Button")
271 label.center()
272
273.. raw:: html
274
275 </details>
276 <br>
277
278带布局的复选框
279~~~~~~~~~~~~~~
280
281.. image:: https://github.com/kisvegabor/test/raw/master/readme_example_3.gif
282 :alt: Checkboxes with layout in LVGL
283
284.. raw:: html
285
286 <details>
287 <summary>C code</summary>
288
289.. code-block:: c
290
291
292 lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
293 lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
294
295 lv_obj_t * cb;
296 cb = lv_checkbox_create(lv_screen_active());
297 lv_checkbox_set_text(cb, "Apple");
298 lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
299
300 cb = lv_checkbox_create(lv_screen_active());
301 lv_checkbox_set_text(cb, "Banana");
302 lv_obj_add_state(cb, LV_STATE_CHECKED);
303 lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
304
305 cb = lv_checkbox_create(lv_screen_active());
306 lv_checkbox_set_text(cb, "Lemon");
307 lv_obj_add_state(cb, LV_STATE_DISABLED);
308 lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
309
310 cb = lv_checkbox_create(lv_screen_active());
311 lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
312 lv_checkbox_set_text(cb, "Melon\nand a new line");
313 lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
314
315.. raw:: html
316
317 </details>
318
319.. raw:: html
320
321 <details>
322 <summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=311d37e5f70daf1cb0d2cad24c7f72751b5f1792" target="_blank">在线模拟器</a></summary>
323
324.. code-block:: python
325
326 def event_handler(e):
327 code = e.get_code()
328 obj = e.get_target_obj()
329 if code == lv.EVENT.VALUE_CHANGED:
330 txt = obj.get_text()
331 if obj.get_state() & lv.STATE.CHECKED:
332 state = "Checked"
333 else:
334 state = "Unchecked"
335 print(txt + ":" + state)
336
337
338 lv.screen_active().set_flex_flow(lv.FLEX_FLOW.COLUMN)
339 lv.screen_active().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)
340
341 cb = lv.checkbox(lv.screen_active())
342 cb.set_text("Apple")
343 cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
344
345 cb = lv.checkbox(lv.screen_active())
346 cb.set_text("Banana")
347 cb.add_state(lv.STATE.CHECKED)
348 cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
349
350 cb = lv.checkbox(lv.screen_active())
351 cb.set_text("Lemon")
352 cb.add_state(lv.STATE.DISABLED)
353 cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
354
355 cb = lv.checkbox(lv.screen_active())
356 cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
357 cb.set_text("Melon")
358 cb.add_event_cb(event_handler, lv.EVENT.ALL, None)
359
360.. raw:: html
361
362 </details>
363 <br>
364
365设置滑块的样式
366~~~~~~~~~~~~~~
367
368.. image:: https://github.com/kisvegabor/test/raw/master/readme_example_4.gif
369 :alt: Styling a slider with LVGL
370
371.. raw:: html
372
373 <details>
374 <summary>C code</summary>
375
376.. code-block:: c
377
378 lv_obj_t * slider = lv_slider_create(lv_screen_active());
379 lv_slider_set_value(slider, 70, LV_ANIM_OFF);
380 lv_obj_set_size(slider, 300, 20);
381 lv_obj_center(slider);
382
383 /*Add local styles to MAIN part (background rectangle)*/
384 lv_obj_set_style_bg_color(slider, lv_color_hex(0x0F1215), LV_PART_MAIN);
385 lv_obj_set_style_bg_opa(slider, 255, LV_PART_MAIN);
386 lv_obj_set_style_border_color(slider, lv_color_hex(0x333943), LV_PART_MAIN);
387 lv_obj_set_style_border_width(slider, 5, LV_PART_MAIN);
388 lv_obj_set_style_pad_all(slider, 5, LV_PART_MAIN);
389
390 /*Create a reusable style sheet for the INDICATOR part*/
391 static lv_style_t style_indicator;
392 lv_style_init(&style_indicator);
393 lv_style_set_bg_color(&style_indicator, lv_color_hex(0x37B9F5));
394 lv_style_set_bg_grad_color(&style_indicator, lv_color_hex(0x1464F0));
395 lv_style_set_bg_grad_dir(&style_indicator, LV_GRAD_DIR_HOR);
396 lv_style_set_shadow_color(&style_indicator, lv_color_hex(0x37B9F5));
397 lv_style_set_shadow_width(&style_indicator, 15);
398 lv_style_set_shadow_spread(&style_indicator, 5);
399 4
400 /*Add the style sheet to the slider's INDICATOR part*/
401 lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR);
402
403 /*Add the same style to the KNOB part as well and locally overwrite some properties*/
404 lv_obj_add_style(slider, &style_indicator, LV_PART_KNOB);
405
406 lv_obj_set_style_outline_color(slider, lv_color_hex(0x0096FF), LV_PART_KNOB);
407 lv_obj_set_style_outline_width(slider, 3, LV_PART_KNOB);
408 lv_obj_set_style_outline_pad(slider, -5, LV_PART_KNOB);
409 lv_obj_set_style_shadow_spread(slider, 2, LV_PART_KNOB);
410
411.. raw:: html
412
413 </details>
414
415.. raw:: html
416
417 <details>
418 <summary>MicroPython code |
419 <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=c431c7b4dfd2cc0dd9c392b74365d5af6ea986f0" target="_blank">在线模拟器</a>
420 </summary>
421
422.. code-block:: python
423
424 # Create a slider and add the style
425 slider = lv.slider(lv.screen_active())
426 slider.set_value(70, lv.ANIM.OFF)
427 slider.set_size(300, 20)
428 slider.center()
429
430 # Add local styles to MAIN part (background rectangle)
431 slider.set_style_bg_color(lv.color_hex(0x0F1215), lv.PART.MAIN)
432 slider.set_style_bg_opa(255, lv.PART.MAIN)
433 slider.set_style_border_color(lv.color_hex(0x333943), lv.PART.MAIN)
434 slider.set_style_border_width(5, lv.PART.MAIN)
435 slider.set_style_pad_all(5, lv.PART.MAIN)
436
437 # Create a reusable style sheet for the INDICATOR part
438 style_indicator = lv.style_t()
439 style_indicator.init()
440 style_indicator.set_bg_color(lv.color_hex(0x37B9F5))
441 style_indicator.set_bg_grad_color(lv.color_hex(0x1464F0))
442 style_indicator.set_bg_grad_dir(lv.GRAD_DIR.HOR)
443 style_indicator.set_shadow_color(lv.color_hex(0x37B9F5))
444 style_indicator.set_shadow_width(15)
445 style_indicator.set_shadow_spread(5)
446
447 # Add the style sheet to the slider's INDICATOR part
448 slider.add_style(style_indicator, lv.PART.INDICATOR)
449 slider.add_style(style_indicator, lv.PART.KNOB)
450
451 # Add the same style to the KNOB part as well and locally overwrite some properties
452 slider.set_style_outline_color(lv.color_hex(0x0096FF), lv.PART.KNOB)
453 slider.set_style_outline_width(3, lv.PART.KNOB)
454 slider.set_style_outline_pad(-5, lv.PART.KNOB)
455 slider.set_style_shadow_spread(2, lv.PART.KNOB)
456
457.. raw:: html
458
459 </details>
460 <br>
461
462英语、希伯来语( 双向文本排版 )和中文
463~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464
465.. image:: https://github.com/kisvegabor/test/raw/master/readme_example_5.png
466 :alt: English, Hebrew and Chinese texts with LVGL
467
468.. raw:: html
469
470 <details>
471 <summary>C code</summary>
472
473.. code-block:: c
474
475 lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
476 lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
477 lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
478 lv_obj_set_width(ltr_label, 310);
479 lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
480
481 lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
482 lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
483 lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
484 lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
485 lv_obj_set_width(rtl_label, 310);
486 lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
487
488 lv_obj_t * cz_label = lv_label_create(lv_screen_active());
489 lv_label_set_text(cz_label,
490 "嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
491 lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
492 lv_obj_set_width(cz_label, 310);
493 lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
494
495.. raw:: html
496
497 </details>
498
499.. raw:: html
500
501 <details>
502 <summary>MicroPython code | <a href="https://sim.lvgl.io/v8.3/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/0d9ab4ee0e591aad1970e3c9164fd7c544ecce70/examples/widgets/slider/lv_example_slider_2.py&script_direct=18bb38200a64e10ead1aa17a65c977fc18131842" target="_blank">在线模拟器</a></summary>
503
504.. code-block:: python
505
506 ltr_label = lv.label(lv.screen_active())
507 ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC).")
508 ltr_label.set_style_text_font(lv.font_montserrat_16, 0);
509
510 ltr_label.set_width(310)
511 ltr_label.align(lv.ALIGN.TOP_LEFT, 5, 5)
512
513 rtl_label = lv.label(lv.screen_active())
514 rtl_label.set_text("מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).")
515 rtl_label.set_style_base_dir(lv.BASE_DIR.RTL, 0)
516 rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
517 rtl_label.set_width(310)
518 rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
519
520 font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
521
522 cz_label = lv.label(lv.screen_active())
523 cz_label.set_style_text_font(font_simsun_16_cjk, 0)
524 cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
525 cz_label.set_width(310)
526 cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
527
528.. raw:: html
529
530 </details>
531
532.. _arrow_forward-使用 lvgl 过程:
533
534▶️ 使用 LVGL 过程
535---------------
536
537此列表将指导您逐步开始使用 LVGL。
538
539**熟悉 LVGL**
540
5411. 查看\ `在线演示 <https://lvgl.io/demos>`__\ ,了解 LVGL 的实际操作(3 分钟)
5422. 阅读\ `文档 <https://docs.lvgl.io/master/intro/index.html>`__\ 的简介页(5 分钟)
5433. 熟悉\ `快速概览 <https://docs.lvgl.io/master/intro/basics.html>`__
544 页面上的基本知识(15 分钟)
545
546**开始使用 LVGL**
547
5484. 设置\ `模拟器 <https://docs.lvgl.io/master/integration/ide/pc-simulator.html#simulator>`__ (10 分钟)
5495. 尝试一些\ `示例 <https://github.com/lvgl/lvgl/tree/master/examples>`__
5506. 将LVGL端口连接到线路板。请参阅\ `移植 <https://docs.lvgl.io/master/intro/add-lvgl-to-your-project/index.html>`__\ 指南,或查看现成的\ `项目 <https://github.com/lvgl?q=lv_port_>`__
551
552**成为专业人士**
553
5547. 阅读\ `概述 <https://docs.lvgl.io/master/details/main-components/index.html>`__\ 页面以更好地了解图书馆(2-3 小时)
5558. 查看\ `控件 <https://docs.lvgl.io/master/details/widgets/index.html>`__\ 的文档以查看其功能和用法
556
557**获得帮助并帮助他人**
558
5599. 如果您有问题,请访问\ `论坛 <http://forum.lvgl.io/>`__
56010. 阅读\ `贡献 <https://docs.lvgl.io/master/CONTRIBUTING.html>`__\ 指南,了解如何帮助提高 LVGL(15 分钟)
561
562.. _handshake-服务:
563
564 服务
565-------
566
567LVGL LLC 的成立旨在为 LVGL 库提供坚实的背景,并提供多种类型的服务来帮助您进行 UI 开发。凭借在用户界面和图形行业超过15年的经验,我们可以帮助您将 UI 提升到一个新的水平。
568
569- **平面设计**
570 我们的内部图形设计师是创造美丽现代设计的专家,适合您的产品和硬件资源。
571- **UI 实现**
572 我们还可以根据您或我们创建的设计来实现您的 UI。您可以确信,我们将充分利用您的硬件和 LVGL。如果 LVGL 中缺少某个功能或控件,请不要担心,我们会为您实现它。
573- **咨询和支持**
574 我们也可以通过咨询来支持您,以避免在 UI 开发过程中出现昂贵和耗时的错误。
575- **板子认证**
576 对于提供开发板或生产套件的公司,我们会进行板子认证,展示板如何运行 LVGL。
577
578查看我们的 \ `Demos <https://lvgl.io/demos>`__\ 作为参考。有关更多信息,请查看\ `服务页面 <https://lvgl.io/services>`__\ 。
579
580`联系我们 <https://lvgl.io/#contact>`__\ ,告诉我们如何提供帮助。
581
582.. _star2-贡献:
583
584 贡献
585-------
586
587LVGL 是一个开放的项目,我们非常欢迎您的贡献。有很多方法可以帮助您,从简单地谈论您的项目,到编写示例、改进文档、修复错误,甚至在 LVGL 组织下托管您自己的项目。
588
589有关贡献的详细说明,请访问文件的\ `贡献 <https://docs.lvgl.io/master/CONTRIBUTING.html>`__\ 部分。
590
591已经有 300 多人在 LVGL 留下了痕迹。期待你成为他们中的一员!并在下列贡献者中看到你!
592
593.. raw:: html
594
595 <a href="https://github.com/lvgl/lvgl/graphs/contributors">
596 <img src="https://contrib.rocks/image?repo=lvgl/lvgl&max=48" />
597 </a>
598
599... 等等其他人.
600
601.. |Sponsors of LVGL| image:: https://opencollective.com/lvgl/organizations.svg?width=600
602 :target: https://opencollective.com/lvgl
603.. |Backers of LVGL| image:: https://opencollective.com/lvgl/individuals.svg?width=600
604 :target: https://opencollective.com/lvgl
605