Compare commits

..

2181 Commits
v6.0 ... v7.3.1

Author SHA1 Message Date
Gabor Kiss-Vamosi
1088492449 prepare to release v7.3.1 2020-08-18 10:28:35 +02:00
Gabor Kiss-Vamosi
e9ee46f302 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-08-18 10:25:28 +02:00
Gabor Kiss-Vamosi
c0714d9c6b fix release script 2020-08-18 10:25:19 +02:00
Gabor Kiss-Vamosi
e728ba1928 remove debug statements from release.py 2020-08-18 10:22:02 +02:00
Gabor Kiss-Vamosi
74aae39e4e Update CHANGELOG.md 2020-08-18 10:12:32 +02:00
Gabor Kiss-Vamosi
6eab2adfc1 Merge pull request #1732 from ali-rostami/gray_day_calendar
init disabled days to gray color in calendar
2020-08-18 10:11:56 +02:00
Gabor Kiss-Vamosi
056da0f922 fix color picker invalidation in rectangle mode 2020-08-18 08:47:08 +02:00
Gabor Kiss-Vamosi
3b06d4ab84 rewrite the release script 2020-08-17 23:51:23 +02:00
Ali Rostami
3a5ad7712e init disabled days to gray color in calendar
In ver6 we saw that disabled days in `calendar` were gray, which was a good thing and seemed was missed in new versions.
2020-08-17 16:10:44 +04:30
Gabor Kiss-Vamosi
28eb766904 comment updates 2020-08-17 09:20:35 +02:00
Gabor Kiss-Vamosi
1815ff4b99 Limit extra button click area of button matrix's buttons. Fixes #1712 2020-08-14 06:58:00 +02:00
Gabor Kiss-Vamosi
c8cc9db7f0 table: fix typo 2020-08-14 06:58:00 +02:00
Gabor Kiss-Vamosi
de1ccc269c Update README.md 2020-08-13 23:28:03 +02:00
Gabor Kiss-Vamosi
f3e91634f8 fix crash if 'lv_table_set_col_cnt' is called before 'lv_table_set_row_cnt' for the first time
Fixes #1716
2020-08-13 21:08:50 +02:00
Ali Rostami
08684b31ee Patch 1 (#1714)
update comments
2020-08-12 06:58:15 +02:00
Gabor Kiss-Vamosi
2068ab3211 bar, switch, slider: fix drawing background's 'value_str' twice 2020-08-11 10:38:16 +02:00
Gabor Kiss-Vamosi
28807b6a77 lv_img_design: fix cover check if angle != 0 2020-08-11 10:34:04 +02:00
Gabor Kiss-Vamosi
f066f0b8d8 fix overflow in large image transformations 2020-08-11 10:09:41 +02:00
Sergei Kolotovchenkov
d2e1094159 Fix Visual Studio 2019 compile errors (#1711)
Fixed msvc 2019 compiler error C4576 when using the LVGL inside C++ code
2020-08-10 14:13:26 -04:00
Gabor Kiss-Vamosi
6fd7bcf172 allow adding extra label to list buttons 2020-08-10 11:36:43 +02:00
Gabor Kiss-Vamosi
ebaeb1bf7c Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-08-10 06:17:17 +02:00
Gabor Kiss-Vamosi
bd8ac58b6b add missing background drawing and radius handling to image button 2020-08-10 06:17:03 +02:00
Gabor Kiss-Vamosi
b6c18ed171 Update ROADMAP.md 2020-08-09 12:41:25 +02:00
Gabor Kiss-Vamosi
90be42c493 Fix setting local style property multiple times
Realted to https://forum.lvgl.io/t/how-to-change-button-object-color-on-demand/2922/2
2020-08-08 16:22:00 +02:00
embeddedt
81caeaa725 Fix lv_obj_set_height_fit 2020-08-07 07:31:31 -04:00
Gabor Kiss-Vamosi
8af9e96299 Merge pull request #1706 from satirebird/code-fixes
Make several descriptor parameters const
2020-08-06 14:56:36 +02:00
Gabor Kiss-Vamosi
5d981f56ad remove unused variable 2020-08-06 14:54:51 +02:00
Gabor Kiss-Vamosi
58d86cff71 Merge branch 'master' into code-fixes 2020-08-06 14:51:05 +02:00
Gabor Kiss-Vamosi
cda21694c4 Fix text decor (udnerline strikethrough) with older versions of font converter 2020-08-06 14:50:30 +02:00
Gabor Kiss-Vamosi
7af20516a5 add linemeter's mirror feature again
the drawing part was somehow removed
2020-08-06 14:50:30 +02:00
Gabor Kiss-Vamosi
21985e9a14 Update FUNDING.yml 2020-08-06 11:40:30 +02:00
Sven Krauß
7827d948d8 Fix evaluation of return value 2020-08-05 11:18:56 +02:00
Sven Krauß
3b7fa645fb Merge tag 'v7.3.0' into code-fixes
Conflicts:
	src/lv_draw/lv_draw_rect.c
2020-08-05 11:14:27 +02:00
Sven Krauß
28f74bd91d Make several descriptor parameters const, update parameter docs.
Making the descriptor const allows to use static initialized variables.
2020-08-05 10:53:03 +02:00
Gabor Kiss-Vamosi
1f0a4918f2 Update ROADMAP.md 2020-08-05 10:04:16 +02:00
Gabor Kiss-Vamosi
bd4db19aee rename lv_chart_clear_serie to lv_chart_clear_series and lv_obj_align_origo to lv_obj_align_mid 2020-08-04 18:52:37 +02:00
Gabor Kiss-Vamosi
b4955f0b6e Fix drawing value string twice
Fixes #1704
2020-08-04 18:43:34 +02:00
Gabor Kiss-Vamosi
acb46aaed1 Update README.md 2020-08-04 17:37:07 +02:00
Gabor Kiss-Vamosi
7caa2bf9ad Update README.md 2020-08-04 17:36:27 +02:00
Gabor Kiss-Vamosi
a0f338eb6f update changlelog 2020-08-04 17:33:39 +02:00
Gabor Kiss-Vamosi
0f0d57d855 Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev 2020-08-04 17:30:46 +02:00
github-actions[bot]
5d42f92c86 Merge 5810baa021 into dev 2020-08-04 15:12:23 +00:00
github-actions[bot]
42a7fda05d Merge f36f8fe253 into dev 2020-08-04 15:11:53 +00:00
Gabor Kiss-Vamosi
5810baa021 Update library.properties 2020-08-04 17:11:51 +02:00
Gabor Kiss-Vamosi
f36f8fe253 Update library.properties 2020-08-04 17:11:19 +02:00
github-actions[bot]
d56708b45e Merge d0b408d679 into dev 2020-08-04 15:09:01 +00:00
Gabor Kiss-Vamosi
d0b408d679 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-08-04 17:08:21 +02:00
Gabor Kiss-Vamosi
7e3739576f add back library.proeprties 2020-08-04 17:07:54 +02:00
github-actions[bot]
565633828c Merge 061c6325b7 into dev 2020-08-04 12:59:36 +00:00
Gabor Kiss-Vamosi
061c6325b7 Merge pull request #1697 from Droup67/focus_padding
page: Use padding when focus an child item
2020-08-04 14:59:07 +02:00
github-actions[bot]
66c184a84d Merge e3a07ed58c into dev 2020-08-04 09:24:50 +00:00
Gabor Kiss-Vamosi
e3a07ed58c update release.py 2020-08-04 11:24:13 +02:00
github-actions[bot]
e1963a4a3d Merge eb76519d25 into dev 2020-08-04 08:08:03 +00:00
github-actions[bot]
05f6b67b5f Merge 48f8d83bdc into dev 2020-08-04 08:07:32 +00:00
Gabor Kiss-Vamosi
eb76519d25 Release v7.3.0 2020-08-04 10:07:30 +02:00
Gabor Kiss-Vamosi
7b0a0ef4a7 Run code formatter 2020-08-04 10:07:29 +02:00
Gabor Kiss-Vamosi
48f8d83bdc update release.py 2020-08-04 10:06:57 +02:00
github-actions[bot]
a728817fb5 Merge ad422250db into dev 2020-08-04 07:58:01 +00:00
Gabor Kiss-Vamosi
ad422250db update release.py 2020-08-04 09:57:29 +02:00
github-actions[bot]
243c448df9 Merge ec7397e4a0 into dev 2020-08-04 07:50:33 +00:00
Gabor Kiss-Vamosi
ec7397e4a0 update release.py 2020-08-04 09:49:57 +02:00
github-actions[bot]
245de140f4 Merge 0ec409f83e into dev 2020-08-04 07:28:49 +00:00
Gabor Kiss-Vamosi
0ec409f83e fix version nnumber 2020-08-04 09:28:16 +02:00
github-actions[bot]
cc505a3cb2 Merge b58f9c6021 into dev 2020-08-04 07:20:47 +00:00
Gabor Kiss-Vamosi
b58f9c6021 Add LV_USE_OUTLINE/PATTERN/VALUE_STR and LV_MEMCPY_MEMSET_STD 2020-08-04 09:19:59 +02:00
github-actions[bot]
4560a72c32 Merge 85d375b128 into dev 2020-08-03 11:40:16 +00:00
Gabor Kiss-Vamosi
85d375b128 Update ROADMAP.md 2020-08-03 13:39:51 +02:00
github-actions[bot]
99f49f9097 Merge a0e6f7f022 into dev 2020-08-03 11:37:40 +00:00
Gabor Kiss-Vamosi
a0e6f7f022 Update ROADMAP.md 2020-08-03 13:37:11 +02:00
Droup
1c3bbc9f6c Fix focus move
Signed-off-by: Droup <droup@pm.me>
2020-08-03 10:38:18 +02:00
github-actions[bot]
0aa4591021 Merge c85295b5ea into dev 2020-08-02 10:05:44 +00:00
Gabor Kiss-Vamosi
c85295b5ea update CHANGELOG 2020-08-02 12:05:00 +02:00
Gabor Kiss-Vamosi
28213adfa6 -fix using freed memory in _lv_style_list_remove_style
Fixes: #1694
2020-08-02 12:05:00 +02:00
github-actions[bot]
25b0b994a0 Merge 2b60f4496f into dev 2020-08-01 17:36:31 +00:00
DefinPlusPlus
2b60f4496f Fixed infinite loop during calculation size of lv_list (#1700) 2020-08-01 13:36:07 -04:00
github-actions[bot]
1d714bfed7 Merge b7d7bf7dd5 into dev 2020-07-31 20:14:15 +00:00
Gabor Kiss-Vamosi
b7d7bf7dd5 Update README.md 2020-07-31 22:13:46 +02:00
Droup
373af97472 page: Use padding when focus an child item
Signed-off-by: Droup <droup@pm.me>
2020-07-31 14:32:17 +02:00
github-actions[bot]
3e9495a074 Merge 1072b71ea0 into dev 2020-07-30 09:12:45 +00:00
Gabor Kiss-Vamosi
1072b71ea0 gauge: fix image needle drawing 2020-07-30 11:11:54 +02:00
Sven Krauß
b0e3f11da1 Make lv_draw_line_dsc_t parameters constant 2020-07-28 17:08:21 +02:00
github-actions[bot]
cb0d6f40c9 Merge 0f69469eee into dev 2020-07-28 10:19:14 +00:00
Seth Itow
0f69469eee README.md: Update link to Micropython documentation (#1693) 2020-07-28 06:18:42 -04:00
github-actions[bot]
f2a59c23f1 Merge cac6f92964 into dev 2020-07-27 18:19:43 +00:00
Gabor Kiss-Vamosi
cac6f92964 fix warning 2020-07-27 20:19:02 +02:00
github-actions[bot]
0d2784a13e Merge 80a4c6ff14 into dev 2020-07-27 15:58:55 +00:00
Gabor Kiss-Vamosi
80a4c6ff14 update CHANGELOG 2020-07-27 17:58:10 +02:00
Gabor Kiss-Vamosi
013ae48221 Merge branch 'size_reduction' 2020-07-27 17:47:25 +02:00
github-actions[bot]
daec3626bc Merge fd695c9ad3 into dev 2020-07-27 15:47:05 +00:00
Gabor Kiss-Vamosi
fd695c9ad3 textarea: fix typo in lv_textarea_set_sscrollbar_mode
Fixes #1691
2020-07-27 17:46:10 +02:00
github-actions[bot]
88ce04cea3 Merge 06d7a6d006 into dev 2020-07-27 14:01:19 +00:00
Gabor Kiss-Vamosi
06d7a6d006 btnmatrix: hadle combined states of buttons (e.g. chacked + disabled) 2020-07-27 15:57:28 +02:00
github-actions[bot]
529fee1e20 Merge ca9dfb7063 into dev 2020-07-27 12:30:52 +00:00
Gabor Kiss-Vamosi
ca9dfb7063 Update FUNDING.yml 2020-07-27 14:30:22 +02:00
github-actions[bot]
83ca45e0c8 Merge fd411e200f into dev 2020-07-27 12:30:13 +00:00
Gabor Kiss-Vamosi
fd411e200f Update and rename _FUNDING.yml to FUNDING.yml 2020-07-27 14:29:41 +02:00
github-actions[bot]
3592a2ac17 Merge 8cc951202c into dev 2020-07-27 12:18:37 +00:00
Gabor Kiss-Vamosi
8cc951202c Rename FUNDING.yml to _FUNDING.yml 2020-07-27 14:17:58 +02:00
github-actions[bot]
ac89d1245b Merge 2172ec93a2 into dev 2020-07-27 12:16:37 +00:00
Gabor Kiss-Vamosi
2172ec93a2 material theme minor fix
Fixes #1689
2020-07-27 14:16:06 +02:00
Gabor Kiss-Vamosi
c173f28a3f add underline properties to the fonts 2020-07-27 12:47:07 +02:00
github-actions[bot]
a5a7329d41 Merge ed10c1da67 into dev 2020-07-26 19:15:06 +00:00
Gabor Kiss-Vamosi
ed10c1da67 Add LV_THEME_MATERIAL_FLAG_NO_TRANSITION and LV_THEME_MATERIAL_FLAG_NO_FOCUS flags 2020-07-26 21:14:10 +02:00
github-actions[bot]
bb730735f2 Merge 834b498aec into dev 2020-07-24 19:51:40 +00:00
Gabor Kiss-Vamosi
834b498aec Update ROADMAP.md 2020-07-24 21:51:08 +02:00
github-actions[bot]
2fb690b3b9 Merge 28a668ce09 into dev 2020-07-24 19:50:15 +00:00
Gabor Kiss-Vamosi
28a668ce09 Create ROADMAP.md 2020-07-24 21:49:44 +02:00
github-actions[bot]
5a2cf28c54 Merge ed480e821c into dev 2020-07-24 14:32:06 +00:00
Gabor Kiss-Vamosi
ed480e821c Merge pull request #1684 from lvgl/pete-pjb-cpicker
Tidy up the edges of the colour picker widget.
2020-07-24 16:31:35 +02:00
Gabor Kiss-Vamosi
f11f7c5223 Merge branch 'master' into pete-pjb-cpicker 2020-07-24 16:30:39 +02:00
github-actions[bot]
3b4bff79c2 Merge f30dc5d186 into dev 2020-07-24 14:16:54 +00:00
Gabor Kiss-Vamosi
f30dc5d186 remove duplicated lines from lv_tabview_add_tab 2020-07-24 16:16:18 +02:00
pete-pjb
da5c9dd424 Add define and comment to explain magic number used in previous fix. 2020-07-24 13:50:35 +01:00
pete-pjb
89adfbc816 Fix ragged edge of Colour Picker. 2020-07-24 10:15:29 +01:00
pete-pjb
d125472e81 Update change log. 2020-07-23 14:24:28 +01:00
pete-pjb
28495b9eb9 Tidy up the edges of the colour picker widget. 2020-07-23 14:15:34 +01:00
github-actions[bot]
4fefa2ee28 Merge 00e93a5d30 into dev 2020-07-22 16:24:25 +00:00
Gabor Kiss-Vamosi
00e93a5d30 Update CHANGELOG.md 2020-07-22 18:23:56 +02:00
github-actions[bot]
95ef03baa8 Merge dae3ebdb66 into dev 2020-07-22 16:23:36 +00:00
Gabor Kiss-Vamosi
dae3ebdb66 Merge pull request #1679 from lvgl/embeddedt-patch-1
textarea: don't call LV_EVENT_INSERT too far before insertion
2020-07-22 18:22:57 +02:00
Gabor Kiss-Vamosi
fb3e6ec1f4 textarea: add insert handler functions 2020-07-22 16:28:03 +02:00
github-actions[bot]
bb4e4a9e53 Merge 4df27fc5b2 into dev 2020-07-22 14:26:22 +00:00
Gabor Kiss-Vamosi
4df27fc5b2 Update CHANGELOG.md 2020-07-22 16:25:42 +02:00
github-actions[bot]
f7870310dc Merge 3c3fe46447 into dev 2020-07-22 14:19:34 +00:00
Gabor Kiss-Vamosi
3c3fe46447 Update CHANGELOG.md 2020-07-22 16:18:49 +02:00
embeddedt
806f3a9bbf textarea: don't call LV_EVENT_INSERT too far before insertion 2020-07-21 11:16:26 -04:00
github-actions[bot]
dca7cedb28 Merge 557342cc08 into dev 2020-07-21 14:39:50 +00:00
Gabor Kiss-Vamosi
557342cc08 Do not print for missing glyph if its height OR width is zero
Fixes: #1674
2020-07-21 16:39:04 +02:00
Gabor Kiss-Vamosi
eb725a3a68 add LV_USE_FONT_SUBPX option and draw_full_border() to avoid duplication in outline and border drawing 2020-07-21 16:06:14 +02:00
Gabor Kiss-Vamosi
53f002c3f8 Merge branch 'dev' into size_reduction 2020-07-21 16:03:54 +02:00
Gabor Kiss-Vamosi
b48120947f Merge branch 'master' into size_reduction 2020-07-21 14:44:11 +02:00
Gabor Kiss-Vamosi
4659289924 Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev 2020-07-21 13:43:16 +02:00
Gabor Kiss-Vamosi
cc0ea22903 increment version number to v7.4-dev 2020-07-21 13:43:05 +02:00
github-actions[bot]
c0ca1a025b Merge 35b3a1f2a4 into dev 2020-07-21 11:42:42 +00:00
Gabor Kiss-Vamosi
35b3a1f2a4 merge dev 2020-07-21 13:42:02 +02:00
Gabor Kiss-Vamosi
6731e44503 Merge branch 'dev' 2020-07-21 13:40:36 +02:00
Gabor Kiss-Vamosi
7b68e6e426 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-07-21 13:38:24 +02:00
Gabor Kiss-Vamosi
c36a96914b fix release script 2020-07-21 13:38:04 +02:00
github-actions[bot]
ab6f93db24 Merge 57079452b0 into dev 2020-07-21 11:30:20 +00:00
Gabor Kiss-Vamosi
57079452b0 Release v7.2.0 2020-07-21 13:29:37 +02:00
Gabor Kiss-Vamosi
960bca7807 Run code formatter 2020-07-21 13:29:36 +02:00
github-actions[bot]
67400d1d72 Merge ecfef570ea into dev 2020-07-17 15:35:14 +00:00
Gabor Kiss-Vamosi
ecfef570ea Merge pull request #1672 from adamhan2/fix_issue_1671
fixes #1671 lv_cont_layout_grid() fails to calculate available space in a row
2020-07-17 17:34:43 +02:00
Adam Han
75875e244d fixes #1671 lv_cont_layout_grid() fails to calculate available space in a row
this issue results in space waste in right side of container
  the size of wasted space in each row is pad_left plus pad_inner
2020-07-17 15:51:09 +01:00
github-actions[bot]
1db33435c1 Merge 2d984da893 into dev 2020-07-17 12:09:30 +00:00
Gabor Kiss-Vamosi
2d984da893 improve mono theme when used with keyboard or encoder 2020-07-17 14:08:42 +02:00
github-actions[bot]
5b062a0d8d Merge c0a7cf76b9 into dev 2020-07-17 09:42:43 +00:00
Gabor Kiss-Vamosi
c0a7cf76b9 minor fixes with LV_COLOR_DEPTH == 1 2020-07-17 11:42:08 +02:00
github-actions[bot]
44e57aaaf5 Merge d06fe5100e into dev 2020-07-17 08:26:44 +00:00
Gabor Kiss-Vamosi
d06fe5100e Merge pull request #1670 from mentha/patch-1
Fix lv_canvas_set_buffer document
2020-07-17 10:26:00 +02:00
mentha
ae94302f4d Fix lv_canvas_set_buffer doc
Lines in canvas buffers are byte aligned so buffers might request larger size and contain unused bits.
The previous documented calc method would often result in a buffer size smaller than what was expected by LVGL, leading to memory corruption and program crash.
2020-07-17 16:09:24 +08:00
Themba Dube
b26b4435a5 Add LV_USE_FONT_COMPRESSED to lv_conf_template.h 2020-07-16 18:58:28 -04:00
Themba Dube
da9a5f58d0 Don't include blending code if LV_USE_BLEND_MODES is disabled 2020-07-16 18:55:35 -04:00
Themba Dube
a4774ccc72 Add LV_USE_FONT_COMPRESSED to control support for compressed fonts 2020-07-16 18:55:25 -04:00
github-actions[bot]
a6289f5e85 Merge dd56e9a013 into dev 2020-07-16 11:09:48 +00:00
Gabor Kiss-Vamosi
dd56e9a013 set the cursor object non clickable by default
Fixes: #1664
2020-07-16 13:09:09 +02:00
github-actions[bot]
e31993bdf2 Merge 6dac633235 into dev 2020-07-15 06:58:39 +00:00
Gabor Kiss-Vamosi
6dac633235 Merge pull request #1663 from diegoherranz/readme_typos
Fix README typos
2020-07-15 08:58:10 +02:00
Diego Herranz
1d5300e02f Fix README typos 2020-07-15 07:55:27 +01:00
github-actions[bot]
b646365e2c Merge 798f3177f2 into dev 2020-07-14 15:37:09 +00:00
Gabor Kiss-Vamosi
798f3177f2 Update README.md 2020-07-14 17:36:41 +02:00
github-actions[bot]
0921cf6e3b Merge ac5f1998e4 into dev 2020-07-14 15:16:11 +00:00
Gabor Kiss-Vamosi
ac5f1998e4 Update README.md 2020-07-14 17:15:30 +02:00
github-actions[bot]
433435889a Merge a66afca68e into dev 2020-07-14 15:07:16 +00:00
Gabor Kiss-Vamosi
a66afca68e Update README.md 2020-07-14 17:06:33 +02:00
Gabor Kiss-Vamosi
b1213dcc59 remove lv_event_queue_refresh_recursive
keep only the synchronous functions for refresh for easier maintanance
2020-07-14 15:25:56 +02:00
github-actions[bot]
f8c8c4040a Merge 2f33670b4f into dev 2020-07-14 11:37:37 +00:00
Gabor Kiss-Vamosi
2f33670b4f Merge pull request #1661 from tehkillerbee/master
Handle LV_EVENT_CANCEL in list/group
2020-07-14 13:37:10 +02:00
Johannes Linde
d8e10c41cf Handle ESC/Cancel event in list 2020-07-14 12:04:53 +02:00
Gabor Kiss-Vamosi
7e38ac68e3 Update CHANGELOG.md 2020-07-13 19:59:53 +02:00
Gabor Kiss-Vamosi
abff805509 Merge pull request #1653 from mibcat/tabview-set-tab-name
widget tableview: add new function lv_tabview_set_tab_name() to change a tab name during runtime
2020-07-13 19:57:25 +02:00
Michael Katzenberger
18072b3dd4 update CHANGELOG.md 2020-07-13 19:56:06 +02:00
github-actions[bot]
4640611758 Merge baeda1998f into dev 2020-07-13 13:31:40 +00:00
pete-pjb
baeda1998f Fix chart linked list free before use bug. 2020-07-13 14:26:04 +01:00
Gabor Kiss-Vamosi
e1a09551ce fix drawing on right border 2020-07-13 09:43:18 +02:00
Michael Katzenberger
ba7a86de74 implement review findings: use C-style comments 2020-07-12 14:22:09 +02:00
Michael Katzenberger
6cb79914a8 widget tableview: add function lv_tabview_set_tab_name() to change a tab name 2020-07-12 11:46:12 +02:00
github-actions[bot]
f1f0aa621a Merge 43a77d8699 into dev 2020-07-10 13:04:49 +00:00
Gabor Kiss-Vamosi
43a77d8699 linemeter: fix arc drawing if the value is close to max value 2020-07-10 15:04:02 +02:00
github-actions[bot]
58b88bf1fb Merge 96bc397821 into dev 2020-07-10 12:57:43 +00:00
Gabor Kiss-Vamosi
96bc397821 linemeter: fix conversation of current value to "level"
Related to #1648
2020-07-10 14:57:03 +02:00
github-actions[bot]
fd508065dd Merge 416ef9e251 into dev 2020-07-09 12:42:08 +00:00
Gabor Kiss-Vamosi
416ef9e251 fix chart series area invalidation 2020-07-09 14:41:24 +02:00
Gabor Kiss-Vamosi
09250d0a92 Delete queued refresh queries 2020-07-09 14:13:21 +02:00
github-actions[bot]
822e06be39 Merge c07ef75ac5 into dev 2020-07-08 13:03:31 +00:00
Gabor Kiss-Vamosi
c07ef75ac5 update release script 2020-07-08 15:02:53 +02:00
github-actions[bot]
2a6f5d46ab Merge e3f6a3327d into dev 2020-07-08 12:59:42 +00:00
Gabor Kiss-Vamosi
e3f6a3327d Update library.json 2020-07-08 14:59:02 +02:00
github-actions[bot]
6227aaee96 Merge 08591a8e8c into dev 2020-07-08 11:43:18 +00:00
Pete Bone
08591a8e8c Merge pull request #1646 from DaPa/master
Fix lv_page_get_height_grid comment
2020-07-08 12:42:51 +01:00
DaPa
106e023c80 Fix lv_page_get_height_grid comment 2020-07-08 14:36:13 +03:00
Gabor Kiss-Vamosi
a5de71933b fix typoe in comments 2020-07-08 10:31:52 +02:00
github-actions[bot]
e85888908a Merge 1a3b6d4cb3 into dev 2020-07-08 07:36:08 +00:00
Gabor Kiss-Vamosi
1a3b6d4cb3 update lv_conf_internal.h 2020-07-08 09:35:25 +02:00
github-actions[bot]
e587ceb22e Merge b769463d39 into dev 2020-07-08 07:32:39 +00:00
Gabor Kiss-Vamosi
b769463d39 update CHANGELONG and lv_conf_internal.h 2020-07-08 09:31:52 +02:00
Gabor Kiss-Vamosi
cbc88285d3 change default fot to 14 px for better compatibility with small displays
Related to #1602
2020-07-08 09:31:52 +02:00
Gabor Kiss-Vamosi
ec64820272 tileview: fix navigation when not screen sized 2020-07-08 09:31:52 +02:00
Gabor Kiss-Vamosi
15b7ea6614 Add lv_event_send_refresh, lv_event_send_refresh_recursive, lv_event_queue_refresh_recursive
Used to easily send LV_EVENT_REFRESH to objects
2020-07-08 09:29:48 +02:00
Gabor Kiss-Vamosi
843555a4b1 Add lv_task_get_next 2020-07-08 09:29:48 +02:00
github-actions[bot]
5f4c26cb79 Merge 019042297d into dev 2020-07-08 04:27:23 +00:00
Gabor Kiss-Vamosi
019042297d Update library.json 2020-07-08 06:26:56 +02:00
github-actions[bot]
46a4469a9c Merge 646cb71a9d into dev 2020-07-07 18:41:18 +00:00
Gabor Kiss-Vamosi
646cb71a9d Update library.json 2020-07-07 20:40:33 +02:00
github-actions[bot]
ad262172de Merge 343b70b19c into dev 2020-07-07 11:09:52 +00:00
Gabor Kiss-Vamosi
343b70b19c Update auto-comment.yml 2020-07-07 13:09:26 +02:00
github-actions[bot]
b802e7e775 Merge 2cecd01b30 into dev 2020-07-07 11:07:33 +00:00
Gabor Kiss-Vamosi
2cecd01b30 Update auto-comment.yml 2020-07-07 13:07:02 +02:00
github-actions[bot]
2ba1fc625f Merge aff7a22ac5 into dev 2020-07-07 11:04:10 +00:00
Gabor Kiss-Vamosi
aff7a22ac5 Update auto-comment.yml 2020-07-07 13:03:30 +02:00
github-actions[bot]
5a23fd569b Merge 234e74202c into dev 2020-07-07 10:58:47 +00:00
Gabor Kiss-Vamosi
234e74202c image decoder open bug described in #1638 2020-07-07 12:58:13 +02:00
github-actions[bot]
914c874ada Merge a6793b2695 into dev 2020-07-07 10:45:11 +00:00
Gabor Kiss-Vamosi
a6793b2695 Update auto-comment.yml 2020-07-07 12:44:42 +02:00
github-actions[bot]
45bf6a3862 Merge c599a59f05 into dev 2020-07-07 09:31:48 +00:00
github-actions[bot]
f00a6a118d Merge c97a0684cf into dev 2020-07-07 09:31:03 +00:00
Gabor Kiss-Vamosi
c599a59f05 Update README.md 2020-07-07 11:31:00 +02:00
Gabor Kiss-Vamosi
c97a0684cf Create auto-comment.yml 2020-07-07 11:30:35 +02:00
github-actions[bot]
418413e334 Merge faf56680f8 into dev 2020-07-07 09:30:07 +00:00
github-actions[bot]
815e0afdaf Merge b2d78dcca7 into dev 2020-07-07 09:29:50 +00:00
Gabor Kiss-Vamosi
faf56680f8 Delete auto-comment.yml 2020-07-07 11:29:41 +02:00
Gabor Kiss-Vamosi
b2d78dcca7 Create auto-comment.yml 2020-07-07 11:29:20 +02:00
Gabor Kiss-Vamosi
38e68eeb7a update version number 2020-07-07 10:06:49 +02:00
github-actions[bot]
0f69cbf087 Merge 039080fc26 into dev 2020-07-07 08:06:19 +00:00
Gabor Kiss-Vamosi
039080fc26 update changlog 2020-07-07 10:05:29 +02:00
Gabor Kiss-Vamosi
7e9cf858d6 update version number 2020-07-07 10:03:52 +02:00
Gabor Kiss-Vamosi
a740af4afb fix conflicts 2020-07-07 10:02:50 +02:00
Gabor Kiss-Vamosi
a117b3cead update relaese script 2020-07-07 10:01:28 +02:00
Gabor Kiss-Vamosi
e30efb716f Release v7.1.0 2020-07-07 09:37:00 +02:00
Gabor Kiss-Vamosi
43f5e4d2e0 Run code formatter 2020-07-07 09:36:59 +02:00
github-actions[bot]
e178bcc9f3 Merge d8585d2ea3 into dev 2020-07-07 07:32:59 +00:00
Gabor Kiss-Vamosi
d8585d2ea3 update release.py 2020-07-07 09:32:21 +02:00
github-actions[bot]
41c4c25315 Merge 9e56f750a7 into dev 2020-07-04 23:50:42 +00:00
Amir Gonnen
9e56f750a7 Prevent compiler warning in lv_draw_rect.c (#1637) 2020-07-04 19:50:14 -04:00
github-actions[bot]
4396196889 Merge e6fe8436f4 into dev 2020-07-04 11:30:45 +00:00
guoweilkd
e6fe8436f4 Fix #1634: bug in lv_tileview_scrl_signal (#1636) 2020-07-04 07:30:07 -04:00
github-actions[bot]
f3f1c606b6 Merge e9d3001dbf into dev 2020-07-03 12:49:29 +00:00
Gabor Kiss-Vamosi
e9d3001dbf img: improve hit test for transformed images 2020-07-03 14:48:54 +02:00
Gabor Kiss-Vamosi
fd186eeb15 roller: fix copy 2020-07-03 14:24:23 +02:00
github-actions[bot]
25607ceaee Merge 4b2c3e560b into dev 2020-07-01 14:14:54 +00:00
Petri HARRI
4b2c3e560b lv_slider: add knob-only feature and fix bug with symmetrical slider (#1578) 2020-07-01 10:14:14 -04:00
Gabor Kiss-Vamosi
989016dff3 fix conflicts 2020-07-01 15:21:14 +02:00
Gabor Kiss-Vamosi
c54788fae4 fix conflicts 2020-07-01 15:19:29 +02:00
Themba Dube
c7fb2ad12c Merge branch 'master' into dev 2020-07-01 09:19:17 -04:00
Gabor Kiss-Vamosi
2fdeaf5599 fix conflicts 2020-07-01 15:18:48 +02:00
Gabor Kiss-Vamosi
1051e3f5a4 roller: fix copy. Closes #1628 2020-07-01 15:15:12 +02:00
Gabor Kiss-Vamosi
0b68c21840 Merge pull request #1627 from xiaogangly/master
Fix a memory leak bug in function "lv_objmask_remove_mask" .
2020-07-01 15:09:10 +02:00
jbamaral
ac26442ca6 Fix lv_textarea_add_char on big endian (#1620) 2020-07-01 09:08:45 -04:00
Pete Bone
b539e6dc46 Merge pull request #1630 from pete-pjb/dev
New functions for Check Box and a minor bug fix
2020-07-01 12:44:41 +01:00
pete-pjb
06603a9c84 New functions for Check Box and a minor bug fix
Remove use of c++ keyword 'new' from function parameter in
lv_theme_set_base() function.
Add function lv_checkbox_set_state(lv_obj_t * cb, lv_btn_state_t state).
Add function lv_checkbox_get_state(const lv_obj_t * cb)
Update Change log.
2020-07-01 12:13:46 +01:00
github-actions[bot]
6b45f3ade5 Merge 6b246b2fed into dev 2020-07-01 08:53:55 +00:00
Gabor Kiss-Vamosi
6b246b2fed fix default theme colors 2020-07-01 10:53:23 +02:00
xiaogangly
86f74e3da2 Fix a memory leak bug in function "lv_objmask_remove_mask" .
There is a little memory leak When you call function "lv_objmask_remove_mask" to remove a specified mask.
It's need free the memory of list's node.
2020-07-01 15:26:37 +08:00
Gabor Kiss-Vamosi
c4e7d7cb83 Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev 2020-06-30 17:09:57 +02:00
github-actions[bot]
43b69a88a9 Merge 6d1da27b3c into dev 2020-06-30 07:44:39 +00:00
Gabor Kiss-Vamosi
6d1da27b3c Create merge-to-dev.yml 2020-06-30 09:43:58 +02:00
Gabor Kiss-Vamosi
bae04005d3 update old function name in comment 2020-06-29 20:47:55 +02:00
Gabor Kiss-Vamosi
edeca8c01b Merge pull request #1619 from liangyongxiang/master
Add conditional macro LV_USE_GROUP to more GROUP related singles:
2020-06-29 14:52:18 +02:00
Gabor Kiss-Vamosi
069e24bdb2 add examples folder with arduio examples and move porting folder there 2020-06-28 20:37:32 +02:00
Gabor Kiss-Vamosi
d0db0bab5c add Arduino library files 2020-06-28 20:10:30 +02:00
Themba Dube
421f1b2c01 lv_gpu: fix #1617 by renaming internal macros
This avoids conflicts with STM32Cube.
2020-06-28 09:16:25 -04:00
Gabor Kiss-Vamosi
92027cc06f lv_hal_tick: revert using uint32_t as tick_irq_flag
uint8_t surely can be written in 1 instruction even on 16 bit MCUs
2020-06-28 13:32:40 +02:00
Gabor Kiss-Vamosi
ddbeb212b7 Add support to compressed fonts without pre-filter to gain some speed by sacrificing some memory 2020-06-28 13:29:01 +02:00
liangyongxiang
d055944ebb Add conditional macro LV_USE_GROUP to more GROUP related singles:
- LV_SIGNAL_CONTROL
- LV_SIGNAL_GET_EDITABLE
2020-06-28 12:48:37 +08:00
Amir Gonnen
40daa7195d lv_theme: add lv_theme_set_apply_cb (#1616) 2020-06-27 17:46:22 -04:00
Gabor Kiss-Vamosi
3e8b39c404 Merge pull request #1613 from 3096/lv_win-style-fix
material theme: fix lv_win uninitialed styles
2020-06-27 10:35:18 +02:00
3096
e06201f042 material theme: fix lv_win uninitialed styles 2020-06-26 22:27:52 -07:00
Gabor Kiss-Vamosi
2d7423100a fix conflicts 2020-06-27 06:57:28 +02:00
Gabor Kiss-Vamosi
6971d603d2 add lv_theme_copy 2020-06-27 06:54:47 +02:00
Amir Gonnen
aad9f4f0c1 Add lv_dpx inline function (#1612)
Identical to LV_DPX (no code additions)
2020-06-26 18:04:46 -04:00
Gabor Kiss-Vamosi
76625adec2 fix typo in lv_obj_align_origo_x/y 2020-06-26 21:02:06 +02:00
Gabor Kiss-Vamosi
8b3f9f19f6 add lv_obj_align_origo_x() and lv_obj_align_origo_y() functions 2020-06-26 20:59:57 +02:00
Gabor Kiss-Vamosi
97f999ed9f add lv_obj_align_x() and lv_obj_align_y() functions 2020-06-26 20:52:21 +02:00
Gabor Kiss-Vamosi
e678a2c599 chart: add lv_chart_set_series_axis and lv_chart_set_y_range 2020-06-26 20:31:20 +02:00
Gabor Kiss-Vamosi
6056bc3b95 clraify the tricky loop in lv_tick_get 2020-06-26 14:35:30 +02:00
Gabor Kiss-Vamosi
91f64c8662 Add lv_theme_set_base() to allow easy extension of built-in (or any) themes 2020-06-26 14:05:34 +02:00
Gabor Kiss-Vamosi
274d0b522d Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-26 09:39:29 +02:00
Gabor Kiss-Vamosi
ac7527fecf minor optimization in lv_obj_init_draw_img_dsc 2020-06-26 09:39:19 +02:00
Gabor Kiss-Vamosi
2ed6b4e2f5 Merge pull request #1607 from jbamaral/fix-img-big-endian-pr
fix image demos on big endian systems
2020-06-25 17:11:46 +02:00
embeddedt
3761db65e0 Fix spelling issue 2020-06-25 07:32:45 -04:00
Gabor Kiss-Vamosi
eb006b3d39 finialze screen animations 2020-06-25 12:43:45 +02:00
Gabor Kiss-Vamosi
f10f94bea3 use void * as theme user data for backward compatibility 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
710226c6db add user_data to themes 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
44a96df9fb initial implementation of screen load animation 2020-06-25 12:43:44 +02:00
embeddedt
cd788da47a Fix #1610: don't assert an expected null pointer 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
c4eec78a02 lv_textarea fix cursor alignment with empty textarea when the text alignment is center or right 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
1e33359d0c fix build error 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
cf8357e004 fix focusing/defocusing for pages 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
8f243c01d5 style: minor fix on getting style attributes + formatting 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
e2aa68394c update changelog 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
2828582c7a lv_img: fix invalidation area when angle or zoom changes 2020-06-25 12:43:44 +02:00
jbamaral
f6a2c635fd Improve big endian support (#1599) 2020-06-25 12:43:44 +02:00
Gabor Kiss-Vamosi
db24bf1d18 In lv_init test if the the strings are UTF-8 encoded 2020-06-25 12:42:06 +02:00
Deon Marais
8c151a2d43 Add missing lv_font_montserrat_34
if you do not mind me asking, and on matters of fonts why was Roboto changed to Montserrat when V7 was released ?
2020-06-25 12:42:06 +02:00
Gabor Kiss-Vamosi
52cca1dd9b use void * as theme user data for backward compatibility 2020-06-25 06:38:17 +02:00
Gabor Kiss-Vamosi
859f72eb84 add user_data to themes 2020-06-25 06:25:40 +02:00
embeddedt
b77d484a27 Fix #1610: don't assert an expected null pointer 2020-06-24 12:25:16 -04:00
jbamaral
1733508e9a move bug logs to their right position in changelog 2020-06-24 10:01:42 -03:00
jbamaral
5f6c7743ad update internal configuration 2020-06-24 08:38:44 -03:00
jbamaral
2550368d30 fix image demos on big endian systems 2020-06-24 08:30:45 -03:00
Gabor Kiss-Vamosi
63aba1b3de lv_textarea fix cursor alignment with empty textarea when the text alignment is center or right 2020-06-24 11:36:35 +02:00
Gabor Kiss-Vamosi
42f79763e1 fix build error 2020-06-24 11:28:51 +02:00
Gabor Kiss-Vamosi
be19e91e91 fix focusing/defocusing for pages 2020-06-24 11:24:07 +02:00
Gabor Kiss-Vamosi
9561aa767d style: minor fix on getting style attributes + formatting 2020-06-24 10:45:32 +02:00
Gabor Kiss-Vamosi
4c629ec23f update changelog 2020-06-24 10:04:30 +02:00
Gabor Kiss-Vamosi
8864cd87ee lv_img: fix invalidation area when angle or zoom changes 2020-06-24 10:03:37 +02:00
jbamaral
916f5b343a Improve big endian support (#1599) 2020-06-23 08:30:33 -04:00
Gabor Kiss-Vamosi
c0223977d1 roller: fix misaligned option after setting new options 2020-06-23 11:44:06 +02:00
Gabor Kiss-Vamosi
e1c5d8950f Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-23 11:11:57 +02:00
Gabor Kiss-Vamosi
20c46ca640 In lv_init test if the the strings are UTF-8 encoded 2020-06-23 11:11:45 +02:00
Gabor Kiss-Vamosi
188205399b Merge pull request #1598 from DeonMarais64/patch-1
Add missing lv_font_montserrat_34
2020-06-22 10:08:22 +02:00
Themba Dube
0d0427f8bc Merge remote-tracking branch 'origin/master' into dev 2020-06-21 08:32:48 -04:00
Deon Marais
f9512f55cc Add missing lv_font_montserrat_34
if you do not mind me asking, and on matters of fonts why was Roboto changed to Montserrat when V7 was released ?
2020-06-20 09:08:59 +02:00
Gabor Kiss-Vamosi
201d38c574 Add theme->apply_cb to replace theme->apply_xcb to make it compatible with the Micropython binding 2020-06-20 00:01:33 +02:00
embeddedt
8dbd685a90 Fix #1596: typo in lv_api_map.h 2020-06-19 10:13:53 -04:00
Gabor Kiss-Vamosi
4345e05e32 test
Signed-off-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-06-19 15:12:17 +02:00
Gabor Kiss-Vamosi
24b1a7735a roller: allow setting different font for the selected text 2020-06-19 13:17:45 +02:00
Gabor Kiss-Vamosi
b16f3ff8e7 Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev 2020-06-18 16:32:14 +02:00
Gabor Kiss-Vamosi
0f4aeede79 Update README.md 2020-06-18 16:29:18 +02:00
Gabor Kiss-Vamosi
5d4873aa95 Update README.md 2020-06-18 16:19:57 +02:00
Gabor Kiss-Vamosi
8ac337d515 Update README.md 2020-06-18 16:13:04 +02:00
Gabor Kiss-Vamosi
2678068a86 Update CONTRIBUTING.md 2020-06-18 16:09:07 +02:00
Gabor Kiss-Vamosi
64be5e2096 Update CONTRIBUTING.md 2020-06-18 16:08:17 +02:00
Pete Bone
6b3d7759cc Merge pull request #1587 from pete-pjb/dev
Finalise chart function updates
2020-06-18 14:59:19 +01:00
Pete Bone
765b6c4015 Update CHANGELOG.md 2020-06-18 14:38:07 +01:00
Gabor Kiss-Vamosi
1521d64784 _lv_img_buf_get_transformed_area: do not calculate trivial case 2020-06-18 15:17:03 +02:00
Amir Gonnen
25fbcea31a Ensure mem_max_size is only used on non custom mem (#1588) 2020-06-18 06:40:39 -04:00
Gabor Kiss-Vamosi
51e064d836 Update CHANGELOG.md 2020-06-18 12:37:02 +02:00
Gabor Kiss-Vamosi
6ae7f67ef5 Update CHANGELOG.md 2020-06-18 12:36:05 +02:00
Gabor Kiss-Vamosi
156a3c005d Update CHANGELOG.md 2020-06-18 12:35:38 +02:00
Gabor Kiss-Vamosi
295337ac7e Merge pull request #1590 from diegoherranz/lv_conf_checker
lv_conf_checker.py: change requirement of python 3.6 to >=3.6
2020-06-18 12:32:13 +02:00
Gabor Kiss-Vamosi
a39f51a571 Merge branch 'dev' into dev 2020-06-18 07:41:54 +02:00
Gabor Kiss-Vamosi
d050c99161 Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev 2020-06-18 06:04:02 +02:00
Gabor Kiss-Vamosi
1523cc0634 fix typo 2020-06-18 06:03:52 +02:00
Diego Herranz
65d029279b lv_calendar: add option to start week on Monday (#1589) 2020-06-17 16:09:40 -04:00
Diego Herranz
d2d664a69b lv_conf_checker.py: change requirement of python 3.6 to >=3.6
Many current OSes ship newer versions (e.g. 3.8) and they work OK
for this, so I don't think 3.6 is required specifically.
Versions older than 3.6 wouldn't work, though, since f-strings
are used.
2020-06-17 21:04:46 +01:00
pete-pjb
4a953b9d9d Free memory for series_ll 2020-06-16 18:24:05 +01:00
pete-pjb
ae748cfffa Fix initialisation problem.
Found that new structure parmaeter ext_buf_assigned needs to be
initialised to false in lv_chart_add_series() as sometimes is set true
depending on what was previously in the heap where it was allocated.
2020-06-16 18:04:36 +01:00
PeterB
ad215c5b4b Finalise changes for new Chart Functions 2020-06-16 16:24:37 +01:00
Gabor Kiss-Vamosi
2dd84e6de1 Merge branch 'master' into dev 2020-06-16 16:52:18 +02:00
pete-pjb
05d249d5ee Merge branch 'master' into dev 2020-06-16 15:10:56 +01:00
Pete Bone
f746ac8542 Added functions to extend chart functionality (#1581) 2020-06-16 09:53:21 -04:00
Gabor Kiss-Vamosi
7af64df008 upadte version numer to v7.1.0-dev 2020-06-16 13:57:20 +02:00
Gabor Kiss-Vamosi
975ab3f4cc Merge branch 'dev' 2020-06-16 13:56:42 +02:00
Gabor Kiss-Vamosi
122ef1d862 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-16 13:56:00 +02:00
Gabor Kiss-Vamosi
4174ad844c relase.py minor fixes 2020-06-16 13:55:45 +02:00
Gabor Kiss-Vamosi
41e65d9df1 Run code formatter 2020-06-16 13:47:04 +02:00
Gabor Kiss-Vamosi
2d0480c03d Release v7.0.2 2020-06-16 13:42:34 +02:00
Gabor Kiss-Vamosi
b0c9c8778d CHANGELOG set v7.0.2 released 2020-06-16 13:38:37 +02:00
Gabor Kiss-Vamosi
91c98f147f Merge pull request #1580 from DaPa/master
Code comments spelling fixes
2020-06-16 13:36:36 +02:00
DaPa
0bdeb00838 Resolve conflict with 4668bc0 2020-06-16 14:27:08 +03:00
DaPa
eee2184d10 Revert part of last commit to keep _xcb naming into lv_task_create 2020-06-16 14:10:51 +03:00
Gabor Kiss-Vamosi
df9801eac3 Merge pull request #1584 from BesitzeRuf/dev
Fixes drawing of the image border
2020-06-16 13:10:36 +02:00
Gabor Kiss-Vamosi
eacc9d8ce7 chart: fix memory leak 2020-06-16 13:03:54 +02:00
Gabor Kiss-Vamosi
d6e7187d01 fix crash when drawing gradient to the same color 2020-06-16 12:47:09 +02:00
Gabor Kiss-Vamosi
f61f045135 CHANGELOG: fix typo 2020-06-16 12:05:13 +02:00
Gabor Kiss-Vamosi
4668bc0ee3 fix typo in the API 2020-06-16 12:03:32 +02:00
besitzeruf
ae93ee067c Merge branch 'dev-fix-Asymmetric-border-thickness-on-image-objects' into dev 2020-06-16 11:22:30 +02:00
besitzeruf
59165f077e - Fix when border of the image (bottom and right sides) are drawn with different width ( decreased by 1) 2020-06-16 11:18:45 +02:00
pete-pjb
832dbd644b Remove redundant assert 2020-06-16 09:31:37 +01:00
Gabor Kiss-Vamosi
00f8af0fb5 minor fixes 2020-06-16 10:28:10 +02:00
Themba Dube
10ee9e5e99 Merge branch 'dev' of github.com:littlevgl/lvgl into dev 2020-06-15 17:06:39 -04:00
DaPa
33de1ffdc7 Fixed @embeddedt's review comments
- change the wording to say "message box" and not "button matrix"
 - parameter name should be cb and not xcb due MicroPython
 - also corrected comment for lv_async_call in lv_async.h
2020-06-15 19:48:44 +03:00
pete-pjb
fe5663908c Fix unused variable 2020-06-15 17:29:33 +01:00
pete-pjb
f23873e3f5 Added Functions to extend chart functionality as follows:
/**
 * Set the index of the x-axis start point in the data array
 * @param chart             pointer to a chart object
 * @param ser 				pointer to a data series on 'chart'
 * @param id    			the index of the x point in the data array
 */
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t *
ser, uint16_t id);

/**
 * Set an external array of data points to use for the chart
 * NOTE: It is the users responsibility to make sure the point_cnt
matches the external array size.
 * @param chart             pointer to a chart object
 * @param ser 				pointer to a data series on 'chart'
 * @param array				external array of points for chart
 */
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser,
lv_coord_t array[], uint16_t point_cnt );

/**
 * Set an individual point value in the chart series directly based on
index
 * @param chart             pointer to a chart object
 * @param ser 				pointer to a data series on 'chart'
 * @param value				value to assign to array point
 * @param id				the index of the x point in the array
 */
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser,
lv_coord_t value, uint16_t id);


/**
 * get the current index of the x-axis start point in the data array
 * @param chart             pointer to a chart object
 * @param ser 				pointer to a data series on 'chart'
 * @return 					the index of the current x start point in the data array
 */
uint16_t lv_chart_get_x_start_point(lv_obj_t * chart, lv_chart_series_t
* ser);

/**
 * Get an individual point value in the chart series directly based on
index
 * @param chart             pointer to a chart object
 * @param ser 				pointer to a data series on 'chart'
 * @param id				the index of the x point in the array
 * @return					value of array point at index id
 */
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t *
ser, uint16_t id);
2020-06-15 17:15:05 +01:00
DaPa
585bc329e6 Code comments spelling fixes
Also 2 files have tracing strings affected (shorter with 1 character):
 - lv_obj.c, 1078: LV_LOG_WARN
 - lv_hal_indev.c, 76: LV_LOG_WARN
2020-06-15 17:12:48 +03:00
Gabor Kiss-Vamosi
c20e62d472 lv_gaguge: make lv_gauge_get_angle_offset() offset the labels and needles too
Fixes #1579
2020-06-15 14:16:06 +02:00
Gabor Kiss-Vamosi
9260f9e0aa lv_btnm: fix sending events for hidden buttons 2020-06-14 21:07:42 +02:00
Gabor Kiss-Vamosi
8532bf80df Update CHANGELOG.md 2020-06-14 12:40:49 +02:00
Gabor Kiss-Vamosi
a2bb4099e6 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-14 12:39:35 +02:00
Gabor Kiss-Vamosi
182cbb1aa4 Update LV_OPA_MIN and LV_OPA_MAX to widien the opacity processed range
https://forum.lvgl.io/t/blending-fading-of-body-shadow/2466
2020-06-14 12:36:57 +02:00
nchurly
ccff331e3d Fix #1570: uninitialized variable in lv_draw_img.c (#1574) 2020-06-13 12:28:47 -04:00
OH1BDF
43cc512e5a Added functions to set multiple paddings and margins at once (#1565) 2020-06-12 07:28:11 -04:00
Carlos Diaz
a265165038 Add lv_win_add_btn_left (#1566)
Closes #1535
2020-06-12 07:26:59 -04:00
Themba Dube
8117a70608 Merge branch 'master' into dev 2020-06-12 07:23:47 -04:00
Gabor Kiss-Vamosi
dca12fcd7a Update CHANGELOG.md 2020-06-10 10:14:12 +02:00
Gabor Kiss-Vamosi
e2dabe167d Merge pull request #1562 from arturv2000/MaxMemUsed
Added max_used propriety to lv_mem_monitor_t struct
2020-06-10 10:13:34 +02:00
Gabor Kiss-Vamosi
14a359679a Update CHANGELOG.md 2020-06-09 13:41:24 +02:00
Gabor Kiss-Vamosi
3b111c794c Merge pull request #1561 from microwavesafe/master
Remove dependency on ST CubeMX Hal
2020-06-09 13:40:41 +02:00
Gabor Kiss-Vamosi
1ca1934dbe Merge pull request #1563 from C47D/update_spinner
lv_spinner: Replace remaining pre loader references with spinner
2020-06-09 13:28:53 +02:00
arturv2000
ce8d333407 Update src/lv_misc/lv_mem.c
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-06-09 09:46:42 +01:00
microwavesafe
71e23c4e13 Added example include defines 2020-06-09 09:45:12 +01:00
C47D
84776ca5f7 lv_spinner: Replace remaining pre loader references with spinner 2020-06-08 18:12:21 -05:00
arturv2000
91acf877c6 Attempt to correct error in tests 2020-06-08 21:00:12 +01:00
artur.vieira
0ebcf7e266 Added Max Used propriety to lv_mem_monitor_t struct 2020-06-08 20:22:06 +01:00
andrew
3c70a1b5a2 Fixed typo in include define
Added help in lv_conf_template.h
2020-06-08 18:36:30 +01:00
Gabor Kiss-Vamosi
4effebb3ea Update README.md 2020-06-08 16:41:06 +02:00
Gabor Kiss-Vamosi
9eff0d1cd8 Update CHANGELOG.md 2020-06-08 16:36:16 +02:00
Gabor Kiss-Vamosi
07ddc9bf8a Update CONTRIBUTING.md 2020-06-08 16:14:33 +02:00
Gabor Kiss-Vamosi
9048bcc6a0 Update README.md 2020-06-08 15:51:18 +02:00
Gabor Kiss-Vamosi
94b2e0f1a3 Update CHANGELOG.md 2020-06-08 14:16:25 +02:00
Gabor Kiss-Vamosi
a62b03743d Merge pull request #1560 from DeonMarais64/master
Add lv_btnmatrix_set/get_align capability
2020-06-08 14:15:49 +02:00
Gabor Kiss-Vamosi
4754935038 Update CHANGELOG.md 2020-06-08 14:15:14 +02:00
Gabor Kiss-Vamosi
ee44433f86 Merge pull request #1522 from fhorinek/encoder-buttons
Encoder input proc support for buttons
2020-06-08 14:14:32 +02:00
Gabor Kiss-Vamosi
9c8c8aee72 update CHANGLEOG 2020-06-08 14:13:33 +02:00
Gabor Kiss-Vamosi
2739753f20 Merge pull request #1509 from fhorinek/master
Added focus parent for v7
2020-06-08 14:11:40 +02:00
Gabor Kiss-Vamosi
14de809fa5 fix warings 2020-06-08 14:10:30 +02:00
Gabor Kiss-Vamosi
06fa5b3b8f fix conflicts 2020-06-08 14:02:04 +02:00
Gabor Kiss-Vamosi
1b9ccf9cc6 add the dev branch to CI 2020-06-08 13:56:45 +02:00
Gabor Kiss-Vamosi
36e825f093 Update README.md 2020-06-08 13:51:19 +02:00
Gabor Kiss-Vamosi
13a53d077d lv_textarea: fix character delete in password mode 2020-06-08 13:23:41 +02:00
Gabor Kiss-Vamosi
479851e968 : restructure to allow asserting in from too 2020-06-08 13:10:56 +02:00
andrew
0867f72cb9 Rename attribute define to match existing options style
Moved static array declaration to top of file
Added attribute define to template and checker headers
2020-06-08 08:40:50 +01:00
embeddedt
df08d0bd54 Fix old documentation link in lv_conf_template.h
https://forum.lvgl.io/t/lv-conf-template-h-font-usage-points-to-wrong-domain/2424
2020-06-05 17:08:00 -04:00
andrew
bb5c6437ff Added GPU init to lv_init
Changed blend buffer attr to more general LV_DMA_ATTR
Added define for CMSIS header
Fixed bug with turning on peripheral clock
2020-06-05 14:04:52 +01:00
Gabor Kiss-Vamosi
e1af20997d : fix if not the {0;0} tile is created first 2020-06-05 12:31:02 +02:00
andrew
cd9f34076e Modified DMA2D fill, copy and blend functions to use direct
register writes
2020-06-05 11:10:51 +01:00
andrew
0d897136c9 Added LV_BLEND_BUF_ATTR as blend_buf MUST be in DMA accessible RAM 2020-06-05 11:10:11 +01:00
Deon Marais
0e1b02e328 Add lv_btnmatrix_set/gett_align capability 2020-06-05 12:05:34 +02:00
Deon Marais
e3b5a14275 Add align-member and set/get functions 2020-06-05 11:58:33 +02:00
Gabor Kiss-Vamosi
643bc92958 fix warning 2020-06-05 11:06:32 +02:00
Gabor Kiss-Vamosi
1c88c1e8d4 lv_dropdown: fix missing event when used with encoder 2020-06-05 10:54:13 +02:00
Gabor Kiss-Vamosi
c3f051ac52 Add log in true double buffering mode with 2020-06-05 10:43:26 +02:00
Gabor Kiss-Vamosi
673c493694 include the version number in lv_conf_template.h
https://forum.lvgl.io/t/add-lvgl-version-to-lv-conf-h/2396/3
2020-06-05 10:36:16 +02:00
embeddedt
4f3dac6477 Fix #1557: use of uninitialized linked list 2020-06-04 09:51:26 -04:00
Gabor Kiss-Vamosi
d667e9d221 Update CHANGELOG.md 2020-06-04 11:58:32 +02:00
Gabor Kiss-Vamosi
21e4427e57 theme material: fix list button focus. 2020-06-04 11:56:57 +02:00
Gabor Kiss-Vamosi
7d29b40425 fix crash when text area cleared. Fixes #1556 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
93055bc57c Do not call for transparent pixel 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
d5a3b81737 fix gestures 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
950ac3b993 Merge pull request #1553 from MiSimon/issue_deinit_log
Write to logfile before setting the log callback to NULL
2020-06-03 15:34:35 +02:00
MiSimon
beb496e3ed Write to logfile before setting the log callback to NULL 2020-06-03 12:37:43 +02:00
Pete Bone
822435748a Fix compiler waring in lv_ll.c (#1550) 2020-06-02 07:27:36 -04:00
Gabor Kiss-Vamosi
140904e201 fix build error 2020-06-02 11:03:00 +02:00
Gabor Kiss-Vamosi
25b4d9c34d Update README.md 2020-06-02 08:54:58 +02:00
Gabor Kiss-Vamosi
a49e7e8295 improve size rounding to 4 or 8 in lv_mem, and lv_ll 2020-06-02 08:51:22 +02:00
Gabor Kiss-Vamosi
542fa7e76d linked list: simplify settings next/prev node
https://forum.lvgl.io/t/data-abort-at-start-lvgl-v7-0-compiled-with-full-speed-optimisation-only/2286/25
2020-06-02 08:44:04 +02:00
Gabor Kiss-Vamosi
28f4092247 label: fix lv_label_get_letter_on if BIDI enabled 2020-06-02 07:13:41 +02:00
Gabor Kiss-Vamosi
6adcdda06a fix minor warings 2020-06-01 22:56:10 +02:00
Gabor Kiss-Vamosi
d953d2b9fe Update CHANGELOG.md 2020-06-01 22:44:46 +02:00
Gabor Kiss-Vamosi
7040084fbd Merge pull request #1545 from pete-pjb/32bit_idx
Change all text related indices from 16-bit to 32-bit integers throughout whole library.
2020-06-01 22:44:30 +02:00
Gabor Kiss-Vamosi
6921d872a3 remove debig code 2020-06-01 22:31:30 +02:00
Gabor Kiss-Vamosi
1544bd7b07 relase script: fix wontg file name (lv_version.h instead of lvgl.h) 2020-06-01 22:28:59 +02:00
Gabor Kiss-Vamosi
d28ac991ec update version number in lvgl.h 2020-06-01 22:25:28 +02:00
Gabor Kiss-Vamosi
9c90130fb3 Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Mike Fellows
765a97383a Fix visual studio compile errors in lv_anim code
unary negation operator was being applied to an usigned int in three
places.  I'm not sure what the other compilers are doing to accept
the current code , but I have cast the unsigned ints to a signed one
before applying the unary operator.
2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
5cb287c3c7 Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
32eebbbc0c Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
a535b43290 Release v7.0.1 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
63b1f6805a lv_ta: fix wrong cursor positon when clicked after the last character 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
884e00ee8f rename release_patch.py to release.py 2020-06-01 21:12:29 +02:00
Gabor Kiss-Vamosi
f3d8d98807 extend the release script with lv_examples and lv_drivers handling 2020-06-01 21:11:46 +02:00
Gabor Kiss-Vamosi
4d8ae98621 Merge pull request #1542 from MCF/vs-compile-error-fixes
Fix visual studio compile errors in lv_anim code
2020-06-01 21:06:36 +02:00
Gabor Kiss-Vamosi
e8a0413ad5 Update CHANGELOG.md 2020-06-01 20:39:59 +02:00
Gabor Kiss-Vamosi
ff7e8ea315 Update CHANGELOG.md 2020-06-01 20:39:03 +02:00
Gabor Kiss-Vamosi
91b997769e Release v7.0.1 2020-06-01 20:28:32 +02:00
Gabor Kiss-Vamosi
6654444e0f update release script 2020-06-01 20:23:07 +02:00
PeterB
3561d9e063 Changed all text related indices from 16 bit to 32 bit integers. 2020-06-01 17:51:47 +01:00
Themba Dube
c5c5b2a393 lv_printf: condition floating-point on value not definition 2020-06-01 12:08:48 -04:00
Themba Dube
0c4c6cf199 lv_printf: expose floating-point configuration option 2020-06-01 12:08:08 -04:00
PeterB
a0583f6feb Merge remote-tracking branch 'origin/master' into 32bit_idx 2020-06-01 12:31:14 +01:00
Themba Dube
0673dd0b12 Change dropdown to use 32-bit indexes 2020-06-01 07:18:31 -04:00
Gabor Kiss-Vamosi
ef1242f234 Update LICENCE.txt 2020-05-31 23:03:38 +02:00
Gabor Kiss-Vamosi
f8c7485d82 Update CHANGELOG.md 2020-05-31 22:54:40 +02:00
Gabor Kiss-Vamosi
88b54456ef Update README.md 2020-05-31 21:46:12 +02:00
Gabor Kiss-Vamosi
2be298fc3f Update README.md 2020-05-31 21:45:36 +02:00
Themba Dube
af812b0c55 keyboard: allow backspace to auto-repeat in numeric mode (lv_examples#58) 2020-05-31 08:33:21 -04:00
Mike Fellows
09fb1e60e3 Fix visual studio compile errors in lv_anim code
unary negation operator was being applied to an usigned int in three
places.  I'm not sure what the other compilers are doing to accept
the current code , but I have cast the unsigned ints to a signed one
before applying the unary operator.
2020-05-30 13:05:25 -07:00
Mike Fellows
4575fec915 Fix a few links in README (#1541)
* To some of the simulator/IDE github projects
* To the one of the STM32F7 github projects
2020-05-30 09:13:53 -04:00
Gabor Kiss-Vamosi
4c3db9e02f clarify the usage of template theme 2020-05-29 06:42:29 +02:00
embeddedt
99f1d1bc7a Remove duplicate docs link 2020-05-28 19:22:28 -04:00
Gabor Kiss-Vamosi
ec5b10142f add lv_obj_remove_style 2020-05-28 07:58:10 +02:00
Gabor Kiss-Vamosi
8d5dfa1ec2 chart: fix X tick drawing 2020-05-28 07:57:47 +02:00
Gabor Kiss-Vamosi
27ef3a1d07 fix chart x axix label drawing 2020-05-28 07:52:00 +02:00
Gabor Kiss-Vamosi
91f8b3060e fix verical dashed line 2020-05-28 07:52:00 +02:00
Gabor Kiss-Vamosi
86307c669f remove leftover code 2020-05-27 16:39:00 +02:00
Gabor Kiss-Vamosi
207ec2997f DMA2D: minor fix with double buffering 2020-05-27 16:21:35 +02:00
Gabor Kiss-Vamosi
65c9b64f9a Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-27 16:01:14 +02:00
Gabor Kiss-Vamosi
70162562b2 speed up true double buffering 2020-05-27 16:00:56 +02:00
tgillbe
25a5623e77 Fix lv_slider knob size off-by-one bug (#1531) 2020-05-27 09:19:54 -04:00
Gabor Kiss-Vamosi
4f386f19fe chart: fix y axis label drawing 2020-05-27 11:59:39 +02:00
Gabor Kiss-Vamosi
2be22d3bef list: leaving edit mode with encoder 2020-05-27 11:22:01 +02:00
Gabor Kiss-Vamosi
0a9d8a6133 remove memcpy from lv_ll 2020-05-27 10:36:24 +02:00
Gabor Kiss-Vamosi
6a35a384b8 Merge branch 'encoder-buttons' of https://github.com/fhorinek/lvgl into fhorinek-encoder-buttons 2020-05-27 10:35:58 +02:00
Gabor Kiss-Vamosi
a8904b39ea Merge pull request #1529 from lvgl/kisvegabor-patch-1
Update README.md - CLA test again
2020-05-27 10:09:32 +02:00
Gabor Kiss-Vamosi
08bd2ae669 Update README.md 2020-05-27 10:08:17 +02:00
Gabor Kiss-Vamosi
65a0046891 Merge pull request #1528 from lvgl/kisvegabor-patch-1
Update README.md - Test CLA
2020-05-27 10:03:08 +02:00
Gabor Kiss-Vamosi
421e1fc9f8 Update README.md 2020-05-27 10:01:51 +02:00
Gabor Kiss-Vamosi
306405bcff Merge branch 'master' into speed/shadow 2020-05-26 11:00:09 +02:00
Gabor Kiss-Vamosi
7fb49693f4 minor speed up on rectangle drawing 2020-05-26 10:59:49 +02:00
Gabor Kiss-Vamosi
19c3f9306f improve DMA2D blending dupport 2020-05-26 10:59:29 +02:00
Gabor Kiss-Vamosi
b056315410 add LV_COLOR_MIX_ROUND_OFS to adjust color mix to GPU's algorithms 2020-05-26 10:58:52 +02:00
František Horínek
691ce77800 Modified version for encoder input proc.
Now you can also pass buttons LEFT/RIGHT to emulate the encoder, good for joysticks or small keypads.
All other keys are passed trought.
2020-05-25 15:51:20 +02:00
Gabor Kiss-Vamosi
966b4b11f6 lv_color_mix_with_alpha: fix initialization 2020-05-25 12:44:54 +02:00
Gabor Kiss-Vamosi
b4de4c5ca1 remove dead code 2020-05-25 12:42:38 +02:00
Gabor Kiss-Vamosi
0072a2ade5 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-25 11:55:12 +02:00
Gabor Kiss-Vamosi
eda752ab94 add lv_theme_get_color_secondary 2020-05-25 11:49:04 +02:00
Gabor Kiss-Vamosi
89206c51c3 optimize shdow drawing 2020-05-25 11:13:13 +02:00
Gabor Kiss-Vamosi
21a172ca0d Update README.md 2020-05-25 09:29:17 +02:00
Gabor Kiss-Vamosi
2e64db0261 Update README.md 2020-05-25 08:29:57 +02:00
Gabor Kiss-Vamosi
b4b37b98aa Update README.md 2020-05-25 06:41:06 +02:00
Gabor Kiss-Vamosi
dfb7c6731c Update CODING_STYLE.md 2020-05-25 06:35:00 +02:00
Gabor Kiss-Vamosi
2078e4a01a Update CONTRIBUTING.md 2020-05-25 06:26:30 +02:00
Gabor Kiss-Vamosi
11c80b626c Update CONTRIBUTING.md 2020-05-25 06:26:04 +02:00
Gabor Kiss-Vamosi
e3f63e09cf Update CONTRIBUTING.md 2020-05-25 06:24:33 +02:00
Gabor Kiss-Vamosi
07efe31ff4 Update CONTRIBUTING.md 2020-05-25 06:23:12 +02:00
Gabor Kiss-Vamosi
3837988f2d README: change littlevgl to lvgl 2020-05-25 05:54:38 +02:00
Gabor Kiss-Vamosi
5ea142eaf0 Update config.yml 2020-05-25 05:44:24 +02:00
Gabor Kiss-Vamosi
38944883b1 Update config.yml 2020-05-25 05:44:01 +02:00
Gabor Kiss-Vamosi
ab6d69445e Create config.yml 2020-05-25 05:40:04 +02:00
Gabor Kiss-Vamosi
6c34280b66 Merge pull request #1520 from rene-dev/master
fixed RGB palette name in config template
2020-05-24 13:58:04 +02:00
Gabor Kiss-Vamosi
279e594d3e minor formatting 2020-05-24 13:14:42 +02:00
Gabor Kiss-Vamosi
a2c973bd5b fix warings 2020-05-24 13:13:07 +02:00
Rene Hopf
96ba7df9d3 fixed RGB palette name in config template 2020-05-24 01:38:05 +02:00
Gabor Kiss-Vamosi
7e4e5b7271 Merge branch 'master' of https://github.com/fhorinek/lvgl into fhorinek-master 2020-05-23 14:54:18 +02:00
Gabor Kiss-Vamosi
1666c8cb4f handle focus_parent in pointer indevs 2020-05-23 14:53:23 +02:00
Gabor Kiss-Vamosi
1c9830b715 Update README.md 2020-05-23 14:41:11 +02:00
Gabor Kiss-Vamosi
b10dece511 Update README.md 2020-05-23 14:14:02 +02:00
Gabor Kiss-Vamosi
d8a37e8fd8 update themes to avoid garbage collection of styles 2020-05-22 22:36:24 +02:00
Gabor Kiss-Vamosi
2ea96eaf83 fix warning 2020-05-22 22:05:51 +02:00
Gabor Kiss-Vamosi
a8a3c2a3c7 minor rework on button states 2020-05-22 21:45:11 +02:00
Gabor Kiss-Vamosi
ab4d8c9165 fix infinite roller with encoder 2020-05-22 21:36:22 +02:00
František Horínek
8f19010b17 Update src/lv_core/lv_obj.c
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-05-21 17:27:37 +02:00
Gabor Kiss-Vamosi
4fade082e5 Merge branch 'master' of https://github.com/fhorinek/lvgl into fhorinek-master 2020-05-21 15:17:19 +02:00
Gabor Kiss-Vamosi
2a78353ca4 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-21 15:17:07 +02:00
Gabor Kiss-Vamosi
efaf84f6f7 fix material theme init 2020-05-21 15:13:14 +02:00
Gabor Kiss-Vamosi
6f5b756786 update old function names 2020-05-21 15:01:34 +02:00
Gabor Kiss-Vamosi
bebe1f07df img_draw: fix releasing buffer with DMA2D 2020-05-21 14:23:03 +02:00
František Horínek
b23d945ed4 changed behavior to focus_parent flag 2020-05-21 14:09:56 +02:00
Gabor Kiss-Vamosi
82ad0f0c5c img drawing fixes with 32 bit color depth 2020-05-21 12:46:04 +02:00
Gabor Kiss-Vamosi
f248d47a36 fix typo 2020-05-21 11:33:07 +02:00
Gabor Kiss-Vamosi
fa58aed475 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-21 11:28:00 +02:00
Gabor Kiss-Vamosi
4eb2340f2a img: fix cover check 2020-05-21 11:27:52 +02:00
Gabor Kiss-Vamosi
474b8e0920 CJK: fix built-in SimSun font and wrong UTF-8 decoding in Arabic processor 2020-05-21 10:40:16 +02:00
Gabor Kiss-Vamosi
c77ab45dd3 add material theme to GC_ROOTS 2020-05-21 09:37:37 +02:00
Gabor Kiss-Vamosi
76ae5934ba Update library.json 2020-05-20 14:50:02 +02:00
Amir Gonnen
8233483477 Add missing LV_GC_INCLUDE (#1511) 2020-05-19 20:15:49 -04:00
František Horínek
10ca6d4215 replaced #ifdef to #if 2020-05-19 15:45:09 +02:00
František Horínek
2712f0aeaa Added macro LV_USE_GROUP_FOCUS_PARENT to automatic tests 2020-05-19 15:31:34 +02:00
František Horínek
aaa78ba949 Added focus parent for v7 2020-05-19 15:22:38 +02:00
Gabor Kiss-Vamosi
080d06b838 fix lv_misc.mk. Fixes: #1508 2020-05-19 14:56:14 +02:00
Gabor Kiss-Vamosi
00176b2c7e rename _mask_list to lv_draw_mask_list 2020-05-19 13:29:21 +02:00
Gabor Kiss-Vamosi
f2ff87f820 add LV_DC_ROOT prefix to _mask_list 2020-05-19 13:27:19 +02:00
Gabor Kiss-Vamosi
6a10f3e116 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-19 13:20:38 +02:00
Gabor Kiss-Vamosi
38ae98a565 move (draw) mask_list to gc roots 2020-05-19 13:20:29 +02:00
Gabor Kiss-Vamosi
f2be14868e Update README.md 2020-05-19 11:35:18 +02:00
Gabor Kiss-Vamosi
e6829f6d4b Update CHANGELOG.md 2020-05-19 10:59:21 +02:00
Gabor Kiss-Vamosi
469b676237 Update CHANGELOG.md 2020-05-19 10:57:50 +02:00
Gabor Kiss-Vamosi
5e4456335a Update README.md 2020-05-19 10:57:07 +02:00
Gabor Kiss-Vamosi
46376a4a11 set version number to 7.0.1-dev 2020-05-19 10:31:49 +02:00
Gabor Kiss-Vamosi
72c79b58a8 disable LV_MEM_JUNK 2020-05-19 10:31:13 +02:00
Gabor Kiss-Vamosi
de0d93c47e Update ccpp.yml 2020-05-18 19:05:48 +02:00
Gabor Kiss-Vamosi
e6f89ad799 Update CHANGELOG.md 2020-05-18 17:37:04 +02:00
Gabor Kiss-Vamosi
857ff5e8ed Update CHANGELOG.md 2020-05-18 17:36:36 +02:00
Gabor Kiss-Vamosi
ee6c5e3399 run code formatter 2020-05-18 16:57:23 +02:00
Gabor Kiss-Vamosi
5c7e9bb932 minor fixes 2020-05-18 16:52:23 +02:00
Gabor Kiss-Vamosi
0f95c5b29b comment update littlevgl -> lvgl 2020-05-18 14:55:39 +02:00
Gabor Kiss-Vamosi
382f428a0e keyboard: fix invalid assertatin 2020-05-18 11:46:02 +02:00
Gabor Kiss-Vamosi
a91041bcf7 suppress doxygen warnings 2020-05-18 11:03:10 +02:00
Gabor Kiss-Vamosi
4fb0a5da21 img: remove debug code 2020-05-18 11:02:45 +02:00
Gabor Kiss-Vamosi
f6b759dc71 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-18 10:48:21 +02:00
Themba Dube
6e1d53e11e Merge remote-tracking branch 'origin/master' into dev-7.0 2020-05-15 13:48:25 -04:00
Bill Hargen
7ac9388aed Fix #1498: lv_label_set_text() crash (#1499)
This routine tried to optimize a special case of setting the label text to the same address as previously set, but it did not consider whether the prior set was static and tried to realloc non-allocated memory.
2020-05-15 13:42:50 -04:00
Gabor Kiss-Vamosi
486197955b Update CONTRIBUTING.md 2020-05-15 15:00:10 +02:00
Gabor Kiss-Vamosi
69e2f32984 Update README.md 2020-05-15 14:44:25 +02:00
Gabor Kiss-Vamosi
5fe03c34f5 Update README.md 2020-05-15 14:43:45 +02:00
Gabor Kiss-Vamosi
af312fd2ba checkbox: set bullet size with padding 2020-05-14 11:29:49 +02:00
Gabor Kiss-Vamosi
ac52b502a2 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-14 11:14:43 +02:00
Gabor Kiss-Vamosi
f00d17b496 update the comments of lv_draw_label 2020-05-14 11:14:34 +02:00
Gabor Kiss-Vamosi
f252edb5c1 material theme, dropdown: enable corner clip on the list 2020-05-14 09:36:44 +02:00
Gabor Kiss-Vamosi
e45cd3c31c fix build error with dma2d 2020-05-13 14:47:33 +02:00
Gabor Kiss-Vamosi
0f8513bf77 Merge pull request #1496 from ValentiWorkLearning/dev-7.0
Fixed implicit casting from void* in lv_imgbuf.h
2020-05-13 14:19:55 +02:00
Gabor Kiss-Vamosi
97392f4fdf reduce API size: add underscore prefix to internal functions 2020-05-13 14:11:16 +02:00
Valentyn Korniienko
74a0b0dab2 Fixed implicit casting from void* in lv_imgbuf.h 2020-05-13 14:58:57 +03:00
Gabor Kiss-Vamosi
79329bdb45 revert font decompression optmiziation 2020-05-13 13:24:38 +02:00
Gabor Kiss-Vamosi
d7940734b8 page: fix scrollbar visibility 2020-05-13 01:09:29 +02:00
Gabor Kiss-Vamosi
d9ebf93836 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-13 01:06:10 +02:00
Gabor Kiss-Vamosi
eda4ef8042 optimize color fill with 16 color depth 2020-05-13 01:06:01 +02:00
Gabor Kiss-Vamosi
9b598ec306 fix typo 2020-05-12 21:37:01 +02:00
Gabor Kiss-Vamosi
93e8dd7a2c minor refactoring 2020-05-12 21:30:14 +02:00
Gabor Kiss-Vamosi
a78687ee5d add LV_USE_API_EXTENSION_V6 and LV_USE_IMG_TRANSFORM config options 2020-05-12 21:29:16 +02:00
Gabor Kiss-Vamosi
a1db29b9a2 img: clip corner fixes 2020-05-12 15:00:58 +02:00
Gabor Kiss-Vamosi
52644c2604 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-12 13:57:49 +02:00
Gabor Kiss-Vamosi
34b20b307b btn: lower deafult height 2020-05-12 13:57:43 +02:00
Gabor Kiss-Vamosi
42c5794a05 optimize image zoom 2020-05-12 13:56:40 +02:00
Gabor Kiss-Vamosi
d2a0fb8351 minor fixes 2020-05-12 12:17:15 +02:00
Gabor Kiss-Vamosi
48914aaa7c Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-12 10:55:05 +02:00
Gabor Kiss-Vamosi
8f0418d194 dropdown: set list width to button 2020-05-12 10:54:51 +02:00
Gabor Kiss-Vamosi
ecc23babc5 Merge pull request #1495 from amirgon/dev-7.0
Replace lv_point_t* to lv_point_t[] to represent point array
2020-05-12 00:39:02 +02:00
Amir Gonnen
3f32911b90 Replace lv_point_t* to lv_point_t[] to represent point array
Needed for Micropython Bindings to identify the argument as an array instead of a pointer to a single lv_point_t
2020-05-12 01:08:50 +03:00
Themba Dube
6c1f784d25 Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2020-05-11 12:59:07 -04:00
Georgi Momchilov
18834904ef Update lv_draw_label.c (#1494) 2020-05-11 08:35:49 -04:00
Gabor Kiss-Vamosi
ba5663d3d3 rename LV_DROPDOWN_PART_SCRLBAR to LV_DROPDOWN_PART_SCROLLBAR 2020-05-11 12:34:03 +02:00
Gabor Kiss-Vamosi
d819aa0e4e fix memory corruption in draw_label 2020-05-11 12:32:26 +02:00
Gabor Kiss-Vamosi
ecb5637d9d improve mono theme 2020-05-11 10:28:18 +02:00
Gabor Kiss-Vamosi
b933e5e1ba Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-11 10:21:55 +02:00
Gabor Kiss-Vamosi
d6db1ed511 draw label fix huge memory usage 2020-05-11 10:21:37 +02:00
Gabor Kiss-Vamosi
eaeb362001 optimize lv_mem_buf uage 2020-05-11 10:21:23 +02:00
Kowalski Dark
61bafdb37f Fix typos in header comment (#1493) 2020-05-08 12:49:11 -04:00
embig71
a4ed5369c2 Correct computation from #1490 for vertically oriented slider (#1492) 2020-05-08 12:48:20 -04:00
Gabor Kiss-Vamosi
72988117d5 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-08 13:04:59 +02:00
Gabor Kiss-Vamosi
a760baa869 material theme minor improvements 2020-05-08 13:04:28 +02:00
Gabor Kiss-Vamosi
a026a5b61d fix assert during obj. creation 2020-05-08 12:39:10 +02:00
Gabor Kiss-Vamosi
25aadd4ae9 fix typo in e6f498a2 2020-05-08 12:38:54 +02:00
Gabor Kiss-Vamosi
38a42fa954 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-08 12:30:11 +02:00
Gabor Kiss-Vamosi
e6f498a2da lv_disp_drv_register: fix referencing uninitialized varaible 2020-05-08 12:29:59 +02:00
Gabor Kiss-Vamosi
2500c65506 dma2d fix 2020-05-08 12:09:57 +02:00
Gabor Kiss-Vamosi
f387e1af37 dma2d fixes for F4 2020-05-08 11:53:40 +02:00
Gabor Kiss-Vamosi
2b9608d128 optimize material theme for small displays 2020-05-08 11:53:28 +02:00
Gabor Kiss-Vamosi
341e99587b remove extra file created during merging 2020-05-08 10:25:53 +02:00
Gabor Kiss-Vamosi
9dd387b23e remove bidi.h from lvgl.h 2020-05-08 08:44:31 +02:00
Themba Dube
ceae45ed64 Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2020-05-07 16:37:00 -04:00
Themba Dube
5f1b6bc281 Add lv_roller_set_fix_width to API map 2020-05-07 16:36:51 -04:00
Gabor Kiss-Vamosi
33df0e6470 merge master 2020-05-07 16:04:50 +02:00
Gabor Kiss-Vamosi
7aaa092efd Merge pull request #1490 from BillHargen/master
Correct computation of slider value while pressed
2020-05-07 16:03:43 +02:00
Gabor Kiss-Vamosi
232d22c148 fix conflicts 2020-05-07 16:01:48 +02:00
Gabor Kiss-Vamosi
9975036bb2 formatting 2020-05-07 15:56:07 +02:00
Bill Hargen
695c33147b Correct computation of slider value while pressed 2020-05-07 09:39:32 -04:00
Anton Konev
6a96e07f18 Minor fixes (#1488)
* lvgl/lv_onjx/lv_chart: fixed variable type (uint8_t was compared with 256)

* lvgl/lv_core/lv_refr: fixed double assignemnt

Co-authored-by: anton.konev <anton.konev@planarchel.ru>
2020-05-07 07:44:02 -04:00
Gabor Kiss-Vamosi
bc994c60ee minor fixes 2020-05-06 21:39:45 +02:00
Gabor Kiss-Vamosi
0c6d0d48a3 run code formater 2020-05-06 20:08:46 +02:00
Gabor Kiss-Vamosi
835ed44029 fix warnings 2020-05-06 20:05:53 +02:00
Gabor Kiss-Vamosi
d1f1332555 minor renames and fixes 2020-05-06 20:05:53 +02:00
Gabor Kiss-Vamosi
27621e0945 fix drawing of abnormal arcs 2020-05-06 20:05:53 +02:00
Gabor Kiss-Vamosi
d6b85d16cf page: copy styles in create 2020-05-06 10:55:33 +02:00
Gabor Kiss-Vamosi
64fdfbe13f bar: handle border_post style property 2020-05-06 10:55:21 +02:00
Gabor Kiss-Vamosi
18010c2eaa chart: fix overflow in tick drawing 2020-05-06 09:40:41 +02:00
Gabor Kiss-Vamosi
8e87fc4620 minor fixes 2020-05-06 09:27:38 +02:00
Gabor Kiss-Vamosi
12919453d3 free the buffer of font decompression 2020-05-06 09:27:28 +02:00
Themba Dube
adbc158a5c Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2020-05-04 13:29:52 -04:00
fstengel
69b14a6146 indev_button_proc: fix crash if points array not set (#1486) 2020-05-04 09:56:13 -04:00
embeddedt
7d42f08431 Ensure table always updates if values change
https://forum.littlevgl.com/t/table-not-updating-values-v7-dev/2190
2020-05-04 08:40:01 -04:00
Themba Dube
95d5298ad9 Add some more 6.x compability macros 2020-05-02 18:36:52 -04:00
Amir Gonnen
1633b2e6db Guard USE AP prototypes with macro (#1485) 2020-05-02 18:23:52 -04:00
Gabor Kiss-Vamosi
1e59100ff2 fix build errors 2020-05-02 07:45:04 +02:00
Gabor Kiss-Vamosi
6337286959 image transform fixes 2020-05-01 20:48:16 +02:00
Gabor Kiss-Vamosi
ffa2970ae5 fixes with LV_COLOR_SCREEN_TRANSP 1 2020-05-01 20:30:28 +02:00
Gabor Kiss-Vamosi
fdb85fd9bd Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-05-01 16:54:25 +02:00
Gabor Kiss-Vamosi
c3361a67b2 fix lv_color_t with LV_COLOR_DEPTH 1 2020-05-01 16:54:13 +02:00
Themba Dube
a7c1d97164 Fix GPU support with STM32F746 2020-05-01 09:45:53 -04:00
Gabor Kiss-Vamosi
aad8667a9f run code formatter 2020-05-01 11:17:43 +02:00
Gabor Kiss-Vamosi
bdc98b4e1f minor fixes 2020-05-01 11:14:10 +02:00
Gabor Kiss-Vamosi
a42629f947 theme fixes 2020-05-01 11:04:15 +02:00
Gabor Kiss-Vamosi
4494fc8a5d fix makefile 2020-05-01 10:58:04 +02:00
Gabor Kiss-Vamosi
41c435b808 update lv_conf.h 2020-05-01 10:56:00 +02:00
Gabor Kiss-Vamosi
c0f15666bc change version number v7.0.0-rc 2020-05-01 10:35:43 +02:00
Gabor Kiss-Vamosi
0006edbb67 add LV_STYLE_TRANSFORM_ANGLE/ZOOM 2020-05-01 10:34:52 +02:00
Gabor Kiss-Vamosi
6d79d6d338 add built in persian, hebrew fonts 2020-05-01 10:22:41 +02:00
Gabor Kiss-Vamosi
3ac2c390c6 Merge branch 'feat/arabic' into dev-7.0 2020-05-01 09:51:17 +02:00
embeddedt
929bbcaee4 Fix misleading comment in lv_btnm
https://forum.littlevgl.com/t/comment-refers-to-nonexisting-function/2175
2020-04-30 10:36:54 -04:00
Gabor Kiss-Vamosi
52ecc4e608 Update CHANGELOG.md 2020-04-30 14:47:31 +02:00
Gabor Kiss-Vamosi
3810aadf0a Update CHANGELOG.md 2020-04-30 14:46:33 +02:00
Gabor Kiss-Vamosi
10926a445c Update CHANGELOG.md 2020-04-30 14:42:34 +02:00
Gabor Kiss-Vamosi
6b270c4fc4 fixes in changelog 2020-04-30 12:25:10 +02:00
Gabor Kiss-Vamosi
ff85904c18 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-30 11:27:27 +02:00
Gabor Kiss-Vamosi
6ad909687e add changelog 2020-04-30 11:27:22 +02:00
Gabor Kiss-Vamosi
240c42c227 win: fix button's size 2020-04-30 11:26:35 +02:00
Amir Gonnen
cea9d7be36 Remove unused function declaration (#1482) 2020-04-29 18:19:50 -04:00
Gabor Kiss-Vamosi
013e6e9b21 Merge pull request #1481 from Wielebny666/master
Adjusting min and max values to the number format
2020-04-29 14:46:29 +02:00
Wielebny666
c2404c307c Adjusting min and max values to the number format 2020-04-29 13:24:07 +02:00
Wielebny666
5e9dd93e76 Merge pull request #1 from littlevgl/master
Update
2020-04-29 12:14:55 +02:00
Gabor Kiss-Vamosi
7260eb71f0 Merge pull request #1480 from Wielebny666/master
Missing scroll bar modifier in tab
2020-04-29 12:10:50 +02:00
Gabor Kiss-Vamosi
af5ed425c0 fix comment of lv_tabview_clean 2020-04-29 11:17:57 +02:00
Gabor Kiss-Vamosi
bf034dc511 add LV_THEME_DEFAULT_INCLUDE to lv_conf.h 2020-04-29 10:37:12 +02:00
Gabor Kiss-Vamosi
52edcfece9 rename lv_tabview_clean to lv_tabview_clean_tab 2020-04-29 10:31:51 +02:00
Paweł Kurzawa
3c8c67a22e Missing scroll bar modifier in tab 2020-04-29 10:29:48 +02:00
Gabor Kiss-Vamosi
36934dcbbc btnmatrix: find the nearest button if clicked between buttons
https://forum.littlevgl.com/t/how-to-ignore-clicks-on-button-matrix-background-panel-which-cause-null-button-text/2158
2020-04-29 10:25:24 +02:00
Gabor Kiss-Vamosi
db2792d6d2 upade makefile fixes 2020-04-29 09:03:40 +02:00
Gabor Kiss-Vamosi
80a4613e59 fix build error and upadte lv_conf_template.h 2020-04-29 09:01:35 +02:00
Gabor Kiss-Vamosi
817e1ce530 place some functions to faster memory 2020-04-29 08:38:59 +02:00
Gabor Kiss-Vamosi
f9cde8e034 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-29 08:30:40 +02:00
Gabor Kiss-Vamosi
31198d52fb remove unused functions declarations 2020-04-29 08:29:45 +02:00
Amir Gonnen
9b0fd97587 Small fixes required for Micropython binding (#1479) 2020-04-28 19:25:39 -04:00
Gabor Kiss-Vamosi
ed318039d2 add CJK built-in font 2020-04-28 22:10:19 +02:00
Gabor Kiss-Vamosi
f14c387de3 minor api renames: set/get_static_text/options -> set/get_text/options_static 2020-04-28 21:07:10 +02:00
Gabor Kiss-Vamosi
1245411328 fix warning in themes 2020-04-28 20:51:18 +02:00
Gabor Kiss-Vamosi
a54d6a1752 DMA2D: invalidate cache only if enabled 2020-04-28 14:39:02 +02:00
Gabor Kiss-Vamosi
843fa5e304 DMA2D fix with 16 bit color depth 2020-04-27 21:07:15 +02:00
Gabor Kiss-Vamosi
c80a4d194f Merge branch 'dev-7.0' into speed/gpu 2020-04-27 14:53:17 +02:00
Gabor Kiss-Vamosi
ef0bd78d02 fix warnings 2020-04-27 13:16:35 +02:00
Gabor Kiss-Vamosi
e78fa9a7d1 optimize font decompression writer 2020-04-27 12:57:26 +02:00
Gabor Kiss-Vamosi
43e873108a introduce lv_anim_path_t to encapsulate the path cb 2020-04-27 11:51:18 +02:00
Gabor Kiss-Vamosi
930332ed99 indev: fix possible null pointer dereference 2020-04-26 10:18:49 +02:00
Wielebny666
271ec3f6ee Fix error in indev driver template (#1476) 2020-04-25 12:11:10 -04:00
Gabor Kiss-Vamosi
ef9955f01f Merge branch 'dev-7.0' into hamidrm-dev-7.0 2020-04-25 16:06:33 +02:00
Gabor Kiss-Vamosi
9fe050dcb9 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-25 16:05:20 +02:00
Gabor Kiss-Vamosi
28d2f8b223 material theme: fix tileview edge flash 2020-04-25 16:05:09 +02:00
Wielebny666
f7f675afd8 Fix compile warning in lv_spinbox_set_style (#1473)
discards 'const' qualifier from pointer
2020-04-25 07:52:08 -04:00
embeddedt
ac1680c53f Fix #1472: Ignore DISABLED state when counting button states 2020-04-24 20:24:34 -04:00
Gabor Kiss-Vamosi
15e064f4af fix conflict 2020-04-24 22:05:00 +02:00
Gabor Kiss-Vamosi
660d0d6000 minor fixes 2020-04-24 22:02:24 +02:00
Gabor Kiss-Vamosi
13dd42fd0b attempt to fix random freeze 2020-04-24 22:01:22 +02:00
Gabor Kiss-Vamosi
4502d7a879 fix build error 2020-04-24 20:51:11 +02:00
Gabor Kiss-Vamosi
36b05f5d1f Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-24 20:43:57 +02:00
Gabor Kiss-Vamosi
acd8b8c17f optimize table drawing by buffering row heights 2020-04-24 20:43:46 +02:00
Gabor Kiss-Vamosi
a98dab0171 optmize edge flash animation 2020-04-24 20:33:51 +02:00
Gabor Kiss-Vamosi
05813bb6e4 Merge pull request #1470 from xennex22/dev-7.0
Fixed compiler warnings and errors
2020-04-24 19:33:43 +02:00
xennex22
e27ad279ba Removed const from function parameter 2020-04-24 08:50:06 -07:00
xennex22
eb3287a75c Removed const from function parameter
Otherwise an error is generated with some compilers.  Passing a const parameter is the right way to do it, but all the obj and widget functions would need to be updated.
2020-04-24 08:49:37 -07:00
xennex22
31b5772028 Cast void pointers
C++ compilers will warn otherwise
2020-04-24 08:43:29 -07:00
xennex22
01630fcf57 Merge pull request #10 from littlevgl/dev-7.0
Dev 7.0
2020-04-24 08:38:38 -07:00
Gabor Kiss-Vamosi
d4384829c6 fix the addition of pressed and focused states 2020-04-24 12:34:17 +02:00
Gabor Kiss-Vamosi
5f528d53f1 dma2d fixes 2020-04-24 12:08:33 +02:00
Gabor Kiss-Vamosi
d98362a60d add disp_drv->wait_cb 2020-04-24 11:52:31 +02:00
Gabor Kiss-Vamosi
68f93723df modify display size limits 2020-04-24 11:32:38 +02:00
Gabor Kiss-Vamosi
c7da9ccd2c fix makefile 2020-04-23 20:51:23 +02:00
Gabor Kiss-Vamosi
f5ad2b3e14 uddate display size limit in lv_conf_templ.h 2020-04-23 20:39:47 +02:00
Gabor Kiss-Vamosi
97adb25879 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-23 15:45:21 +02:00
Gabor Kiss-Vamosi
3b869b0258 replace all memset with lv_memset 2020-04-23 15:45:08 +02:00
Gabor Kiss-Vamosi
479d31e5a7 replace all memcpy with lv_memcpy 2020-04-23 15:27:51 +02:00
Gabor Kiss-Vamosi
c149e5de54 fixes for encoder usage 2020-04-23 09:50:50 +02:00
xennex22
232bbc5270 Merge pull request #7 from littlevgl/dev-7.0
Dev 7.0
2020-04-22 08:12:53 -07:00
Gabor Kiss-Vamosi
88d5111994 Merge pull request #1468 from littlevgl/embeddedt-patch-2
Fix #1467: check whether object type is not NULL
2020-04-22 16:16:36 +02:00
embeddedt
d9f82dab53 Fix #1467: check whether object type is not NULL 2020-04-22 10:10:57 -04:00
Gabor Kiss-Vamosi
c340a7b580 minor fixes 2020-04-21 22:21:42 +02:00
Gabor Kiss-Vamosi
e31ac20d00 btn: allow disable state for ever "normal" state 2020-04-21 22:11:20 +02:00
Gabor Kiss-Vamosi
16e3c28f87 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-21 11:36:15 +02:00
Gabor Kiss-Vamosi
b3a8fb9650 minor renames and fixes 2020-04-21 11:36:05 +02:00
Gabor Kiss-Vamosi
8546de4f59 Merge pull request #1465 from xennex22/cpicker-fix
Fixed rect draw when wider then 360 pixels
2020-04-20 15:04:20 +02:00
Gabor Kiss-Vamosi
f1058bbfe0 remove file created when merging master 2020-04-20 14:52:10 +02:00
Gabor Kiss-Vamosi
44f2ca17fd add comments to GPU DMA2D functions 2020-04-20 14:36:35 +02:00
Gabor Kiss-Vamosi
d203c386b4 fix build error 2020-04-20 14:24:45 +02:00
Gabor Kiss-Vamosi
1995f6d58e merge master 2020-04-20 14:23:14 +02:00
xennex22
ce0f893fd7 Merge pull request #1 from xennex22/cpicker-fix
Fixed rect draw when wider then 360 pixels
2020-04-20 04:48:09 -07:00
xennex22
4767e168b5 Fixed rect draw when wider then 360 pixels 2020-04-19 15:41:44 -07:00
Gabor Kiss-Vamosi
cdf3628682 label: fix LV_LABEL_LONG_DOT 2020-04-19 22:44:45 +02:00
Gabor Kiss-Vamosi
101470488b label: clip text to the real area while drawing (respect padding) 2020-04-19 22:28:49 +02:00
Gabor Kiss-Vamosi
60aa0e03a7 remove Azure pipeline config file to use GitHub CI instead 2020-04-19 14:21:44 +02:00
Gabor Kiss-Vamosi
140a8b3a9a enable GitHub CI for dev-7.0 2020-04-19 14:20:22 +02:00
Gabor Kiss-Vamosi
610bee373a test github ci 2020-04-19 14:04:04 +02:00
Gabor Kiss-Vamosi
a5acbbe827 minor fixes 2020-04-18 21:36:19 +02:00
Gabor Kiss-Vamosi
50975c6140 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-18 21:26:49 +02:00
Gabor Kiss-Vamosi
b7cb6f9995 speed up lv_list_add_btn 2020-04-18 21:17:48 +02:00
embeddedt
40595e4052 Fix #1460: incorrect type name for C++ macro 2020-04-17 21:03:19 -04:00
embeddedt
e6f817e545 Fix swapped comments in lv_slider.h 2020-04-17 09:06:39 -04:00
Gabor Kiss-Vamosi
b196b2c400 Merge pull request #1450 from dykeag/patch-1
More reliable determination of architecture size
2020-04-17 14:56:30 +02:00
Gabor Kiss-Vamosi
202fca3d8e Merge pull request #1459 from littlevgl/tabview_inactive
lv_tabview: respect tab button's inactive state
2020-04-17 14:52:43 +02:00
embeddedt
a1e8fd578f lv_tabview: respect tab button's inactive state 2020-04-17 08:10:31 -04:00
Gabor Kiss-Vamosi
f06038b9c8 fix build error after renames 2020-04-17 13:37:03 +02:00
Gabor Kiss-Vamosi
0ad596ecd6 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-17 13:34:45 +02:00
Gabor Kiss-Vamosi
5007e52fb6 minor renames for Micropython binding 2020-04-17 13:34:27 +02:00
小米-黄齐
9916253a6e Fix build warnings (#1457)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: Iab6b1c9d64a865b16b6e39ddeaf7d7295ef74060

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2020-04-17 07:20:40 -04:00
Gabor Kiss-Vamosi
be80438c92 Merge pull request #1452 from littlevgl/task_repeat_count
Add lv_task_set_repeat_count API
2020-04-17 12:53:42 +02:00
Gabor Kiss-Vamosi
bd7c0ad261 fix include path in lv_font_ap_18.c 2020-04-17 11:38:36 +02:00
Gabor Kiss-Vamosi
f56b43d019 update makefile and fix warnings 2020-04-17 10:44:24 +02:00
Gabor Kiss-Vamosi
ef20067cff add LV_USE_ARABIC_PERSIAN_CHARS to lv_conf_templ.h 2020-04-17 10:34:12 +02:00
Gabor Kiss-Vamosi
9de260d648 integrate Arabic processing in to lv_label 2020-04-17 10:30:11 +02:00
Gabor Kiss-Vamosi
bab1d87f2d Merge branch 'dev-7.0' of https://github.com/hamidrm/lvgl into hamidrm-dev-7.0 2020-04-17 08:59:04 +02:00
Gabor Kiss-Vamosi
db154bd820 minor fixes 2020-04-17 08:58:34 +02:00
embeddedt
9bd86963c9 Add note about header guard in lv_conf.h (#1347) 2020-04-16 21:22:06 -04:00
Gabor Kiss-Vamosi
23368fa704 draw_img: blend argb images directly with DMA2D in trivial cases 2020-04-16 16:37:02 +02:00
Gabor Kiss-Vamosi
6f87d29ac7 more dma2d to a separate file 2020-04-16 16:12:35 +02:00
Gabor Kiss-Vamosi
f6ae49d29c minor fixes 2020-04-16 11:13:59 +02:00
Gabor Kiss-Vamosi
54019d4934 add builtin STM32 DMA2D support 2020-04-16 11:12:20 +02:00
Themba Dube
577d6273ab Add lv_task_set_repeat_count API 2020-04-15 17:57:06 -04:00
dykeag
d05264293b More reliable determination of architecture size
If available, use c99 headers and macros to determine architecture size.
2020-04-15 11:17:08 -04:00
Gabor Kiss-Vamosi
e54478343e merge master 2020-04-14 14:57:04 +02:00
Gabor Kiss-Vamosi
25c843ca0c Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-14 14:45:45 +02:00
Gabor Kiss-Vamosi
cf4f0319de add fonts in 32..48px range 2020-04-14 14:45:35 +02:00
Gabor Kiss-Vamosi
6b756a6521 draw: fixes related to blend modes 2020-04-14 14:44:10 +02:00
Gabor Kiss-Vamosi
c757860472 add spinbox to mono theme 2020-04-14 14:10:23 +02:00
Gabor Kiss-Vamosi
ca03ef2b1f Merge pull request #1445 from TGoyen/dev-7.0
Correct style_tick_line in Mono theme
2020-04-14 12:51:13 +02:00
Gabor Kiss-Vamosi
742eb4f6c8 fix warnings 2020-04-14 11:06:56 +02:00
Gabor Kiss-Vamosi
6563f2fa0d lv_mem_free: periodically peform full defrag 2020-04-14 10:56:40 +02:00
Gabor Kiss-Vamosi
9ad1e31521 fix chroma keyed image drawing 2020-04-14 10:20:32 +02:00
Gabor Kiss-Vamosi
c33b3d60fe Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-14 10:05:25 +02:00
Gabor Kiss-Vamosi
e44749deb8 update lv_conf_templ.h 2020-04-14 10:05:15 +02:00
Gabor Kiss-Vamosi
7d5609101f optimize image drawing 2020-04-14 10:00:01 +02:00
Gabor Kiss-Vamosi
e5254bdfef theme updates 2020-04-14 09:55:11 +02:00
Todd Goyen
3d93975e0a Prevent Red Channel from clobbering Green in color_blend_true_color_additive()
- In 8 and 32 bit mode, Red channel data would leak into Green
2020-04-13 19:39:39 -07:00
Todd Goyen
a9f110da1e Correct style_tick_line in Mono theme to only be created if the Spinner is Enabled 2020-04-13 19:32:21 -07:00
Bill Hargen
4c2fcebedb Fix #1438 - round up memory size for decompressing glyph (#1441) 2020-04-13 06:00:45 +02:00
Gabor Kiss-Vamosi
0c309e22e9 fix grid layot. Fixes #1442 2020-04-13 06:00:29 +02:00
scandermore
7f456fc5f3 Fix issue with inactive list buttons activating (#1436)
Fixed a problem where a button in inactive state was activated when another button was pressed in the list, and the list was in single mode
2020-04-13 06:00:16 +02:00
Gabor Kiss-Vamosi
f0a8eb8d1a chart: fix dafault max axis label string length 2020-04-12 14:49:50 +02:00
Gabor Kiss-Vamosi
ccbf4373af spinbox: fix sign after creation is min value > 0 2020-04-12 14:49:02 +02:00
Gabor Kiss-Vamosi
634df1da8a solve conflicts 2020-04-09 15:46:12 +02:00
Gabor Kiss-Vamosi
28e0b40e5e introduce LV_DPX 2020-04-09 15:29:31 +02:00
Gabor Kiss-Vamosi
f3eb40ce2f minor fixes 2020-04-09 15:29:06 +02:00
Gabor Kiss-Vamosi
db46af2fdb improve dark theme 2020-04-09 15:28:43 +02:00
Gabor Kiss-Vamosi
2f6a1ca8bf minor group related fixes 2020-04-09 12:25:50 +02:00
Gabor Kiss-Vamosi
0dc8ecaf26 minor chart optmizations 2020-04-09 11:46:00 +02:00
Gabor Kiss-Vamosi
8c7be3266e minor chart optimization 2020-04-09 09:55:52 +02:00
Gabor Kiss-Vamosi
30205aebeb minor theme update 2020-04-09 08:41:03 +02:00
Gabor Kiss-Vamosi
504c4aaaa7 Merge branch 'dev-7.0' of ../../../eclipse-workspace/lv_sim_eclipse_sdl_dev/lvgl into dev-7.0 2020-04-09 07:11:36 +02:00
Gabor Kiss-Vamosi
49456f1e5c linemeter and gauge invalidation optimization 2020-04-09 07:11:12 +02:00
Gabor Kiss-Vamosi
3b81496cb5 Merge branch 'dev-7.0' of ../../../eclipse-workspace/lv_sim_eclipse_sdl_dev/lvgl into dev-7.0 2020-04-08 20:54:51 +02:00
Gabor Kiss-Vamosi
1ddf83a73c minor fixes 2020-04-08 20:54:02 +02:00
Gabor Kiss-Vamosi
d04d5ab4d4 add initials version of margin (style property) 2020-04-08 11:12:06 +02:00
Gabor Kiss-Vamosi
3abd907404 fix lv_indev_set_button_points prototype 2020-04-07 14:26:44 +02:00
Themba Dube
c0d689b698 Merge branch 'skypoldo-spinbox-rollover' into dev-7.0 2020-04-06 19:42:34 -04:00
Themba Dube
6a2bd516a9 Merge branch 'spinbox-rollover' of https://github.com/skypoldo/lvgl into skypoldo-spinbox-rollover 2020-04-06 19:42:26 -04:00
Themba Dube
23ba886dde Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2020-04-06 19:38:21 -04:00
Themba Dube
e6c1c837f8 Merge remote-tracking branch 'origin/master' into dev-7.0 2020-04-06 19:37:38 -04:00
Gabor Kiss-Vamosi
5ab7222bd9 minor fixes 2020-04-06 16:21:53 +02:00
Gabor Kiss-Vamosi
d75ea5f482 imgbtn: avoid warning during creation 2020-04-06 15:38:17 +02:00
Gabor Kiss-Vamosi
559709e69f theme updates 2020-04-06 14:23:57 +02:00
Gabor Kiss-Vamosi
ff8afc8b0c makefile and test fixes 2020-04-06 12:15:51 +02:00
Gabor Kiss-Vamosi
c3b2b57062 remove debug variables 2020-04-06 11:41:49 +02:00
Gabor Kiss-Vamosi
4e79c1b3f4 radius mask: use previus sqrt result and approximate where possible 2020-04-06 11:38:40 +02:00
Gabor Kiss-Vamosi
500691afa7 merge dev-7.0 2020-04-06 11:18:38 +02:00
Gabor Kiss-Vamosi
2c48cf5917 theme fix 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
4dc9d4ccd0 update lv_conf_internal.h 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
b4849d0ce1 replace roboto font with montserrat and add built-in fonts for every 2px from 12-32px 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
3519e31888 improve material theme 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
22bf167be3 bar: fix indicator's border drawing 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
e76a5d6d53 start mono theme 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
919aab01b8 minor fixes 2020-04-06 10:50:25 +02:00
Gabor Kiss-Vamosi
922cc6fc52 sqrt speed up tests 2020-04-06 09:02:24 +02:00
Gabor Kiss-Vamosi
06484394ce improve material theme 2020-04-03 15:38:20 +02:00
Gabor Kiss-Vamosi
bc780b0b3c bar: fix indicator's border drawing 2020-04-03 15:38:10 +02:00
Gabor Kiss-Vamosi
da23cc952f start mono theme 2020-04-03 15:34:37 +02:00
Gabor Kiss-Vamosi
110f16e1df minor fixes 2020-04-03 13:31:11 +02:00
Gabor Kiss-Vamosi
9e4ec59515 fix warning. Closes #1431 2020-04-03 13:13:40 +02:00
Gabor Kiss-Vamosi
5d8798b514 Fix write of of buffer with true double buffering and set_px_cb 2020-04-03 11:38:56 +02:00
Gabor Kiss-Vamosi
eb7909124e add LV_LINEMETER_PRECISE to balance performance and quality 2020-04-02 11:54:33 +02:00
Gabor Kiss-Vamosi
900915c58a Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-04-02 09:50:54 +02:00
Gabor Kiss-Vamosi
51a096b70e minor fixes 2020-04-02 09:48:30 +02:00
Gabor Kiss-Vamosi
163498e192 minor fixes + lv_sqrt() optmization 2020-04-02 09:31:38 +02:00
skypoldo
adcfd69f35 Update lv_spinbox.c
Rollover functionakity changed.

Increase: if new value is over max, set to max first, then reset to minimum

Decrease: if new value is below min, set to min first, then reset to maximum
2020-03-31 17:39:20 +02:00
embeddedt
0db067e27b Merge pull request #1422 from xennex22/dev-7.0
Improve arcs and fix handing of UTF-8 options with dropdown
2020-03-31 10:05:38 -04:00
Gabor Kiss-Vamosi
c234dcd64e update lv_conf_templ.h 2020-03-31 14:18:02 +02:00
Gabor Kiss-Vamosi
6cf24f76e4 theme_init: report style change to all objects 2020-03-31 14:13:44 +02:00
Gabor Kiss-Vamosi
7d5acdcf33 theme: allow live theme update 2020-03-31 14:13:44 +02:00
Gabor Kiss-Vamosi
8bf1cc6f6b label: fix label align with SCROLL or SCROLL_CIRC long mode 2020-03-31 12:18:11 +02:00
Gabor Kiss-Vamosi
858c21d999 optmize lv_canvas_fill_bg 2020-03-31 12:14:45 +02:00
Gabor Kiss-Vamosi
8f81a04ffb img drawing: fix ARGB recoloring 2020-03-31 12:14:45 +02:00
Gabor Kiss-Vamosi
ef7a8f3543 shadow fixes 2020-03-31 11:06:57 +02:00
Gabor Kiss-Vamosi
88c31521e0 remove unused variables 2020-03-31 10:21:36 +02:00
Gabor Kiss-Vamosi
1692cc7b7d optimize shadow drawing 2020-03-31 10:16:11 +02:00
xennex22
5c60112b29 Fixed insert of utf8 options 2020-03-30 15:06:14 -07:00
xennex22
98e8e9c3b0 Prevent more than 360 degree circle being drawn 2020-03-30 15:03:40 -07:00
xennex22
61553426ef Initialize rotation value 2020-03-30 09:13:07 -07:00
xennex22
7e8f6368d6 Added lv_arc_set_rotation, fixed drawing full circle 2020-03-30 09:09:13 -07:00
xennex22
e805e59e8c Added lv_arc_set_rotation 2020-03-30 08:28:50 -07:00
Gabor Kiss-Vamosi
f545db3117 minor fixes 2020-03-29 22:00:48 +02:00
Abdullah Alsigar
e3e130c54c Fix comment typo (#1423) 2020-03-28 11:10:21 -04:00
xennex22
38cb4e73b3 Changed angle data type to uint16_t 2020-03-27 10:20:51 -07:00
xennex22
49b6dc7d33 Changed tabs to spaces 2020-03-27 10:15:51 -07:00
xennex22
52da15c8e7 Changed angle data type to uint16_t 2020-03-27 10:14:09 -07:00
Gabor Kiss-Vamosi
dde615489f Merge pull request #1421 from turoksama/master
Fix a crash with null indev input in lv_indev_wait_release()
2020-03-27 15:09:23 +01:00
Gabor Kiss-Vamosi
57220246e9 fix warning 2020-03-27 10:21:23 +01:00
Gabor Kiss-Vamosi
b772601018 linemeter, gauge: update default size 2020-03-27 10:00:10 +01:00
Gabor Kiss-Vamosi
afcb5c70bc optmize line drawing 2020-03-27 09:52:32 +01:00
Gabor Kiss-Vamosi
9f7365103b increase indev_read_task priority to HIGH to avoid blocking by disp_refr_task 2020-03-27 09:41:58 +01:00
Gabor Kiss-Vamosi
58fc703dba add lv_disp_flush_is_last() 2020-03-27 08:47:52 +01:00
Gabor Kiss-Vamosi
6741f0c283 lv_draw_blend: update GPU px limit 2020-03-27 08:41:11 +01:00
Gabor Kiss-Vamosi
d8afe0c980 update lv_conf_template.h 2020-03-27 08:40:15 +01:00
Gabor Kiss-Vamosi
ae88d7ae30 linemeter: speed optmiziation 2020-03-27 08:29:39 +01:00
Gabor Kiss-Vamosi
b181576bf4 increase GPU usage limit 2020-03-26 16:38:11 +01:00
Gabor Kiss-Vamosi
1b61e553fc theme material: fix build error. Closes #1419 2020-03-26 15:59:35 +01:00
Gabor Kiss-Vamosi
c9afbaafa2 material theme updates 2020-03-26 15:51:33 +01:00
Gabor Kiss-Vamosi
c8c240a302 btn, btnmatrix: minor fixes 2020-03-26 15:50:57 +01:00
Gabor Kiss-Vamosi
21a7acd7a2 lv_img_buf_transorm: remove unnecessary calculations 2020-03-26 15:50:24 +01:00
Gabor Kiss-Vamosi
f6ad61c88b gauge: fix allocation with wrong size 2020-03-26 15:49:23 +01:00
Gabor Kiss-Vamosi
23c2d804f0 experiemnt with more accurate lv_color_mix 2020-03-26 08:58:16 +01:00
Gabor Kiss-Vamosi
8fe169981f optimize ARGB+opa image drawing 2020-03-26 08:57:51 +01:00
Samuel
e655373df2 Fix a null indev input in lv_indev_wait_release()
Will crash on calling while no indev returned conditions, such as delayed for an deletion of objects automatically when idle(no interactive inputs).
Perhaps we will think of that it is "your" responsibility to check before calling. well, I think it may not be easy for the one who does not familar with the library, and I stucked here and debug for hours.
2020-03-26 14:08:25 +08:00
xennex22
d14cd826c3 Change angle values to uint16_t 2020-03-25 18:09:37 -07:00
paolog
a049df2db6 Copy rollover extra field
Added copy of the new extra field when creating a new spinbox copying an existing one
2020-03-25 20:50:21 +01:00
paolog
f8d67a4968 Removed NULL check 2020-03-25 17:37:36 +01:00
paolog
3ab2d8470b Changed rollover field type 2020-03-25 17:36:33 +01:00
skypoldo
a6f3ed8102 Added rollover function to spinbox
The rollover functionalty allows the spinbox to turn aound the range of values. Increasing over maximum values restarts from minimum value. Decreasing below minimum value restarts fro maximum value.
2020-03-25 16:17:01 +01:00
Gabor Kiss-Vamosi
10cd99df5b lv_color_mix_with_alpha: minor fix 2020-03-25 16:15:03 +01:00
Gabor Kiss-Vamosi
e6ad7e2332 fix image zoom with RGB images 2020-03-25 16:14:57 +01:00
Gabor Kiss-Vamosi
c0c1ccec1d belnding fixes with transparent screen 2020-03-25 16:10:51 +01:00
Gabor Kiss-Vamosi
ba1639848d reduce CPU load of PERF_MONITOR 2020-03-25 16:09:30 +01:00
Gabor Kiss-Vamosi
80973db76e minor fixes 2020-03-25 10:07:06 +01:00
Gabor Kiss-Vamosi
848defad9a lv_draw_rect: remove unreachable code 2020-03-25 10:06:57 +01:00
xennex22
cf45342e8d Added bg arc get functions 2020-03-24 13:42:27 -07:00
xennex22
d99b802ac2 Added bg arc gets 2020-03-24 13:41:19 -07:00
Gabor Kiss-Vamosi
242eaa708d Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-24 20:59:25 +01:00
Gabor Kiss-Vamosi
83770e004c lv_img_buf_tranform: fix inaccurate color mixing 2020-03-24 20:59:12 +01:00
Gabor Kiss-Vamosi
b4f8c71501 lv_dropdown_add_option: add invalidation 2020-03-24 20:25:04 +01:00
Gabor Kiss-Vamosi
29bf244e89 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-24 20:14:50 +01:00
Gabor Kiss-Vamosi
4e85f9df1c label: keep scroll position when the text changes 2020-03-24 20:14:39 +01:00
Gabor Kiss-Vamosi
f4ececf7c7 add lv_anim_get 2020-03-24 20:14:19 +01:00
Gabor Kiss-Vamosi
b40c5ada05 table: add asserts after allocations 2020-03-24 19:38:57 +01:00
Gabor Kiss-Vamosi
d481960808 Merge pull request #1412 from xennex22/dev-7.0
Add gauge value formatting function
2020-03-24 19:34:23 +01:00
Gabor Kiss-Vamosi
db2259c742 canvas: fix duplicated invalidation 2020-03-24 19:27:06 +01:00
Gabor Kiss-Vamosi
437169243b canvas: invalidate in lv_canvas_draw_... 2020-03-24 14:13:09 +01:00
Gabor Kiss-Vamosi
b9b6d80c4e Update CONTRIBUTING.md 2020-03-24 14:00:25 +01:00
Gabor Kiss-Vamosi
bb0c5a968c run formatter 2020-03-24 10:13:52 +01:00
Gabor Kiss-Vamosi
a8b49faf6b table: optmize text drawing 2020-03-24 10:05:40 +01:00
Gabor Kiss-Vamosi
9876197131 furthe belnding fixes 2020-03-24 09:44:00 +01:00
Gabor Kiss-Vamosi
ec57e921e2 fix belnding issue. Fixes #1417 2020-03-24 09:37:03 +01:00
Gabor Kiss-Vamosi
7d5250a181 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-24 09:07:04 +01:00
Gabor Kiss-Vamosi
69b22d4c54 arc draw: draw nothing if start_angel == end_angle 2020-03-24 09:06:41 +01:00
Gabor Kiss-Vamosi
ca6c6c6fcc fix warning 2020-03-24 09:05:46 +01:00
Gabor Kiss-Vamosi
1a94e82834 add LV_TXT_FLAG_FIT to skip some text widrth calculations 2020-03-24 08:46:28 +01:00
Gabor Kiss-Vamosi
49b0751dc8 optimize 2020-03-24 08:22:41 +01:00
Gabor Kiss-Vamosi
18caad5058 minor blending optmization 2020-03-24 06:34:20 +01:00
embeddedt
7d96db8b06 Update version shield 2020-03-23 16:45:05 -04:00
Gabor Kiss-Vamosi
523c9793cb draw label: remove 8bpp optimization becasue it's not that effective 2020-03-23 17:13:46 +01:00
Gabor Kiss-Vamosi
f9edf0b341 label drawing optimizations 2020-03-23 17:02:33 +01:00
Gabor Kiss-Vamosi
67a6ca7ac5 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-23 12:42:12 +01:00
Gabor Kiss-Vamosi
cc484b2fce draw label fix with opacity 2020-03-23 12:41:59 +01:00
Gabor Kiss-Vamosi
dcc9fc7255 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-23 12:41:36 +01:00
Gabor Kiss-Vamosi
3ad6eeedc5 minor formatting 2020-03-23 12:39:34 +01:00
Gabor Kiss-Vamosi
15c2a6d0cd letter draw minor optimizations 2020-03-23 12:35:26 +01:00
Gabor Kiss-Vamosi
a517defbd7 generate fonts with ker class (faster) and degree and bullet smybols 2020-03-23 12:35:10 +01:00
Gabor Kiss-Vamosi
3249700ec5 add 'generate_all.py' script to generate all fonts at once 2020-03-23 12:32:23 +01:00
Gabor Kiss-Vamosi
0d303e16e6 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-23 09:25:13 +01:00
Gabor Kiss-Vamosi
68b31008b7 table: automatically expand row_cnt as needed 2020-03-23 09:25:04 +01:00
Gabor Kiss-Vamosi
c57aacafa2 font decompression: fix buffer overflow 2020-03-23 09:24:41 +01:00
Tony Stuart
40b351730f lv_mbox: remove incorrect assignment (#1415) 2020-03-22 16:43:13 -04:00
Gabor Kiss-Vamosi
6fae3a0eb6 draw_img: optimize ARGB rendering 2020-03-22 13:20:09 +01:00
Gabor Kiss-Vamosi
2a1db9ee86 dropdown: fix set/get anim time 2020-03-21 01:24:58 +01:00
Gabor Kiss-Vamosi
2d3ad7f99f fix obj_del_core 2020-03-21 00:37:41 +01:00
Gabor Kiss-Vamosi
6b3aa73c17 fix lv_obj_del 2020-03-21 00:31:24 +01:00
xennex22
7c3e20af49 Added includes 2020-03-20 15:30:51 -07:00
xennex22
d3127af4c7 Fixed function comment 2020-03-20 15:28:11 -07:00
xennex22
cc8667482f Added lv_utils_set_decimal_separator 2020-03-20 15:26:43 -07:00
xennex22
41117ac0a9 Added lv_utils_set_decimal_separator 2020-03-20 15:24:17 -07:00
Gabor Kiss-Vamosi
9abe6b89cc optimize lv_memcpy and lv_memset_... 2020-03-20 21:52:53 +01:00
Gabor Kiss-Vamosi
ac67cad801 remove lv_obj.c/delete_children as it was very similar to lv_obj_del
Ref: https://forum.littlevgl.com/t/lv-obj-del-lv-event-delete-ordering/1859
2020-03-20 13:41:47 +01:00
xennex22
9846c3f62c Renamed lv_gauge_format_cb_t 2020-03-20 04:17:11 -07:00
Gabor Kiss-Vamosi
2a0a6652ae draw rect: fix overdrawing 2020-03-20 12:16:21 +01:00
xennex22
cd5084cd64 Renamed lv_gauge_format_cb_t 2020-03-20 04:15:38 -07:00
xennex22
9a5acbcb4f Changed value typedef to int32_t 2020-03-20 03:51:19 -07:00
xennex22
982c65da93 Changed value typedef to int32_t 2020-03-20 03:49:50 -07:00
xennex22
ae64c3ebf3 Removed gauge and line meter value typedef 2020-03-20 03:48:38 -07:00
xennex22
e8d527f2d9 Change value typedef to int32_t 2020-03-20 03:47:23 -07:00
xennex22
7418f46054 Change value typedef to int32_t 2020-03-20 03:46:44 -07:00
xennex22
dd24c844f6 Undo typedef addition 2020-03-20 03:43:34 -07:00
Gabor Kiss-Vamosi
df01215678 draw_rect: remove debug code 2020-03-20 11:18:02 +01:00
Gabor Kiss-Vamosi
34aaf71a17 btnm: fix undeflow in buttons arrea calculation 2020-03-20 11:05:42 +01:00
Gabor Kiss-Vamosi
786e151661 lv_memcpy: fix according to #1413 2020-03-20 10:52:48 +01:00
Gabor Kiss-Vamosi
3e5275708e add custom memset and optimize masked belnding 2020-03-20 10:35:50 +01:00
Gabor Kiss-Vamosi
3ed8aa86e6 lv_memcpy: minor optimization 2020-03-19 20:45:26 +01:00
Gabor Kiss-Vamosi
3ee8763838 blending a color mixing speed up 2020-03-19 15:29:03 +01:00
Gabor Kiss-Vamosi
dd17e7c9b2 add lv_memcpy.c/h (faster then gcc memcpy) 2020-03-19 15:27:45 +01:00
Gabor Kiss-Vamosi
f4bca3889f add lv_color_mix_premult 2020-03-19 15:26:55 +01:00
Gabor Kiss-Vamosi
d0864e72e0 Merge branch 'fix/arc-end-angle' into dev-7.0 2020-03-19 09:49:07 +01:00
Gabor Kiss-Vamosi
2af4f70382 arc: do not limit end angle to allow full circle 2020-03-19 09:48:51 +01:00
Gabor Kiss-Vamosi
47c54d5772 fix warnings 2020-03-19 09:47:24 +01:00
Gabor Kiss-Vamosi
8867df8f18 fix conflict 2020-03-19 09:34:11 +01:00
Gabor Kiss-Vamosi
530807eca1 minor fixes 2020-03-19 09:32:42 +01:00
Gabor Kiss-Vamosi
229463d801 update material theme 2020-03-19 09:32:33 +01:00
xennex22
5248e8953f Added lv_gauge_value_t and lv_linemeter_value_t typedefs 2020-03-17 16:13:55 -07:00
xennex22
7581cfd8c1 Use lv_gauge_value_t for value data type 2020-03-17 09:50:16 -07:00
xennex22
e990b1c521 Use lv_gauge_value_t for value data type 2020-03-17 09:48:06 -07:00
xennex22
69a726940e Use lv_linemeter_value_t for value data type 2020-03-17 09:45:44 -07:00
xennex22
be685a648e Use lv_linemeter_value_t for value data type 2020-03-17 09:44:44 -07:00
xennex22
17759f7932 Added gauge & linemeter value typedefs 2020-03-17 09:43:05 -07:00
Gabor Kiss-Vamosi
dc0f0e6e5b Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-17 13:54:49 +01:00
Gabor Kiss-Vamosi
aff7eb1653 arc draw fixes 2020-03-17 13:54:37 +01:00
xennex22
61e296dc2a Remove locale reference 2020-03-17 04:27:56 -07:00
xennex22
72b9a2b739 Added gauge label format function 2020-03-17 04:17:43 -07:00
xennex22
0e5d99d159 Added gauge value format function 2020-03-17 04:14:58 -07:00
xennex22
9e1c261eb0 Added lv_utils_num_to_str_fixed 2020-03-17 04:12:26 -07:00
xennex22
546909c1d2 Added lv_utils_num_to_str_fixed 2020-03-17 04:10:42 -07:00
Gabor Kiss-Vamosi
de103cf0d2 textarea: fix special case of copy, with online + center align + RTL base dir 2020-03-17 07:15:56 +01:00
Themba Dube
ab10bdaa03 Make lv_switch respect base direction 2020-03-16 13:58:09 -04:00
Gabor Kiss-Vamosi
f8c8c75361 dropdown: fixes with RTL basedir 2020-03-16 16:23:14 +01:00
Gabor Kiss-Vamosi
fd302d259e obj positiong fixes with RTL base dir 2020-03-16 16:07:52 +01:00
Gabor Kiss-Vamosi
89fd050df1 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-16 15:47:46 +01:00
Gabor Kiss-Vamosi
5f41d3e24a imporve light theme + minor fixes 2020-03-16 15:46:31 +01:00
Themba Dube
82d4c8d6ed lv_bar: fix #1406 (animation issue) 2020-03-14 16:16:33 -04:00
Themba Dube
b5371e9830 Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2020-03-14 15:57:43 -04:00
Themba Dube
d399dec0c7 Improve slider handling 2020-03-14 15:57:35 -04:00
hamidrm
95cad47068 Add Arabic & Persian letters in the RTL range 2020-03-14 22:53:59 +03:30
hamidrm
d53d09bb71 AP font name changed 2020-03-14 21:52:37 +03:30
hamidrm
fe28c947c4 Arabic and Persian text support 2020-03-14 21:43:09 +03:30
Gabor Kiss-Vamosi
b58edce0d0 theme material: add padding around page's scrollable 2020-03-14 00:03:18 +01:00
Gabor Kiss-Vamosi
6fbf7db1a6 review material theme 2020-03-14 00:01:03 +01:00
Gabor Kiss-Vamosi
66bc27e424 Merge pull request #1408 from xennex22/dev-7.0
dropdown: convert static options to dynamic when lv_dropdown_add_option is called
2020-03-13 10:19:19 +01:00
embeddedt
00bc5440ad Fix uninitialized variable usage in tabview 2020-03-12 13:18:24 -04:00
Gabor Kiss-Vamosi
e7bab27708 draw label: skip empty letters. Closes #1407 2020-03-12 12:03:17 +01:00
Gabor Kiss-Vamosi
8f89ba2093 page scroll propagation: clear scroller's scrollbar visiblilty in DRAG mode 2020-03-11 22:23:31 +01:00
Gabor Kiss-Vamosi
2d71bc7cc5 msgbox: fix for multi line button matrix 2020-03-11 22:22:39 +01:00
xennex22
f6b8a2f1b6 Added lv_dropdown_clear_options, convert options when adding 2020-03-11 13:14:47 -07:00
xennex22
e19ce6b451 Added lv_dropdown_clear_options 2020-03-11 13:11:50 -07:00
xennex22
d5ab09cf7f Reset number of options when clearing static options 2020-03-11 03:36:25 -07:00
xennex22
bcbcb6f31d Fixed lv_dropdown_add_option with default static options 2020-03-11 03:30:56 -07:00
Gabor Kiss-Vamosi
1023909acd minor fixes 2020-03-11 08:14:08 +01:00
Gabor Kiss-Vamosi
8cdc8bf6fc group related fixes 2020-03-10 22:11:17 +01:00
Gabor Kiss-Vamosi
ca5a78bb5b group related fixes 2020-03-10 21:01:53 +01:00
Gabor Kiss-Vamosi
5ef87d7359 group related fixes 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
2ebb68af96 drodown: add default options 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
27e6525a7a add __func__ to log messages 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
95c64cf7f3 add lv_win_Set_btn_width 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
4944613152 indev: imrove handling of disabled obejcts 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
cd85d96fca style refresh fixes 2020-03-10 20:55:44 +01:00
Gabor Kiss-Vamosi
c26635ed3e Update lv_port_disp_template.c 2020-03-10 13:28:33 +01:00
Gabor Kiss-Vamosi
5ad1cb76c2 increase animation task priority 2020-03-10 11:59:51 +01:00
Gabor Kiss-Vamosi
c3f8b19ec9 remove lv_obj_float_top_in 2020-03-10 10:51:47 +01:00
Gabor Kiss-Vamosi
364955c7d7 optimize lv_obj_get_draw_rect_ext_pad_size 2020-03-10 10:51:47 +01:00
Gabor Kiss-Vamosi
291545224c arc: handle out of bounds start/end values 2020-03-10 10:51:47 +01:00
Gabor Kiss-Vamosi
5c1eaf7a3a add lv_obj_float_top_in() 2020-03-10 10:51:47 +01:00
Gabor Kiss-Vamosi
806d7dd8d5 minor foxes 2020-03-10 10:47:14 +01:00
Gabor Kiss-Vamosi
dc4e643f62 style refresh optimizations 2020-03-10 10:41:48 +01:00
Gabor Kiss-Vamosi
498f050262 fix warnings 2020-03-10 08:34:07 +01:00
Gabor Kiss-Vamosi
48a4cc3fc6 renames an fixes 2020-03-09 15:19:23 +01:00
Gabor Kiss-Vamosi
5ad4ede4d2 transition fixes with time = 0 2020-03-09 15:19:16 +01:00
Gabor Kiss-Vamosi
7bfc82317a led: add LV_LED_BRIGHT_MIN/MAX global configs and limit brightness between them 2020-03-09 15:18:19 +01:00
Gabor Kiss-Vamosi
1f2c772e06 do not redraw anything if the active screen was deleted. Closes #1387 2020-03-08 04:06:34 +01:00
Gabor Kiss-Vamosi
f2d67bd4e9 roller: fix lv_roller_set_selected in INFINITE moed. Fixes #1404 2020-03-08 03:54:40 +01:00
Gabor Kiss-Vamosi
25b8185683 minor renames 2020-03-08 03:36:18 +01:00
Gabor Kiss-Vamosi
8880326abd img_decoder: return on out of memory error 2020-03-08 03:36:03 +01:00
embeddedt
6348fe079d Update URL of ESP32 port
Requested by @C47D
2020-03-07 16:00:20 -05:00
Gabor Kiss-Vamosi
ad44495146 remove accidentally enabled LV_BUILD_TEST 2020-03-07 10:25:42 +01:00
embeddedt
48cbc84e5c lv_img_decoder: fix incorrect debug assert (#1402) 2020-03-06 10:22:33 -05:00
Gabor Kiss-Vamosi
c33d875015 minor renames and fixes 2020-03-06 13:14:39 +01:00
Gabor Kiss-Vamosi
5578b0b496 refine imgbtn API to work smoother with tiled mode 2020-03-06 13:14:39 +01:00
Themba Dube
da4115e652 Do not build tests by default 2020-03-05 20:05:18 -05:00
embeddedt
ffdf2ed542 Fix #1401: wrong roller opt selected with pointer-based input 2020-03-05 10:06:48 -05:00
Gabor Kiss-Vamosi
3dc8b9ab0d make style API C++ compatible 2020-03-05 15:39:11 +01:00
embeddedt
c513977559 Fix #1400: divide-by-zero error in lv_mem_monitor 2020-03-04 18:10:45 -05:00
Gabor Kiss-Vamosi
d79fb70aaa linemeter: increase the precision of sine/cos interpolation
it needs the same time to caclulate then a lower resolution
2020-03-04 16:44:20 +01:00
Gabor Kiss-Vamosi
4e10efd642 minor fixes and renames 2020-03-04 16:29:21 +01:00
Gabor Kiss-Vamosi
4afd47e5ab further improve linemeters line precision by interpolating sine and cos values 2020-03-04 14:43:08 +01:00
Gabor Kiss-Vamosi
f9bcde4e6f use a fix value LV_RADIUS_CIRCLE
It messed up roundind when lv_coord_t is int32_t
2020-03-04 12:15:26 +01:00
Gabor Kiss-Vamosi
e1b188f705 fix overflow and reduce lines direction error 2020-03-04 12:09:43 +01:00
Gabor Kiss-Vamosi
f9fa0add86 lv_draw_line: fix crash with masks 2020-03-04 12:09:43 +01:00
Gabor Kiss-Vamosi
1b3d1fcb8e Merge pull request #1398 from xennex22/dev-7.0
Make dropdown options dynamic
2020-03-04 11:31:32 +01:00
Gabor Kiss-Vamosi
419d8912f8 draw_label: fix goining to the first visible line 2020-03-04 11:09:36 +01:00
Gabor Kiss-Vamosi
5c6a7fa6d3 btn: fix lv_btn_set_state to remove DIABLED state if other state is set 2020-03-04 11:09:10 +01:00
Gabor Kiss-Vamosi
cec2660724 imgbtn: improve to use LV_STYLE_TRANSFORM_WIDTH/HEIGHT 2020-03-04 11:08:20 +01:00
Gabor Kiss-Vamosi
59d95b697e fix lv_obj_finish_transition to apply the latest transition in the end 2020-03-04 11:07:29 +01:00
Gabor Kiss-Vamosi
a663578ebc optimize lv_obj_refresh_style 2020-03-04 11:06:47 +01:00
Gabor Kiss-Vamosi
5c1eac455f disable PERF_MONITOR by default 2020-03-04 11:03:31 +01:00
Gabor Kiss-Vamosi
1ff6fc28d3 imgbtn: allow bg drawing 2020-03-04 09:14:07 +01:00
Gabor Kiss-Vamosi
048b5cfb60 lv_conf_template updates 2020-03-04 09:14:07 +01:00
Gabor Kiss-Vamosi
2e9f1139e3 rect bg draw: fix overdrawn line in the middle with LV_RADIUS_CIRCLE 2020-03-04 09:09:28 +01:00
xennex22
f9d467e3e7 Changed lv_dropdown_add_option parameter from int to uint16_t 2020-03-03 06:37:51 -08:00
Gabor Kiss-Vamosi
2f44d9045b run formatter 2020-03-03 15:37:13 +01:00
xennex22
78260c31f2 Removed debug code 2020-03-03 06:37:01 -08:00
Gabor Kiss-Vamosi
b1f059375d Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-03-03 15:36:54 +01:00
Gabor Kiss-Vamosi
caad3c9d1b empty theme: set LV_OPA_COVER for screens by default 2020-03-03 15:35:26 +01:00
Gabor Kiss-Vamosi
4d5b9a02cf fix unititalized variable in lv_img_buf_transform_init 2020-03-03 15:34:49 +01:00
Gabor Kiss-Vamosi
e146da0532 fix transitions 2020-03-03 15:34:10 +01:00
xennex22
cc34ecfa69 Fixed options insert bugs 2020-03-02 21:01:24 -08:00
xennex22
069dd439e3 Fixed lv_dropdown_add_option bugs 2020-03-02 09:10:48 -08:00
xennex22
a0925b0b95 Fixed filename in header comment 2020-03-02 08:22:12 -08:00
xennex22
42fdf16dc3 Added dynamic options cleanup 2020-03-02 08:20:02 -08:00
xennex22
b11d077b6c Changed options to dynamic allocation 2020-03-02 08:18:58 -08:00
xennex22
a9f85a6efd Changed options to dynamic allocation 2020-03-02 08:12:42 -08:00
Gabor Kiss-Vamosi
9291c81829 fix warnings 2020-03-01 07:48:23 +01:00
Gabor Kiss-Vamosi
234f0e761b chart: fixes for faded ara under lines 2020-03-01 07:41:55 +01:00
Gabor Kiss-Vamosi
e51962e361 table: optimize style queries 2020-03-01 02:00:03 +01:00
Gabor Kiss-Vamosi
ac75bfaa54 img copy: copy parameters 2020-03-01 01:59:42 +01:00
Gabor Kiss-Vamosi
38a4c14e07 draw border: optimization when only top+bottom sides are shown 2020-03-01 01:59:06 +01:00
Gabor Kiss-Vamosi
705d7ebaef draw_boder: return on LV_DRAW_SIDE_NONE 2020-03-01 00:00:20 +01:00
Gabor Kiss-Vamosi
7f06779179 Merge pull request #1394 from Maldus512/master
Added mirror option for line meters
2020-02-29 21:23:53 +01:00
Gabor Kiss-Vamosi
acbcf109f9 lmeter: fix mirror prototypes 2020-02-29 21:22:58 +01:00
Mattia Maldini
ab4706bc09 Update src/lv_objx/lv_lmeter.h
Co-Authored-By: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-02-29 17:53:05 +01:00
Mattia Maldini
0303110dc3 Update src/lv_objx/lv_lmeter.c
Co-Authored-By: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-02-29 17:52:32 +01:00
Gabor Kiss-Vamosi
c74e40922e Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-29 13:36:25 +01:00
Gabor Kiss-Vamosi
d3bcdcb8fb add theme template and empty 2020-02-29 13:35:53 +01:00
embeddedt
107aafaf6a Merge pull request #1395 from xennex22/dev-7.0
Rename/move some defines
2020-02-28 11:46:22 -05:00
xennex22
45910077ad Minor comment change 2020-02-28 08:38:42 -08:00
xennex22
336ca64abe Changed LV_USE_LMETER to LV_USE_LINEMETER 2020-02-28 08:22:30 -08:00
xennex22
ccd27ff0fe Changed LV_USE_LMETER to LV_USE_LINEMETER 2020-02-28 08:21:24 -08:00
xennex22
611f25e1e6 Changed LV_USE_LMETER to LV_USE_LINEMETER 2020-02-28 08:20:23 -08:00
xennex22
4fe85b5516 Moved define to header 2020-02-28 08:16:11 -08:00
xennex22
45f15274e4 Moved define to header 2020-02-28 08:15:19 -08:00
Mattia Maldini
97c9971c2a Added mirror option for line meters 2020-02-28 15:36:19 +01:00
Gabor Kiss-Vamosi
ea81e21dd0 reduce CPU usage of the performance monitor 2020-02-28 13:22:44 +01:00
Gabor Kiss-Vamosi
f25633f60f Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-28 13:10:25 +01:00
Gabor Kiss-Vamosi
d55f22931f optimize skew line drawing 2020-02-28 13:09:48 +01:00
Gabor Kiss-Vamosi
fbe95a5e7e fixes for performance monitor 2020-02-27 15:48:29 +01:00
Gabor Kiss-Vamosi
760e0eefd6 Add performance monitor 2020-02-27 15:07:18 +01:00
Gabor Kiss-Vamosi
6e6aeb8f09 material theme: simplify line chart's default style 2020-02-27 06:49:29 +01:00
Gabor Kiss-Vamosi
0e934e74fd chart: fix clipped first point 2020-02-27 06:42:08 +01:00
Gabor Kiss-Vamosi
f5e61fdb38 Update lv_version.h 2020-02-26 23:50:16 +01:00
Gabor Kiss-Vamosi
6e6ec16295 release_patch.py: fix incrementing version number 2020-02-26 23:49:20 +01:00
Gabor Kiss-Vamosi
2ead495903 Release v6.1.2 2020-02-26 23:35:12 +01:00
Gabor Kiss-Vamosi
75d44d0538 add release_patch.py 2020-02-26 23:31:16 +01:00
Gabor Kiss-Vamosi
3403ec8332 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-02-26 23:04:45 +01:00
Gabor Kiss-Vamosi
1ddff88a81 make doxygen quite 2020-02-26 22:59:12 +01:00
Gabor Kiss-Vamosi
1239e415ad fix when LV_ANTIALIAS=0 2020-02-26 20:15:29 +01:00
Gabor Kiss-Vamosi
41907f9f3c run astyle code formatter 2020-02-26 19:48:27 +01:00
Gabor Kiss-Vamosi
9d1a1d51d0 replace clag format with astyle 2020-02-26 19:46:58 +01:00
Gabor Kiss-Vamosi
13b1ec2e62 remove lv_conf_checker.h 2020-02-26 19:38:35 +01:00
Gabor Kiss-Vamosi
d7c59c3158 Merge branch 'master' into dev-7.0 2020-02-25 15:33:58 +01:00
Gabor Kiss-Vamosi
8e4297ad73 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-25 15:32:51 +01:00
Gabor Kiss-Vamosi
16ed5c605a run cppcheck and fix issues 2020-02-25 15:32:35 +01:00
Gabor Kiss-Vamosi
7464778b8b fix warning 2020-02-25 10:49:34 +01:00
Gabor Kiss-Vamosi
58c6bee99a Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-25 10:48:00 +01:00
Gabor Kiss-Vamosi
65f14a33af rename lv_spinner_spinner_anim to lv_spinner_anim_cb 2020-02-25 10:47:49 +01:00
Gabor Kiss-Vamosi
cb4fee4197 add lv_obj_finish_transitions 2020-02-25 10:47:30 +01:00
Gabor Kiss-Vamosi
10ae15e030 remove const from transitpon_path set/get functions 2020-02-25 10:16:31 +01:00
Gabor Kiss-Vamosi
8e45fd5fde update clag-formatter.sh 2020-02-25 09:30:00 +01:00
Gabor Kiss-Vamosi
b91d42b6d5 fix warnings 2020-02-25 09:18:00 +01:00
Gabor Kiss-Vamosi
0543b4d77f textarea: make the placeholder a simple text instead of a label 2020-02-25 09:15:56 +01:00
Gabor Kiss-Vamosi
c498b32c18 minor fixes 2020-02-25 09:15:28 +01:00
Gabor Kiss-Vamosi
c76ff89af3 add va_list support to LV_LOG functions 2020-02-25 08:38:56 +01:00
Gabor Kiss-Vamosi
3414433fd8 Merge pull request #1392 from Maldus512/master
Added overflow check while calculating label height
2020-02-24 15:53:53 +01:00
Gabor Kiss-Vamosi
963140fd74 rename lv_obj_set/get_style_... to lv_obj_set/get_style_local_... 2020-02-24 12:33:03 +01:00
Mattia Maldini
68b93ea002 Added overflow check while calculating label height 2020-02-23 17:10:20 +01:00
Gabor Kiss-Vamosi
5886736522 renames in styles: TRANS->TRANSITION, WIDTH/HEIGHT->TRANSFORM_WIDTH/HEIGHT 2020-02-23 07:51:33 +01:00
Gabor Kiss-Vamosi
a2cb85608a fix warning 2020-02-23 07:26:43 +01:00
Gabor Kiss-Vamosi
52451636c3 elminate dead code on some returns. Fixes #1391 2020-02-23 07:23:44 +01:00
Gabor Kiss-Vamosi
66a25f158c minor fixes 2020-02-23 07:16:40 +01:00
Gabor Kiss-Vamosi
f4f3cc2542 fix warnings 2020-02-22 07:06:31 +01:00
Gabor Kiss-Vamosi
db7e5ae2f4 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-22 01:09:51 +01:00
Gabor Kiss-Vamosi
482a53e16e rename LV_STATE_NORMAL to LV_STATE_DEFAULT 2020-02-22 01:09:29 +01:00
Gabor Kiss-Vamosi
02c6aed382 add LV_STYLE_WIDTH/HEIGHT + theme update 2020-02-22 01:05:13 +01:00
Gabor Kiss-Vamosi
a9d3dce55b obj: remove state_dsc, from now a simple state is enough 2020-02-21 16:56:10 +01:00
Gabor Kiss-Vamosi
78923b6b9b support transition on virtual styles too 2020-02-21 16:33:42 +01:00
Gabor Kiss-Vamosi
05b8db0192 new transitions for the main style is working 2020-02-21 15:33:57 +01:00
Gabor Kiss-Vamosi
7756d0cc88 start to improve style transitions 2020-02-21 10:50:50 +01:00
Gabor Kiss-Vamosi
7f14726ba3 theme updates 2020-02-21 06:04:46 +01:00
embeddedt
1122e301ea Fix extra return statement in lv_bar_get_value 2020-02-20 16:45:59 -05:00
Gabor Kiss-Vamosi
8dcfc535b3 start to make material theme more general 2020-02-20 16:01:49 +01:00
Gabor Kiss-Vamosi
759c4ccb35 use 0.1 degree resolution for image rotation in lv_img and lv_canvas 2020-02-20 14:31:17 +01:00
Gabor Kiss-Vamosi
9d7e9f8cb3 fix warnings 2020-02-20 12:27:33 +01:00
Gabor Kiss-Vamosi
0dc1f38d80 imgbtn: compiler error fixes 2020-02-20 12:15:07 +01:00
Gabor Kiss-Vamosi
ecbf97178d add lv_obj_fade_in/out 2020-02-20 12:14:53 +01:00
Gabor Kiss-Vamosi
63ae4a6570 add lv_anim_get_delay() 2020-02-20 12:14:17 +01:00
Gabor Kiss-Vamosi
d979cb7f21 spinbox: add support to 'cursor position with click' 2020-02-20 05:08:03 +01:00
Gabor Kiss-Vamosi
94af20a451 spinbox: add inc/dec event callbacks to be used with +/- buttons created for the spinbox 2020-02-19 12:47:28 +01:00
Gabor Kiss-Vamosi
2091ee3261 roller: fix build errror with disabled animations 2020-02-19 12:46:31 +01:00
Gabor Kiss-Vamosi
49d86040f9 improve roller's theme 2020-02-19 11:52:32 +01:00
Gabor Kiss-Vamosi
e653aacad9 roller: minor fixes 2020-02-19 11:52:15 +01:00
Gabor Kiss-Vamosi
7b6ef62573 upade layout's comments 2020-02-19 06:58:42 +01:00
Gabor Kiss-Vamosi
ac0e477c70 roller: fix broken animtion 2020-02-19 06:39:55 +01:00
Gabor Kiss-Vamosi
748c84c88c add LV_LAYOUT_PRETTY_TOP/MID/BOTTOM instead of LV_LAYOUT_PRETTY 2020-02-19 06:34:35 +01:00
Gabor Kiss-Vamosi
0310f2d789 change anim API and add repeat count 2020-02-19 06:18:24 +01:00
Anton Svitenkov
320ee83dac Fix initialization of disp->last_activity_time (#1388)
if we use custom memory allocation, 'last_activity_time' must be initialized with zero value

Co-authored-by: ftrtyfytfjh <email@email.com>
2020-02-18 07:44:20 -05:00
Gabor Kiss-Vamosi
7fa082b7b5 merge master 2020-02-18 12:29:01 +01:00
Themba Dube
7a022772fc Merge branch 'fix_warnings' into dev-7.0 2020-02-17 19:17:12 -05:00
Themba Dube
914383eea3 Move all uses of _LV_OBJ_STYLE_SET_GET_DECLARE to lv_obj_style_dec.h 2020-02-17 19:14:53 -05:00
Gabor Kiss-Vamosi
f3cad63565 fix include in built-in font 2020-02-17 16:07:00 +01:00
Gabor Kiss-Vamosi
9b01f37fc7 textarea: use 'bullet' instead of '*' in pwd mode if available 2020-02-17 16:04:16 +01:00
Gabor Kiss-Vamosi
87b192c61d draw: add blend_mode fields to draw dscs to avoid a lot #if #endif if LV_USE_BLEND_MODES = 0 2020-02-17 16:03:49 +01:00
Gabor Kiss-Vamosi
dde1547be1 add LV_USE_BLEND_MODES and LV_USE_OPA_SCALE
it saves some style property queries by skipping some rarely used proeprties
2020-02-17 15:41:24 +01:00
Gabor Kiss-Vamosi
173206037d style transition fixes 2020-02-17 14:36:32 +01:00
Gabor Kiss-Vamosi
def245f939 Merge pull request #1385 from DeonMarais64/patch-1
Fix warning
2020-02-17 09:37:37 +01:00
Gabor Kiss-Vamosi
d1e3aa254d add ext. click are to the slider 2020-02-17 06:59:01 +01:00
Gabor Kiss-Vamosi
a0827e74e2 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-02-17 06:45:09 +01:00
Gabor Kiss-Vamosi
0a06c70c27 disable LV_TXT_LINE_BREAK_LONG_LEN by default 2020-02-17 06:44:56 +01:00
Gabor Kiss-Vamosi
943e6cd4d4 Merge pull request #1386 from ShenRen/dev-7.0
add a object`s user data free interface (redo)
2020-02-17 06:03:47 +01:00
RenShen
5199bda6f6 add a object`s user data free interface 2020-02-16 22:24:26 +08:00
Deon Marais
58483fc1aa Fix warning
Warning: transfer of control bypasses initialization lv_tabview.c 926
2020-02-16 06:29:48 +02:00
Themba Dube
8b61bfc70a lv_roller_signal: initialize res variable 2020-02-15 15:22:24 -05:00
Themba Dube
2d8254a91d lv_btnmatrix: don't crash when pointer events aren't on a button 2020-02-15 15:13:57 -05:00
Themba Dube
63ad3df793 Fix some warnings 2020-02-15 14:18:47 -05:00
Themba Dube
7722a2b49d Remove unneeded call to lv_obj_set_pos 2020-02-15 13:34:17 -05:00
Themba Dube
4a4e6b59b1 Fix two -Wuninitialized warnings 2020-02-15 13:31:47 -05:00
Gabor Kiss-Vamosi
332124f1f4 fix theme include 2020-02-15 11:57:10 +01:00
Gabor Kiss-Vamosi
75233b6499 style opa default value fixes 2020-02-15 11:29:54 +01:00
Gabor Kiss-Vamosi
16df7844e2 theme msgbox updates 2020-02-15 08:47:12 +01:00
Gabor Kiss-Vamosi
6c1a96ce2d make style transitions smoother 2020-02-15 02:56:24 +01:00
Gabor Kiss-Vamosi
b6388bc5ac clean up the widgets style lists on delete 2020-02-15 02:30:20 +01:00
Gabor Kiss-Vamosi
761295b99d fixes in various configurations 2020-02-15 02:19:44 +01:00
Gabor Kiss-Vamosi
b8676b26b2 renames and fixes 2020-02-15 00:33:26 +01:00
Gabor Kiss-Vamosi
8a1a5e524f rename lv_objx/ to lv_widgets/ 2020-02-14 22:04:33 +01:00
Gabor Kiss-Vamosi
c9855c3028 merge dev-7.0 2020-02-14 18:26:31 +01:00
Gabor Kiss-Vamosi
a265b8d5c6 merge master 2020-02-14 18:22:51 +01:00
Gabor Kiss-Vamosi
c00750d19f lv_tileview: fix scroll animation 2020-02-14 18:19:24 +01:00
Gabor Kiss-Vamosi
c2fb6c9af2 minor renames and fixes 2020-02-14 17:03:25 +01:00
embeddedt
36a4307930 Send proper tile ID in tileview VALUE_CHANGED event 2020-02-14 10:06:44 -05:00
Gabor Kiss-Vamosi
61d4993cee fit, layout and state renames 2020-02-14 13:38:48 +01:00
Gabor Kiss-Vamosi
220d98ffaa remove teh old themes 2020-02-14 12:56:16 +01:00
Gabor Kiss-Vamosi
74d3c8b034 minor theme fixes 2020-02-14 12:55:33 +01:00
Gabor Kiss-Vamosi
3221e56e18 fixes after rename 2020-02-14 12:44:15 +01:00
Gabor Kiss-Vamosi
53f774a61e rename files too 2020-02-14 12:40:09 +01:00
Gabor Kiss-Vamosi
bd9299c89e rename ta, cb, sw, ddlist, mbox, kb, btnm, lmeter, preload 2020-02-14 12:36:49 +01:00
Gabor Kiss-Vamosi
738faeda21 minor fixes 2020-02-14 12:22:52 +01:00
Gabor Kiss-Vamosi
30910e392b remove a patch file 2020-02-14 10:22:02 +01:00
Gabor Kiss-Vamosi
ed3f0e478c further image invalidataion improvments 2020-02-14 10:21:38 +01:00
Gabor Kiss-Vamosi
9d664b27ec image invalidation fixes 2020-02-14 09:44:39 +01:00
Gabor Kiss-Vamosi
f83ecfb16f image invalidation fixes 2020-02-14 08:10:25 +01:00
Gabor Kiss-Vamosi
2d0fd69910 fixes for mbox and roller 2020-02-13 14:39:15 +01:00
Gabor Kiss-Vamosi
8920865b7e unify LV_STYLE_STATE_.. and LV_OBJ_STATE_... to LV_STATE_... 2020-02-13 14:26:58 +01:00
Gabor Kiss-Vamosi
55124afe66 minor fixes 2020-02-13 13:56:08 +01:00
Gabor Kiss-Vamosi
4cfeb9e985 minor fixes 2020-02-13 06:56:14 +01:00
Gabor Kiss-Vamosi
40e2da1905 update port templates 2020-02-13 06:55:36 +01:00
Gabor Kiss-Vamosi
1b690e6238 renames and minor fixes 2020-02-12 08:54:03 +01:00
embeddedt
b9697df3a1 Warn if lv_obj_set_pos is called on a screen object 2020-02-11 08:42:04 -05:00
Gabor Kiss-Vamosi
1c0d445e7f integrate win 2020-02-11 09:40:40 +01:00
Gabor Kiss-Vamosi
e0fa621e75 add lv_obj_get_draw_rect_ext_pad_size to unify getting ext draw pad 2020-02-11 06:41:41 +01:00
Gabor Kiss-Vamosi
418e84abbd label: bg padding make the label smaller
(no extra virtual size)
2020-02-11 06:41:41 +01:00
Gabor Kiss-Vamosi
2f17d43c13 add STYLE_OUTlINE 2020-02-11 06:41:41 +01:00
Gabor Kiss-Vamosi
fe3e767717 integrate cpicker 2020-02-11 06:41:03 +01:00
Gabor Kiss-Vamosi
ffd8fbec01 improve border drawing 2020-02-10 01:32:25 +01:00
Gabor Kiss-Vamosi
6d0dd49aff arc draw fixes 2020-02-10 01:08:49 +01:00
Gabor Kiss-Vamosi
6996f41ea7 Revert "imporve arc drawing"
This reverts commit 35774188a0.
2020-02-10 01:07:06 +01:00
Gabor Kiss-Vamosi
35774188a0 imporve arc drawing 2020-02-10 00:38:16 +01:00
Gabor Kiss-Vamosi
0381cc60c5 add PATTERN_REPEAT again
It's good complementer of VALUE. PATTERN can be an image on a button and VALUE can be any extra text
2020-02-10 00:30:17 +01:00
Gabor Kiss-Vamosi
0dd6de58b4 chart draw fix 2020-02-10 00:21:19 +01:00
Gabor Kiss-Vamosi
5fe82bd4b8 drawing speed up 2020-02-09 23:08:25 +01:00
Gabor Kiss-Vamosi
48e6f092e3 Merge branch 'feat-new-style' of https://github.com/littlevgl/lvgl into feat-new-style 2020-02-09 21:40:02 +01:00
Gabor Kiss-Vamosi
bd1b521a6d table reduce style querries 2020-02-09 21:34:19 +01:00
Gabor Kiss-Vamosi
4d8d45eecd page scrollbar draw fix 2020-02-09 21:26:09 +01:00
Gabor Kiss-Vamosi
6e771ecd5e ddlist: trucate size of would be dropped out of the screen 2020-02-09 11:23:22 +01:00
Gabor Kiss-Vamosi
32d8398089 draw border fix 2020-02-09 11:16:35 +01:00
Gabor Kiss-Vamosi
b1c89c3a93 draw birder fix 2020-02-09 10:59:45 +01:00
Gabor Kiss-Vamosi
eb43ac7b51 add #if guard to tests 2020-02-09 10:59:38 +01:00
Gabor Kiss-Vamosi
114994fa8c various draw speed improvments 2020-02-09 10:48:34 +01:00
xennex22
43a06b41be Fix a few compiler warnings (#1371) 2020-02-07 16:28:14 -05:00
Gabor Kiss-Vamosi
2cd3a5ac09 Merge pull request #1370 from littlevgl/embeddedt-patch-1
Ensure lv_ta_set_one_line doesn't change text alignment
2020-02-07 15:44:36 +01:00
Gabor Kiss-Vamosi
624a37c529 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-02-07 14:04:05 +01:00
Gabor Kiss-Vamosi
bc7efef537 make base_line signed 2020-02-07 14:03:51 +01:00
Gabor Kiss-Vamosi
369376892e add LV_STYLE_VALUE_... properties 2020-02-07 01:44:22 +01:00
Gabor Kiss-Vamosi
d524a88116 Remove style animations. It's more flexible to make it users task via local styles 2020-02-06 23:01:47 +01:00
Gabor Kiss-Vamosi
a31369678d merge dev-7.0 2020-02-06 01:08:42 +01:00
Gabor Kiss-Vamosi
197bc46d61 shadow draw fix when he left corners are partially clipped 2020-02-06 00:58:56 +01:00
Gabor Kiss-Vamosi
0598428d0d minor draw_blend optimizations 2020-02-05 23:19:32 +01:00
Gabor Kiss-Vamosi
e235c4d5ce arc draw: make full arcs special case 2020-02-05 23:19:18 +01:00
Gabor Kiss-Vamosi
9a8ce0d0e2 arc draw: make full arcs special case 2020-02-05 23:12:24 +01:00
embeddedt
79a65213d6 lv_ta_set_one_line: retrieve text alignment correctly
`lv_label_get_align` should be used, not `lv_ta_get_text_align`.
2020-02-05 10:01:44 -05:00
Gabor Kiss-Vamosi
f56013eb31 merge dev-7.0 2020-02-05 15:45:48 +01:00
Gabor Kiss-Vamosi
b3cce8a069 minor arc invalidation fix 2020-02-05 15:44:19 +01:00
Gabor Kiss-Vamosi
4ad256f00e minor fixes 2020-02-05 15:41:25 +01:00
Gabor Kiss-Vamosi
8b5837cc44 merge dev-7.0 2020-02-05 15:35:53 +01:00
Gabor Kiss-Vamosi
9535c8976a arc invalidation fixes 2020-02-05 15:32:14 +01:00
Gabor Kiss-Vamosi
167e4d8e25 merge dev-7.0 2020-02-05 15:12:45 +01:00
Gabor Kiss-Vamosi
156d518ba6 revert modified styles 2020-02-05 15:00:03 +01:00
Gabor Kiss-Vamosi
5b85469632 further improve arc invalidation 2020-02-05 14:49:02 +01:00
Gabor Kiss-Vamosi
d4f34cb257 Merge branch 'arc_inv' into dev-7.0 2020-02-05 14:10:07 +01:00
Gabor Kiss-Vamosi
d8e921556a fix minor issue in arc drawo 2020-02-05 13:59:38 +01:00
Gabor Kiss-Vamosi
883551d50a fix warning 2020-02-05 13:58:11 +01:00
Gabor Kiss-Vamosi
f5d20f5e30 improve arc invalidation 2020-02-05 12:52:18 +01:00
Gabor Kiss-Vamosi
11b2f53c06 Merge branch 'dev-7.0' into arc_inv 2020-02-05 10:45:28 +01:00
Gabor Kiss-Vamosi
62e42d13d8 merge master 2020-02-05 10:45:10 +01:00
Gabor Kiss-Vamosi
c43704756f improve arc invalidation 2020-02-05 10:40:50 +01:00
Gabor Kiss-Vamosi
68e77be7f5 arc draw fix 2020-02-05 10:32:58 +01:00
Gabor Kiss-Vamosi
47f9e42f9a merge dev-7.0 2020-02-05 03:55:03 +01:00
Gabor Kiss-Vamosi
cf8ace602c improve arc drawing 2020-02-05 03:46:44 +01:00
Gabor Kiss-Vamosi
4c5f713914 arc draw: improve speed 2020-02-05 03:29:16 +01:00
Gabor Kiss-Vamosi
2c7579e947 shadow fix 2020-02-04 19:35:00 +01:00
embeddedt
f960c75e3f Ensure lv_ta_set_one_line doesn't change text alignment 2020-02-04 08:16:41 -05:00
Gabor Kiss-Vamosi
84ed542b34 Merge pull request #1365 from DeonMarais64/master
Incorrect assert,  Compiler warning fix
2020-02-04 10:20:11 +01:00
Gabor Kiss-Vamosi
720322ca9e relace lv_coord_t with int32_t in some performance ciritcal functions 2020-02-04 02:09:15 +01:00
Gabor Kiss-Vamosi
eef239fe70 add LV_STYLE_SCALE_BORDER 2020-02-03 20:49:34 +01:00
Gabor Kiss-Vamosi
cd48d7e473 integrate tileview and preloader + minor improvments 2020-02-03 16:18:53 +01:00
Gabor Kiss-Vamosi
59e70fc6cb apply click focus on press indetad of release 2020-02-02 16:08:43 +01:00
Gabor Kiss-Vamosi
9a5096308b finish lv_obj_style_set/get API simplification 2020-02-02 15:58:08 +01:00
Gabor Kiss-Vamosi
61ec04dd4d start to simplfy lv_obj_style_set/get API 2020-02-02 14:09:19 +01:00
Gabor Kiss-Vamosi
64d281582d img: add drawing background 2020-02-02 10:39:46 +01:00
Gabor Kiss-Vamosi
a59f0edc0a improve style transitions 2020-02-01 20:37:13 +01:00
Gabor Kiss-Vamosi
24ff098588 calendar, list, arc and line improvments 2020-02-01 15:02:52 +01:00
Gabor Kiss-Vamosi
5c3746ee72 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-01-31 06:48:54 +01:00
Gabor Kiss-Vamosi
2839f43e24 add lv_obj_invalidate to some canvas functions 2020-01-31 06:48:41 +01:00
Gabor Kiss-Vamosi
27d23dbeea improve calendar 2020-01-31 06:45:33 +01:00
Deon Marais
4bf228ca2c Remove incorrect assert 2020-01-30 15:17:02 +02:00
Deon Marais
603786f969 Update lv_label.c 2020-01-30 15:15:36 +02:00
Deon Marais
0065992fcd Update lv_symbol_def.h 2020-01-30 15:06:43 +02:00
Deon Marais
e60439a9e7 Update lv_symbol_def.h 2020-01-30 15:02:46 +02:00
Deon Marais
6fbc9f3400 Update lv_color.h 2020-01-30 15:00:42 +02:00
Deon Marais
708d68eac1 Update lv_label.c 2020-01-30 14:58:14 +02:00
Gabor Kiss-Vamosi
cde12976ac label: fix writing out of bounds in LV_LABEL_LONG_FOT mode #1364 2020-01-30 06:39:20 +01:00
Gabor Kiss-Vamosi
0c093da924 win: fix if created as screen 2020-01-30 06:13:15 +01:00
Gabor Kiss-Vamosi
eb44a75bf6 ta, tabview, tileview, win: fix creating as screen. Closes #1363 2020-01-30 05:48:49 +01:00
Gabor Kiss-Vamosi
dde953f0e2 fix warning 2020-01-30 05:41:24 +01:00
Gabor Kiss-Vamosi
6b4ec1ee2e ta: fix disabling cursor blink. Closes #1361 2020-01-30 05:39:38 +01:00
Deon Marais
1765dde018 Fix compiler warning in lv_color_to16 2020-01-29 17:47:20 +02:00
Deon Marais
eb67692baa Removed incorrect assert
Removed incorrect assert in lv_label_set_static_text
2020-01-29 17:43:36 +02:00
Gabor Kiss-Vamosi
286491b847 improve states and focus handling 2020-01-28 22:15:45 +01:00
Gabor Kiss-Vamosi
e7af52be14 btnm: improve handle focus handling 2020-01-28 15:24:18 +01:00
Gabor Kiss-Vamosi
59ee86faa6 improve click focus 2020-01-28 15:24:02 +01:00
Gabor Kiss-Vamosi
f2c53da294 fix warning in lv_draw_blend.c 2020-01-27 13:29:12 +01:00
Gabor Kiss-Vamosi
f2c7210232 add LV_SIGNAL/EVENT_LEAVE + state and indev improvments 2020-01-24 14:55:56 +01:00
Gabor Kiss-Vamosi
c899edd283 add group handling to the new ddlist 2020-01-24 06:03:43 +01:00
Gabor Kiss-Vamosi
eef94325a0 rework ddlist 2020-01-23 17:16:11 +01:00
Gabor Kiss-Vamosi
d108b2e793 further reduce the memory usage of shadow drawing 2020-01-22 12:38:11 +01:00
Gabor Kiss-Vamosi
18378e0a08 reduce shadow memory usage by ~30% 2020-01-22 00:05:49 +01:00
Gabor Kiss-Vamosi
96e2f87952 fix mem leak in bidi 2020-01-21 22:32:25 +01:00
Gabor Kiss-Vamosi
ff46220426 detach roller from ddlist 2020-01-21 22:09:50 +01:00
Gabor Kiss-Vamosi
da095828dc reenablea groups + remove overlay style properties 2020-01-21 15:56:03 +01:00
Gabor Kiss-Vamosi
10b9c9b2f5 fix crash on page delete 2020-01-21 07:00:57 +01:00
Gabor Kiss-Vamosi
3ec7ca2b37 theme updates 2020-01-21 06:26:37 +01:00
Gabor Kiss-Vamosi
2dedea5600 apply theme to some objects 2020-01-20 16:11:38 +01:00
Gabor Kiss-Vamosi
a53fca8c7f fix buffer out of bound error in lv_bidi_get_visual/logicl_pos(). Fixes #1351 2020-01-20 14:51:37 +01:00
Gabor Kiss-Vamosi
9b283981e8 add lv_obj_invalidate_area to replace lv_inv_area in objects. Fixes #1360 2020-01-20 14:47:05 +01:00
Gabor Kiss-Vamosi
ed35420475 start to implement the new theme 2020-01-18 23:34:34 +01:00
Frank
c8027aa70f draw_blend: fix disp declaration for LV_COLOR_SCREEN_TRANSP (#1359) 2020-01-18 08:09:53 -05:00
Gabor Kiss-Vamosi
70a2286f0f Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-01-18 12:16:45 +01:00
Gabor Kiss-Vamosi
33f5448a38 fix overflow on 16 bit MCU in font processing 2020-01-17 15:49:36 +01:00
Gabor Kiss-Vamosi
4d42a06abe merge dev-7.0 2020-01-17 15:30:19 +01:00
Gabor Kiss-Vamosi
87d5c4d135 indev_gesture: avoid referring NULL pointer 2020-01-17 15:28:13 +01:00
Gabor Kiss-Vamosi
03b0f7fc9a Merge pull request #1357 from littlevgl/embeddedt-patch-1
Make unclickable drop down lists work
2020-01-17 15:21:06 +01:00
Gabor Kiss-Vamosi
1dda6f5222 indev: minor fix to avide potential referring of NULL pointer 2020-01-17 13:43:26 +01:00
Gabor Kiss-Vamosi
6640585827 merge dev-7.0 2020-01-17 13:36:10 +01:00
Gabor Kiss-Vamosi
8d71d87242 anim: reinitialize 'last_task_run' when the first anim is added after suspend 2020-01-17 13:30:48 +01:00
Gabor Kiss-Vamosi
6e5e1ab154 ddlist: fix ext draw pad 2020-01-17 13:23:02 +01:00
zlm
400ca85c67 Add a gesture event and fix an arc drawing bug (#1300) 2020-01-16 19:25:02 -05:00
embeddedt
c75d868c2a Make unclickable drop down lists work 2020-01-16 19:07:38 -05:00
Gabor Kiss-Vamosi
42b561fcdc add style copy + minor refactoring 2020-01-16 21:25:11 +01:00
Alexey Papkovskiy
ca84aaf6e8 fix calculation of font kerning values (#1356) 2020-01-16 12:40:25 -05:00
Gabor Kiss-Vamosi
fae87aa3a3 add style test 2020-01-16 14:27:12 +01:00
Gabor Kiss-Vamosi
805af47113 refactoring: class->style, style_dsc->style_list 2020-01-16 14:26:36 +01:00
Gabor Kiss-Vamosi
8d6a5ac776 chart faded area updates 2020-01-15 06:21:48 +01:00
Gabor Kiss-Vamosi
dabd00088b merge dev-7.0 2020-01-15 00:13:32 +01:00
Gabor Kiss-Vamosi
55ed99d851 merge master 2020-01-15 00:10:13 +01:00
Gabor Kiss-Vamosi
533b949595 add dashed line support to horizontal and vertical lines 2020-01-15 00:08:29 +01:00
Gabor Kiss-Vamosi
4f33b531b4 integrate chart 2020-01-14 22:53:27 +01:00
Gabor Kiss-Vamosi
3ba87cba48 minor fixes 2020-01-14 21:16:48 +01:00
Gabor Kiss-Vamosi
d7198aeeee fix polygon drawing 2020-01-14 10:12:36 +01:00
Gabor Kiss-Vamosi
89c0ad468e improve table borders 2020-01-14 08:36:36 +01:00
Gabor Kiss-Vamosi
c3dddda326 integrate table 2020-01-12 22:08:34 +01:00
Gabor Kiss-Vamosi
b033e9d9c5 merge dev-7.0 2020-01-12 15:38:54 +01:00
Gabor Kiss-Vamosi
5b5400fdf1 experiemnt with style transitions 2020-01-12 15:33:14 +01:00
Gabor Kiss-Vamosi
d134ec39e5 test build clean up 2020-01-12 15:17:30 +01:00
Gabor Kiss-Vamosi
fedd1b93ee fix test build 2020-01-12 15:15:30 +01:00
Gabor Kiss-Vamosi
5832f080f5 makefile fixes 2020-01-12 15:03:12 +01:00
Gabor Kiss-Vamosi
ea46f2a236 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-01-12 14:35:53 +01:00
Gabor Kiss-Vamosi
b08bf29aed update makefile for backward compatibility 2020-01-12 14:34:43 +01:00
Gabor Kiss-Vamosi
51928059d2 ta: fix max-length bug in pwd mode 2020-01-11 16:02:23 +01:00
Gabor Kiss-Vamosi
c668c1731d remove lv_label_body_draw, can be replaced by style 2020-01-10 18:16:20 +01:00
Gabor Kiss-Vamosi
2a3384fdc2 bidi: fix array oveflow 2020-01-10 18:16:07 +01:00
Gabor Kiss-Vamosi
284155aab0 make bg_opa:transp the deafult 2020-01-10 16:01:33 +01:00
Gabor Kiss-Vamosi
6344f5f204 integrate mbox 2020-01-10 14:20:10 +01:00
Gabor Kiss-Vamosi
f8f1605714 calendar: simplify styles, and supprot to draw rect. on eash state 2020-01-10 14:19:42 +01:00
Gabor Kiss-Vamosi
bd5f0206f1 integrate led+imgbtn, add BG to arc 2020-01-10 11:10:07 +01:00
Gabor Kiss-Vamosi
f38c9c8faf bar and sw anim fixes 2020-01-10 07:58:39 +01:00
Gabor Kiss-Vamosi
54e11bb835 remove TA cursor type. Use cursor style instead. 2020-01-10 06:52:57 +01:00
Themba Dube
00ba66534d Initialize adv_hittest for non-screen objects 2020-01-09 20:26:46 -05:00
Themba Dube
8f9fb4578c Properly cast struct initializers in lv_color.h 2020-01-09 19:11:40 -05:00
Themba Dube
59fd1ad5f2 Fix weird behavior with switch knobs 2020-01-09 19:11:14 -05:00
Gabor Kiss-Vamosi
bcd4e22429 copy adv_hittest in lv_obj_create 2020-01-09 18:15:54 +01:00
Gabor Kiss-Vamosi
46bf92cd93 remove old style caching 2020-01-09 16:40:22 +01:00
Gabor Kiss-Vamosi
1fcfdf1e28 allow disabling style casche 2020-01-09 15:36:12 +01:00
embeddedt
d3d8205b2f Initialize refresh task before creating display objects 2020-01-09 09:21:32 -05:00
Gabor Kiss-Vamosi
e3c85f6baf improve style caching 2020-01-09 15:10:45 +01:00
Gabor Kiss-Vamosi
5a41efd899 Merge branch 'feat-new-style' of https://github.com/littlevgl/lvgl into feat-new-style 2020-01-09 14:16:58 +01:00
Gabor Kiss-Vamosi
3f617e39d5 try new style caching 2020-01-09 14:16:32 +01:00
Gabor Kiss-Vamosi
b5ce3dd25e minor style improvements 2020-01-09 01:37:14 +01:00
Gabor Kiss-Vamosi
621ff4e0f7 style optimization 2020-01-08 23:56:51 +01:00
Gabor Kiss-Vamosi
76c792929a Merge branch 'feat-new-style' of https://github.com/littlevgl/lvgl into feat-new-style 2020-01-08 23:13:37 +01:00
Gabor Kiss-Vamosi
d8e157ed86 style optimizatin 2020-01-08 23:13:08 +01:00
Gabor Kiss-Vamosi
b175b44fed minor fixes 2020-01-08 21:52:07 +01:00
Gabor Kiss-Vamosi
1b94cf6851 reimplement style caching 2020-01-08 21:31:05 +01:00
Gabor Kiss-Vamosi
02f4dd764f style improvments + integrate arc, canvas, objmask 2020-01-07 23:43:57 +01:00
Gabor Kiss-Vamosi
2eabc1f693 Merge pull request #1309 from littlevgl/power_efficiency
Improve LittlevGL power efficiency
2020-01-07 16:08:05 +01:00
Gabor Kiss-Vamosi
42e6984a75 show the pressed days on calendar 2020-01-07 00:49:47 +01:00
Gabor Kiss-Vamosi
3c150c8e79 remove btn ink effect
It was too specific and probably can't be used directly in real life projects
2020-01-06 23:07:57 +01:00
Gabor Kiss-Vamosi
da503aca9f integrate calendar 2020-01-06 22:14:14 +01:00
Gabor Kiss-Vamosi
6cbd2114e3 rename lv_style_value to lv_style_int 2020-01-06 22:14:04 +01:00
Gabor Kiss-Vamosi
a9e3bbeddc Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2020-01-06 15:06:01 +01:00
Gabor Kiss-Vamosi
1c46d69ef6 apply lv_obj_realign on parent size change. Close #1308 2020-01-06 15:05:51 +01:00
Gabor Kiss-Vamosi
f31ba6cf6f fix memory leak in decoding indexed images 2020-01-06 11:23:48 +01:00
Themba Dube
7afd70a005 Fix -Wnarrowing warning 2020-01-05 20:33:11 -05:00
embeddedt
492c9e4178 Fix #1342 (regression from #1319) 2020-01-05 19:28:29 -05:00
Gabor Kiss-Vamosi
168820118b Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into feat-new-style 2020-01-05 20:05:17 +01:00
Gabor Kiss-Vamosi
73614e6b22 start to separate virtual and real object parts 2020-01-05 20:05:11 +01:00
Themba Dube
3c430cd784 Patch case where animation end frame is smaller than start frame 2020-01-05 12:57:15 -05:00
Gabor Kiss-Vamosi
eea40f41bb merge dev-7.0 2020-01-05 17:05:54 +01:00
Themba Dube
f583b4ffd5 Add task_list_changed flag 2020-01-05 09:27:09 -05:00
Themba Dube
7fcd4669a4 Merge branch 'dev-7.0' into power_efficiency 2020-01-05 09:13:54 -05:00
Themba Dube
32b4a7fc72 Fix regression that removed smooth animation of bar values 2020-01-05 08:57:09 -05:00
Gabor Kiss-Vamosi
6e2a707cfc minor fixes 2020-01-05 01:16:13 +01:00
Gabor Kiss-Vamosi
7d25f66060 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-01-05 00:10:17 +01:00
Gabor Kiss-Vamosi
9c599e1cc1 remove chart division lines' extra pixel at the ends 2020-01-04 22:18:30 +01:00
Gabor Kiss-Vamosi
678fbd56d3 fix LV_CHART_TYPE_POINT y misalignment 2020-01-04 22:15:59 +01:00
Gabor Kiss-Vamosi
2c8ebb873e Merge pull request #1339 from 3096/master
lv_btnm fix bug don't toggle if inactive
2020-01-04 22:05:54 +01:00
Gabor Kiss-Vamosi
12222469ea Merge pull request #1341 from littlevgl/improve-hittest
Implement advanced hit-testing for zoomed images
2020-01-04 21:35:25 +01:00
Themba Dube
08a125c860 Make lv_obj_is_point_on_coords accept a constant point 2020-01-04 08:52:52 -05:00
Themba Dube
23625441a8 Implement advanced hit-testing for zoomed images 2020-01-04 08:48:51 -05:00
Themba Dube
9432622948 Allow objects to override bounding-box hit-testing 2020-01-04 08:48:37 -05:00
Gabor Kiss-Vamosi
32770da251 integrate ta, kb 2020-01-03 11:06:11 +01:00
3096
e5e68ac679 lv_btnm: don't toggle if inactive 2020-01-02 22:01:42 -08:00
Gabor Kiss-Vamosi
14ea5ab756 integrate line 2020-01-01 22:01:19 +01:00
Gabor Kiss-Vamosi
aa5634dbcd integrate lmeter and gauge 2020-01-01 21:44:16 +01:00
Gabor Kiss-Vamosi
bd382fe262 integrate tabview 2020-01-01 18:46:22 +01:00
Gabor Kiss-Vamosi
96b0955e97 solve conflicts 2020-01-01 16:01:31 +01:00
Gabor Kiss-Vamosi
c81f909263 integrate ddlist, roller + add LV_STYLE_PATTERN 2020-01-01 15:25:16 +01:00
Gabor Kiss-Vamosi
72d5ea44d3 revert changes in lv_group.c/h 2020-01-01 07:30:04 +01:00
Themba Dube
4432a3d31f Merge remote-tracking branch 'origin/master' into dev-7.0 2019-12-31 19:23:21 -05:00
Gabor Kiss-Vamosi
ecc8e48491 integrate img and cb 2019-12-31 23:02:25 +01:00
Gabor Kiss-Vamosi
b4ee25e9cc integrate image drawing + slider, sw 2019-12-31 22:13:32 +01:00
Gabor Kiss-Vamosi
9b757d30fc theme improvments 2019-12-31 11:13:09 +01:00
Gabor Kiss-Vamosi
b0fbac3488 start the new theme system 2019-12-31 07:03:34 +01:00
Gabor Kiss-Vamosi
584e88da08 style: integrate page + fixes + refactoring 2019-12-31 06:10:50 +01:00
Gabor Kiss-Vamosi
479012eb48 lv_btnm: fix FOCUS signal 2019-12-30 15:01:15 +01:00
Gabor Kiss-Vamosi
f8f308a72e lv_event_send_func: obj can be NULL so prevents false positive assert 2019-12-30 14:30:44 +01:00
Gabor Kiss-Vamosi
40ed2b9e26 img_design: return 'not cover' is opa != COVER 2019-12-30 14:25:04 +01:00
Gabor Kiss-Vamosi
da59655d35 minor style fixes + integrate shadow drawing 2019-12-28 01:27:20 +01:00
Gabor Kiss-Vamosi
d80d03ef83 Merge pull request #1333 from amirgon/_lv_mem_buf-root-ptr
Add _lv_mem_buf as root pointer for gc
2019-12-28 00:51:34 +01:00
Gabor Kiss-Vamosi
93f6e48fd4 improve rendering time 2019-12-27 15:39:54 +01:00
Gabor Kiss-Vamosi
302f21cbd5 style fixes 2019-12-27 11:16:21 +01:00
Gabor Kiss-Vamosi
54ae93d1eb add overly style property 2019-12-27 10:21:35 +01:00
embeddedt
b9c8ee1794 Fix typo in ca576434e2 2019-12-26 18:33:24 -05:00
Amir Gonnen
0af0994da1 Add _lv_mem_buf as root pointer for gc 2019-12-26 22:12:26 +02:00
Amir Gonnen
4267acba0d Comment out prototype without definition (#1332) 2019-12-26 14:48:47 -05:00
embeddedt
d3f195e022 Remove use of lv_conf_checker.h 2019-12-26 14:48:14 -05:00
Themba Dube
d9ad45313c Support LV_CONF_INCLUDE_SIMPLE for backwards compatibility 2019-12-26 11:56:06 -05:00
Themba Dube
36ba091af2 Fix typo in lv_draw_label.c 2019-12-26 11:55:53 -05:00
Themba Dube
b2319f1412 Merge branch 'master' into dev-7.0 2019-12-26 11:16:22 -05:00
Gabor Kiss-Vamosi
26fdb159fe Delete azure-pipelines.yml 2019-12-26 15:27:39 +01:00
Gabor Kiss-Vamosi
05736f5957 Update azure-pipelines.yml for Azure Pipelines 2019-12-26 15:15:00 +01:00
Gabor Kiss-Vamosi
c400ba1bdb Update azure-pipelines.yml for Azure Pipelines 2019-12-26 15:14:38 +01:00
Gabor Kiss-Vamosi
b7c6cf94c6 Merge pull request #1324 from CrogST/patch-2
disable warning of unused param
2019-12-26 15:12:15 +01:00
Gabor Kiss-Vamosi
7cad0abb9f Update lv_port_indev_template.c 2019-12-26 15:05:21 +01:00
Gabor Kiss-Vamosi
f4c172f56a Update lv_port_indev_template.c 2019-12-26 15:05:06 +01:00
Gabor Kiss-Vamosi
e432f64644 Update azure-pipelines.yml 2019-12-26 15:01:48 +01:00
Gabor Kiss-Vamosi
2d203c8a41 Update azure-pipelines.yml for Azure Pipelines 2019-12-26 15:00:47 +01:00
CrogST
ca576434e2 disable warning of unused param
If LV_USE_BIDI undefined, than bidi_dir is not used and compiler generate warning.
2019-12-26 13:50:59 +03:00
Gabor Kiss-Vamosi
5dcee31f94 Merge branch 'dev-7.0' into feat-new-style 2019-12-26 04:18:21 +01:00
Gabor Kiss-Vamosi
921b191124 add azure-pipeline.yml 2019-12-26 03:44:06 +01:00
Gabor Kiss-Vamosi
9aa535e30d Set up CI with Azure Pipelines
[skip ci]
2019-12-26 03:42:20 +01:00
Gabor Kiss-Vamosi
0a53c05011 fix warnings 2019-12-26 03:37:28 +01:00
Gabor Kiss-Vamosi
de12286304 temprarly remove _lv_mem_buf from GC roots to fix build error 2019-12-26 03:37:13 +01:00
Gabor Kiss-Vamosi
68984828c3 add tests and lv_conf_internal.h to use LV_CONF_PATH 2019-12-26 02:49:30 +01:00
Gabor Kiss-Vamosi
9cc03b0122 add #1314 again 2019-12-26 02:12:44 +01:00
Gabor Kiss-Vamosi
f5aebd4c2c start implement style caching 2019-12-26 01:30:20 +01:00
Gabor Kiss-Vamosi
f2388b7db2 simplify lv_obj_create 2019-12-23 01:02:19 +01:00
Gabor Kiss-Vamosi
abb4eb147d Merge branch 'master' into dev-7.0 2019-12-22 23:21:25 +01:00
Gabor Kiss-Vamosi
47e29bed8e lv_mem: fix defines for 64 bit environment 2019-12-22 23:21:09 +01:00
Gabor Kiss-Vamosi
5a4e069fb8 minor fixes 2019-12-22 23:19:51 +01:00
Gabor Kiss-Vamosi
07bc58aa9c merge dev-7.0 into feat-new-style 2019-12-22 22:56:13 +01:00
Gabor Kiss-Vamosi
cd32b27bfc merge master 2019-12-22 22:52:11 +01:00
Gabor Kiss-Vamosi
095c0bff49 integrate lv_btnm, add built-in styles, move opa_scale to styles, begin style caching 2019-12-22 22:40:02 +01:00
embeddedt
7b4f461944 Implement custom, opt-in hit-testing handlers for objects (#1318) 2019-12-22 13:51:02 +00:00
Amir Gonnen
248868fef1 Add lv_deinit function (#1319) 2019-12-21 23:35:00 +00:00
Gabor Kiss-Vamosi
ef071d02a7 Merge branch 'c64-test' 2019-12-21 23:07:18 +01:00
Gabor Kiss-Vamosi
65d79a7905 img zoom fix when computing with the edge pixels 2019-12-21 22:11:42 +01:00
Gabor Kiss-Vamosi
a010412fde roller: fix misalignment if the new options has the same width as the previous 2019-12-21 21:50:41 +01:00
Gabor Kiss-Vamosi
af1453400d lv_label: bidi fixes 2019-12-21 20:48:44 +01:00
Gabor Kiss-Vamosi
638666f685 fix include in lv_api_map.h 2019-12-21 20:36:19 +01:00
Gabor Kiss-Vamosi
7175231aab tileview: call drag_end_handler only if it was dragging 2019-12-21 20:27:01 +01:00
Gabor Kiss-Vamosi
1441601e3e list layout fixes 2019-12-21 20:25:30 +01:00
Gabor Kiss-Vamosi
de1683a4ec children inherit obj state 2019-12-19 23:16:53 +01:00
Gabor Kiss-Vamosi
c2d254ff2d Merge pull request #1317 from littlevgl/dd_num_options
Add public API for retrieving option_cnt from ddlist/roller
2019-12-19 23:14:17 +01:00
Gabor Kiss-Vamosi
374657c1be new_style: integrate label 2019-12-19 22:44:18 +01:00
Themba Dube
0a3a8cc2d6 Remove leftover debugging statements 2019-12-19 16:36:29 -05:00
Themba Dube
cba91119e3 Add public API for retrieving option_cnt from ddlist/roller 2019-12-19 16:34:10 -05:00
Themba Dube
73cb9d45d7 Fix improper position calculation for bar indicator 2019-12-19 16:21:39 -05:00
Gabor Kiss-Vamosi
ec0920d933 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-12-19 14:41:03 +01:00
Gabor Kiss-Vamosi
51e827776f merge master 2019-12-19 14:38:36 +01:00
Gabor Kiss-Vamosi
5927de98d3 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-12-19 14:10:51 +01:00
Gabor Kiss-Vamosi
b01df265ee lv_sw: fix knob size calculation 2019-12-19 14:10:36 +01:00
Gabor Kiss-Vamosi
c1db465256 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-12-19 11:15:00 +01:00
Gabor Kiss-Vamosi
8e5446c68f add lv_anim_refr_now() 2019-12-19 11:14:51 +01:00
Gabor Kiss-Vamosi
446a318e6e add obj and style state 2019-12-19 11:05:04 +01:00
Themba Dube
59441ea6a2 Merge remote-tracking branch 'origin/dev-7.0' into power_efficiency 2019-12-18 20:02:58 -05:00
Gabor Kiss-Vamosi
02ca70c691 new_style: implement generic style set/get functions 2019-12-17 09:20:40 +01:00
Gabor Kiss-Vamosi
fdd4a427f3 Merge pull request #1315 from xennex22/dev-7.0
Minor fixes for compiler
2019-12-16 18:51:50 +01:00
xennex22
226e566ebd removed redundent test for NULL 2019-12-16 07:55:19 -08:00
xennex22
dd9d655b3d removed redundent line 2019-12-16 07:54:26 -08:00
xennex22
9f447e8a4e changed fn ptr return type from false to NULL 2019-12-16 07:53:18 -08:00
xennex22
63009588c0 removed unused function prototype 2019-12-16 07:51:07 -08:00
xennex22
92a0ef4be3 removed repeated line 2019-12-16 07:49:22 -08:00
xennex22
145864f872 made default kb maps const
also changed "Bksp" -> LV_SYMBOL_BACKSPACE
2019-12-16 07:48:40 -08:00
xennex22
f8c67bcc12 made lv_slider_draw_knob params const 2019-12-16 07:46:33 -08:00
Gabor Kiss-Vamosi
3429e58d3c Merge pull request #1314 from ElFishle/master
Fix problem: letter space is not regarded in width calculation
2019-12-16 13:41:44 +01:00
hannes
5f4f516bef Fix problem: letter space is not regarded in width calculation 2019-12-16 13:34:10 +01:00
Gabor Kiss-Vamosi
4405ab9cf7 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-12-16 06:14:55 +01:00
Gabor Kiss-Vamosi
1e4883ffc7 lv_page_creeate: fix false positive assert 2019-12-16 06:14:34 +01:00
Gabor Kiss-Vamosi
a101e9a3e5 initial version of new style system 2019-12-14 23:39:26 +01:00
Gabor Kiss-Vamosi
7567679a58 Merge pull request #1312 from patrykkrz/modification
Spinbox object - Cursor need shift to left after merge pull request #1220
2019-12-14 11:08:54 +01:00
Gabor Kiss-Vamosi
d7c74d6461 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-12-14 10:49:10 +01:00
Gabor Kiss-Vamosi
d6e4c2f50c img_cache: for a match, besides src check style too 2019-12-14 10:49:06 +01:00
Patryk Krzywdziński
30539a51ec Cursor need shift to left after merge pull request #1220 2019-12-13 15:46:55 +01:00
Gabor Kiss-Vamosi
b6b5b68d2c Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-12-11 08:57:37 +01:00
Gabor Kiss-Vamosi
f54ecc470c fix text processing with negative letter space 2019-12-11 05:33:44 +01:00
Gabor Kiss-Vamosi
6f9d66843c kb: fix deafult map 2019-12-11 05:17:30 +01:00
Themba Dube
6c64b29d26 Remove leftover debug statements 2019-12-10 20:12:24 -05:00
Themba Dube
5cbff436b4 Suspend the animation task if there are no running animations 2019-12-10 20:10:35 -05:00
Themba Dube
4cb5ab4a03 Suspend the refresh task if a refresh is not necessary 2019-12-10 20:09:40 -05:00
Themba Dube
d20c4bb26a Consider LV_TASK_PRIO_OFF when finding the delay till next run required 2019-12-10 20:09:22 -05:00
Themba Dube
3b4f648468 Make lv_task_handler() return time remaining till next task needs to be run 2019-12-10 19:47:29 -05:00
Gabor Kiss-Vamosi
cdc2cf90ce lv_color.h: fix Wconversion warnings 2019-12-10 15:06:26 +01:00
Gabor Kiss-Vamosi
efeec7d3b6 minor conversion fixes to eliminate warnings 2019-12-09 14:35:13 +01:00
Gabor Kiss-Vamosi
fc29f58754 fix _WIN64 test (has only on underscore) 2019-12-09 14:34:53 +01:00
Gabor Kiss-Vamosi
af29b39803 merge master 2019-12-09 14:28:16 +01:00
Gabor Kiss-Vamosi
338abb3862 kb: minor fixes 2019-12-09 13:47:20 +01:00
Gabor Kiss-Vamosi
503b95a514 Merge branch 'dev-7.0' into master 2019-12-09 13:32:11 +01:00
TridentTD
54220ffbf1 Refactor indev_search_obj into a public API (#1297)
* Add lv_indev_get_obj(...)  for finding the topmost object under a point.
* Replace uses of indev_search_obj() with lv_indev_search_obj()
2019-12-08 21:21:56 +00:00
Gabor Kiss-Vamosi
71be75b0ec Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-12-07 21:11:56 +01:00
Gabor Kiss-Vamosi
da2ee84fbb fix some signal function if debug asssert is enabled 2019-12-07 21:11:38 +01:00
Amir Gonnen
842283d136 bugfix: use size_t also when GC is enabled (#1304) 2019-12-06 16:10:04 -05:00
Themba Dube
d7735410c9 Silence GCC warning 2019-12-06 12:31:19 -05:00
Gabor Kiss-Vamosi
f6f5f691f7 update library.json 2019-12-06 14:41:27 +01:00
Gabor Kiss-Vamosi
840f382b64 release v6.1.1 2019-12-06 14:06:57 +01:00
Gabor Kiss-Vamosi
e8dd654ad6 remove the unimplemented lv_ll_swap 2019-12-06 14:04:06 +01:00
Gabor Kiss-Vamosi
17be0af46b tileview fix assert in signal_cb 2019-12-06 13:43:38 +01:00
Themba Dube
343c6b8c6f Fix narrowing warning in lv_color.h 2019-12-05 20:46:06 -05:00
Gabor Kiss-Vamosi
f34598d810 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-12-05 12:58:21 +01:00
Gabor Kiss-Vamosi
d35e09bfcc lmeter: fix warning 2019-12-05 12:57:59 +01:00
Gabor Kiss-Vamosi
1f2987a66b fix minor warnings 2019-12-05 06:44:11 +01:00
Themba Dube
29f93e35df Silence GCC warning 2019-12-04 21:14:24 -05:00
Gabor Kiss-Vamosi
36082419d8 Merge pull request #1298 from someone42/master
Also making \r break lines in labels
2019-12-03 19:19:47 +01:00
Chris Chua
eb614c32b3 Also making \r break lines in labels 2019-12-04 04:43:16 +11:00
Gabor Kiss-Vamosi
c23655a0d7 fix warnings 2019-12-03 18:42:56 +01:00
Gabor Kiss-Vamosi
c7374948a1 fix memory leak in obj create functions if ext alloc fails 2019-12-03 18:16:14 +01:00
Gabor Kiss-Vamosi
664a538e85 fix warning from #1292 2019-12-03 14:56:17 +01:00
Gabor Kiss-Vamosi
6e97c07588 solve warnings listed in #1292 2019-12-03 06:56:48 +01:00
Gabor Kiss-Vamosi
64df282c81 merge dev-6.1 2019-12-02 16:09:35 +01:00
Gabor Kiss-Vamosi
4037a68ccc typedef uint64_t lv_uintptr_t on 64 bit systems 2019-12-02 15:03:43 +01:00
embeddedt
7137ae4b33 Add range slider support (#1275) 2019-12-02 07:37:33 -05:00
Gabor Kiss-Vamosi
6c8b0c44be fix conversation warnings 2019-12-02 12:20:01 +01:00
Gabor Kiss-Vamosi
6e8a4eeed4 lv_tileview_set_valid_positions: minor fix 2019-12-02 09:19:51 +01:00
Gabor Kiss-Vamosi
0b12f934ec lv_font.h add update comments 2019-12-02 09:16:47 +01:00
Gabor Kiss-Vamosi
e006e084fa add lv_gauge_set_needle_img 2019-11-30 11:41:18 +01:00
Gabor Kiss-Vamosi
5b7058ccf6 Merge pull request #1290 from LanFengXiMenChuiXue/dev-7.0
1.add img center;2.modify tileview;
2019-11-30 10:49:18 +01:00
Gabor Kiss-Vamosi
001724683e tileview: use default LV_DRAG_DIR_ONE 2019-11-29 15:44:15 +01:00
Gabor Kiss-Vamosi
7fa29c573e lv_img: change rotate center naming to pivot 2019-11-29 15:36:52 +01:00
Gabor Kiss-Vamosi
7254dd9f5e Merge branch 'dev-7.0' of https://github.com/LanFengXiMenChuiXue/lvgl into LanFengXiMenChuiXue-dev-7.0 2019-11-29 15:11:42 +01:00
Gabor Kiss-Vamosi
356751c184 add lv_sw_set_knob_on/off_img to display an image on the knob 2019-11-29 15:10:10 +01:00
zhangliming
23a0538bf4 1.add img center;2.modify tileview; 2019-11-29 11:32:22 +08:00
Gabor Kiss-Vamosi
a181a1feb5 add lv_slider_set_img to display an image on the knob 2019-11-28 15:21:29 +01:00
Gabor Kiss-Vamosi
2bd600b68b arc draw rounding fixes 2019-11-28 13:08:56 +01:00
Gabor Kiss-Vamosi
9083adb936 remove unused subpx flag from lv_font_fmt_txt 2019-11-28 10:14:57 +01:00
Gabor Kiss-Vamosi
74fe37ba5b improve arc draw accuracy 2019-11-27 11:45:38 +01:00
xennex22
148478bf60 Fix two minor compile-time issues (#1289) 2019-11-26 23:09:35 -05:00
Gabor Kiss-Vamosi
ec18ea42fe spinbox fix call order in signal function 2019-11-26 14:14:11 +01:00
Gabor Kiss-Vamosi
23a040670e arc and preloader draw and design fixes 2019-11-26 13:25:33 +01:00
Gabor Kiss-Vamosi
d59419c992 change lv_arc_set_angles to lv_arc_set_start/end_angle 2019-11-26 13:25:28 +01:00
Gabor Kiss-Vamosi
da8c604d14 Merge pull request #1287 from Himel55/patch-1
fix spelling mistake
2019-11-26 12:38:06 +01:00
Himel
bf5a8bc52f fix spelling mistake 2019-11-27 00:28:26 +13:00
Gabor Kiss-Vamosi
db7a22a01e Merge pull request #1284 from joltwallet/lv_obj_missing_const
lv_obj: add missing const qualifiers in function definitions.
2019-11-26 11:38:25 +01:00
Gabor Kiss-Vamosi
a596462a49 Merge pull request #1286 from vanwinkeljan/fix_8bit_lv_color_to32
Set alpha channel on return color in lv_color_to32
2019-11-26 09:39:41 +01:00
Gabor Kiss-Vamosi
dbb3630306 Merge pull request #1285 from vanwinkeljan/fix_lv_draw_letter
Make sure that px_opa is initialized in lv_draw_letter
2019-11-26 09:38:29 +01:00
Jan Van Winkel
9ffdefd98a Set alpha channel on return color in lv_color_to32
Set alpha channel on return color in lv_color_to32 for 8-bit to 32-bit
color conversions.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-11-26 09:22:08 +01:00
Jan Van Winkel
5612b22a4e Make sure that px_opa is initialized in lv_draw_letter
Make sure that the variable px_opa in lv_draw_letter is initialized,
else a compile time warring will occur .

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-11-26 09:13:18 +01:00
Brian Pugh
64a56a2b0f lv_obj: add missing const qualifiers in function definitions. 2019-11-25 22:09:38 -08:00
Gabor Kiss-Vamosi
bd049d1ac3 Merge pull request #1283 from xennex22/dev-6.1
Removed redundent assignment
2019-11-26 07:02:30 +01:00
Gabor Kiss-Vamosi
aafa6e7ccb Merge pull request #1281 from amirgon/master
Remove redundant line
2019-11-26 07:01:45 +01:00
xennex22
c059025d42 Removed redundent assignment 2019-11-25 21:32:49 -08:00
Amir Gonnen
14c407dad3 Remote redundant line
Causes compilation error when LV_COLOR_DEPTH == 16
2019-11-25 23:16:53 +02:00
Gabor Kiss-Vamosi
8bb67c0303 release v6.1 2019-11-25 13:17:55 +01:00
Gabor Kiss-Vamosi
de48d1b558 Merge branch 'dev-6.1' 2019-11-25 13:17:35 +01:00
Gabor Kiss-Vamosi
b388c702e5 add lv_printf.h to lvgl.h 2019-11-25 13:15:12 +01:00
Gabor Kiss-Vamosi
5f2e5e4d01 add subpx and compressed fonts 2019-11-25 12:47:23 +01:00
Gabor Kiss-Vamosi
257f1ed2fe minor fixes 2019-11-25 12:24:17 +01:00
Gabor Kiss-Vamosi
4215516fb8 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-11-25 12:20:55 +01:00
Gabor Kiss-Vamosi
ed500690c3 fix memory leak with indexed + alpha images 2019-11-25 12:20:21 +01:00
Gabor Kiss-Vamosi
5f3374624e fix warnings 2019-11-25 11:11:41 +01:00
Gabor Kiss-Vamosi
d17e7c7b76 lv_txt_get_next_word: fix to hanfle recolor command with break chars too 2019-11-25 11:07:48 +01:00
Gabor Kiss-Vamosi
926dafd3b5 minor fixes 2019-11-25 07:15:01 +01:00
Gabor Kiss-Vamosi
a7bfaabfad regenerat fonts 2019-11-25 07:03:35 +01:00
Gabor Kiss-Vamosi
f0863b4179 fix minor warnings 2019-11-25 06:44:13 +01:00
Gabor Kiss-Vamosi
0422e662d9 lv_color.h use 1 common lv_color_make 2019-11-25 06:42:11 +01:00
Stepan Snigirev
12fa1ac788 Initialize variable to remove compiler warning (#1280) 2019-11-23 17:18:09 -05:00
Gabor Kiss-Vamosi
ab0cad1b52 Merge pull request #1279 from amirgon/dev-6.1
Fix `lv_mbox_create` for Micropython Binding
2019-11-23 07:36:03 +01:00
Amir Gonnen
ef2bee1e42 Merge branch 'dev-6.1' of https://github.com/amirgon/lvgl into dev-6.1 2019-11-23 01:42:58 +02:00
Amir Gonnen
9779513928 Fix lv_mbox_create for Micropython Binding
When passing array of strings, the parameter should be defined as const char *[], and not const char **
2019-11-23 01:41:27 +02:00
xennex22
1083d92bd1 Added function comments 2019-11-21 19:01:10 -08:00
xennex22
16263f400e Fixed comments shift -> mode 2019-11-21 18:52:14 -08:00
Gabor Kiss-Vamosi
90234b8cc1 minor optimizations 2019-11-21 12:45:49 +01:00
Gabor Kiss-Vamosi
9a94f88885 lv_font_fmt_txt: don't use bitfield for cmap to avoid bugs in Visual Studio 2019-11-21 12:00:23 +01:00
Gabor Kiss-Vamosi
b4b6a472fb use array[] instead of pointer in API function parameters where required 2019-11-21 06:08:09 +01:00
Gabor Kiss-Vamosi
06f553b3aa lv_img_set_offset_x/y: draw the partial image at the beginning with offset > 0 2019-11-21 05:44:43 +01:00
xennex22
e952c2a69b Merged lv_kb_shift_t into lv_kb_mode_t 2019-11-20 07:51:23 -08:00
xennex22
45d41d3361 Merged lv_kb_shift_t into lv_kb_mode_t 2019-11-20 07:44:24 -08:00
Gabor Kiss-Vamosi
b7d856515b add lv_ddlist_set/get_symbol instead of lv_ddlist_set/get_draw_arrow 2019-11-20 16:18:56 +01:00
Gabor Kiss-Vamosi
53eeee069e fix warning 2019-11-20 15:56:06 +01:00
Gabor Kiss-Vamosi
073b332919 add style.text.underline and strike_through 2019-11-20 15:55:38 +01:00
Gabor Kiss-Vamosi
9e74cdb145 Merge branch 'master' into dev-6.1 2019-11-19 13:47:38 +01:00
Gabor Kiss-Vamosi
810059e3ca lv_cb_get_style: fix with LV_CB_STYLE_BG 2019-11-19 13:47:07 +01:00
Gabor Kiss-Vamosi
cfec8e6381 use lv_mem_buf in lv_bidi 2019-11-19 06:27:21 +01:00
Gabor Kiss-Vamosi
b4dae16e22 move lv_draw_buf to lv_mem as lv_mem_buf
This way they can be used as general purpose buffers not only for drawing
2019-11-19 06:25:14 +01:00
Themba Dube
5612856bca Add ability to customize LV_TXT_COLOR_CMD 2019-11-18 09:30:14 -05:00
Gabor Kiss-Vamosi
12c722b38e merge dev-6.1 2019-11-18 10:49:38 +01:00
Gabor Kiss-Vamosi
1ee7e1961e Merge branch 'master' into dev-6.1 2019-11-18 10:48:16 +01:00
Gabor Kiss-Vamosi
04ec2d17ec lv_task: check if a task has deleted itself 2019-11-18 10:45:44 +01:00
Gabor Kiss-Vamosi
b9d693d153 remove lv_font_heb_16 2019-11-18 09:27:20 +01:00
Gabor Kiss-Vamosi
e47a433204 cpicker: ignore the clicks in the middle with no preview 2019-11-18 07:03:41 +01:00
Gabor Kiss-Vamosi
fcbd9fa4ea indev: do not send wait_releaseLV_SIGNAL/EVENT_PRESSED 2019-11-18 07:03:03 +01:00
xennex22
58eb4edb33 Update lv_ta.c 2019-11-17 10:43:17 -08:00
Gabor Kiss-Vamosi
22973360d0 add support to > 255 fonts by enabling LV_FONT_FMT_TXT_LARGE 2019-11-17 17:12:50 +01:00
Themba Dube
c607e45b48 lv_draw: document assertion so others understand quickly 2019-11-17 08:59:22 -05:00
Gabor Kiss-Vamosi
d7232be181 minor fixes 2019-11-17 06:23:26 +01:00
xennex22
7256c7244d Update lv_kb.c 2019-11-16 13:09:59 -08:00
xennex22
2d52d2f126 Update lv_kb.h 2019-11-16 13:06:30 -08:00
xennex22
24a5e3788d Update lv_kb.c 2019-11-16 08:46:12 -08:00
Gabor Kiss-Vamosi
679419b151 minor theme updates 2019-11-16 12:29:47 +01:00
Gabor Kiss-Vamosi
20a13918d1 bar: improve masking to avoid drawing the indicator out of the radius 2019-11-16 12:29:37 +01:00
Gabor Kiss-Vamosi
cd2c8ae8c1 minor shadow draw fix not LV_DRAW_BLEND_MODE_NORMAL 2019-11-16 12:28:54 +01:00
Gabor Kiss-Vamosi
d5cfd02def mono theme fix uninited styles 2019-11-16 11:36:06 +01:00
Gabor Kiss-Vamosi
537f1256c8 Merge branch 'dev-6.1' into dev-7.0 2019-11-16 11:27:51 +01:00
Gabor Kiss-Vamosi
59743f7f90 linemeter: angle offset fixes
rename lv_lmeter_set_angle to lv_lmeter_set_angle_offset
add lv_lemeter_get_angle_offset
initialze ext->angle_ofs in lv_lmeter_create
2019-11-16 11:27:35 +01:00
Gabor Kiss-Vamosi
5001c4e6a9 theme and minor drawin fixes 2019-11-16 11:22:23 +01:00
Gabor Kiss-Vamosi
197d95cf60 ta: fix label height after style change in one line mode 2019-11-15 15:23:47 +01:00
embeddedt
3452e60ec1 Silence -Wconversion 2019-11-15 08:03:11 -05:00
Gabor Kiss-Vamosi
37cd768e99 Merge branch 'dev-6.1' into dev-7.0 2019-11-15 11:14:30 +01:00
Gabor Kiss-Vamosi
48f81d9f28 lv_objx_templ: fix typo 2019-11-15 11:14:07 +01:00
Gabor Kiss-Vamosi
a2cc8c9b4c lv_objmask_remove_mask: remove all masks is mask==NULL 2019-11-15 11:05:11 +01:00
Gabor Kiss-Vamosi
2be039e917 rename lv_ll_rem to lv_ll_remove 2019-11-15 11:04:46 +01:00
Gabor Kiss-Vamosi
b54b5fcc2b lv_bidi: fix warnings 2019-11-15 09:30:57 +01:00
Gabor Kiss-Vamosi
0130856ef9 fix compiler error with LV_USE_FILESYSTEM = 0 2019-11-15 09:27:43 +01:00
Gabor Kiss-Vamosi
ca5940b693 lv_cpicker_set_color fix compiler error 2019-11-15 09:26:10 +01:00
Gabor Kiss-Vamosi
010d7ef72f merge dev-6.1 2019-11-15 09:20:49 +01:00
Gabor Kiss-Vamosi
ac28a13564 fix warnings 2019-11-15 09:17:42 +01:00
Gabor Kiss-Vamosi
6aeba2d682 Merge branch 'dev-6.1' into dev-7.0 2019-11-15 07:29:24 +01:00
Gabor Kiss-Vamosi
28cc431d95 Merge branch 'master' into dev-6.1 2019-11-15 07:29:00 +01:00
Gabor Kiss-Vamosi
5574bac486 minor fixes 2019-11-15 07:28:42 +01:00
Gabor Kiss-Vamosi
e6d38f1acf merge dev-6.1 2019-11-15 06:53:15 +01:00
Gabor Kiss-Vamosi
bf5ea6658b update lv_conf_checker.h 2019-11-15 06:30:45 +01:00
Gabor Kiss-Vamosi
57cf7ef7d6 Merge pull request #1273 from neilabdev/hotfix/fix_roller_infinite_mode_initialization_bug
lv_roller_create cuases "divide by zero" via modulus operator for infinit scroll mode
2019-11-15 05:12:53 +01:00
Gabor Kiss-Vamosi
98c4514852 Merge pull request #1271 from littlevgl/fix_conversion_warnings
Fix -Wconversion warnings
2019-11-15 05:09:25 +01:00
James Whitfield
b9f7883b0b fixed bug where mode was not properly initialized for for roller extra attributes, causing crash in inf_normalize where there is a condition executed which causes a modulas divide by zero for mode LV_ROLLER_MODE_INFINITE, which is set at random because of dirty memory 2019-11-14 19:35:24 -08:00
Themba Dube
00517116cc Fix some warnings 2019-11-14 21:08:23 -05:00
Themba Dube
575df77a02 Fix public -Wconversion warnings 2019-11-14 20:38:47 -05:00
Gabor Kiss-Vamosi
6148b4016e add lv_objmask_update_mask and lv_objmask_remoev_mask 2019-11-14 14:05:14 +01:00
Gabor Kiss-Vamosi
cbe99407b0 draw_mask updates + lv_objmask use relative coordinates with masks 2019-11-14 14:05:14 +01:00
Gabor Kiss-Vamosi
90b7d3853f lv_draw_mask_add: save only the pointer of the parameter 2019-11-14 14:05:14 +01:00
Gabor Kiss-Vamosi
e76b5d58b5 lv_imgbtn: update img_draw calles to the new prototype 2019-11-14 12:28:27 +01:00
Gabor Kiss-Vamosi
75f27bbeae Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-11-14 10:49:47 +01:00
Gabor Kiss-Vamosi
110923168a lv_font_fmt_txt: change tab to 2 spaces 2019-11-14 10:49:41 +01:00
Gabor Kiss-Vamosi
bbf2c8247c Merge pull request #1268 from cpegeo/dev-6.1
Updated lv_refr_area and lv_img_design to account for single pixel height/width objects.
2019-11-13 19:44:40 +01:00
George Slater
de102f9d20 Updated lv_refr_area and lv_img_design to account for single pixel height/width objects.
lv_refr_area: Updated height for area refresh to correctly include areas that are a height of only 1 pixel.
lv_img_design: Updated draw loop to account for objects that are 1 pixel in height or width.
2019-11-13 11:54:05 -06:00
Gabor Kiss-Vamosi
7814d31613 Merge pull request #1261 from joltwallet/fix/txt_long_len
Fix/txt long len wrapping and disable macro
2019-11-13 08:38:44 +01:00
Gabor Kiss-Vamosi
92f9af3113 Merge branch 'dev-6.1' into fix/txt_long_len 2019-11-13 08:38:30 +01:00
Gabor Kiss-Vamosi
9792a74413 Merge pull request #1265 from pete-pjb/dev-6.1
Dev 6.1 Minor fixes
2019-11-13 07:39:59 +01:00
Gabor Kiss-Vamosi
060c27f54a Merge pull request #1264 from Maldus512/master
Added rotation feature to the lmeter
2019-11-13 07:39:07 +01:00
Pete Bone
1e4ce0b143 Dev 6.1 Minor fixes
lv_draw_arc.c -> line 218
Removed unsed fast_atan2() function which appears to have been moved to
lv_math.c as lv_atan2() function.

lv_font_heb_16.c -> line 1
Fixed inconsistent include path.

lv_label.c -> line 734
Added (char*) cast to const char* variable 'txt' to silence compiler
warning when LV_USE_BIDI is disabled.

lv_style.c -> line 93
Removed this line 

lv_style.c -> line 97
Reverted this line to remove override of LV_FONT_DEFAULT defined in
lv_conf.h
2019-11-12 15:26:35 +00:00
Mattia Maldini
b7c3732da7 Different wording 2019-11-12 16:14:18 +01:00
Gabor Kiss-Vamosi
6ebaaa6fa8 Update README.md 2019-11-12 15:25:52 +01:00
Gabor Kiss-Vamosi
db3d642096 Update README.md 2019-11-12 15:24:52 +01:00
Gabor Kiss-Vamosi
97a83cdf5c Create FUNDING.yml 2019-11-12 13:14:19 +01:00
Mattia Maldini
3cd2120b60 Added rotation feature to the lmeter 2019-11-12 13:07:26 +01:00
Gabor Kiss-Vamosi
f8d5d31469 fix typo in lv_img_set/get_antialias 2019-11-12 09:45:40 +01:00
Brian Pugh
79f403ddc5 lv_txt enforce pretty wrapping when first word of a line is a long word. 2019-11-11 23:08:45 -08:00
Gabor Kiss-Vamosi
8ac7bddaf7 fix conflicts 2019-11-12 06:55:08 +01:00
Gabor Kiss-Vamosi
afb47ebf56 Merge pull request #1253 from amirgon/feat-bidi-pos_conv
Feat bidi pos conv
2019-11-12 06:49:05 +01:00
Gabor Kiss-Vamosi
49e105917e add LV_COLOR_SET/GET for every color depth configuration 2019-11-12 06:39:26 +01:00
Brian Pugh
1764220deb lv_txt set word width to 0 when not returning a word in lv_txt_get_next_word 2019-11-11 21:18:32 -08:00
Brian Pugh
bb91aeb64c Add ability to disable inter-long-word breaks by setting LV_TXT_LINE_BREAK_LONG_LEN<=0. Fix some off-by-one character wrapping logic 2019-11-11 20:57:33 -08:00
Gabor Kiss-Vamosi
f3b88a57ca add LV_COLOR_SET/GET_R/G/B
It was mainly because when LV_COLOR_16_SWAP = 1 and  green is split to green_h and green_l
2019-11-12 05:38:26 +01:00
Amir Gonnen
23b58d598d bugfixes
Prevent infinite loop when reaching end of string on get_next_run

Prevent warning about conversion to non const bidi_txt
2019-11-11 22:43:12 +02:00
Gabor Kiss-Vamosi
90eeff7022 merge dev-6.1 2019-11-11 19:42:10 +01:00
Gabor Kiss-Vamosi
46eabd6cf0 Merge pull request #1258 from joltwallet/fix/lv_color_warning
fix 1bit lv_color compilation warnings/errors introduced by ...
2019-11-11 13:07:43 +01:00
Gabor Kiss-Vamosi
3ed0cd444a lv_task: fix crash after executing one shot tasks 2019-11-11 12:32:30 +01:00
Gabor Kiss-Vamosi
8cf7824f82 Merge pull request #1259 from joltwallet/fix/txt_cursor_wrap
Fix cursor wrapping described in https://github.com/littlevgl/lvgl/is…
2019-11-11 12:28:50 +01:00
Gabor Kiss-Vamosi
c4f8d8cd5b bidi: txt_sel fixes 2019-11-11 11:10:01 +01:00
Brian Pugh
183d849e84 Fix cursor wrapping described in https://github.com/littlevgl/lvgl/issues/1256 2019-11-10 23:42:31 -08:00
Brian Pugh
57e2a6d983 fix 1bit lv_color compilation warnings/errors introduced by 3da868a090 2019-11-10 21:44:27 -08:00
Gabor Kiss-Vamosi
6eaf8dd6d3 text sel fix, if start > end 2019-11-10 11:03:19 +01:00
Gabor Kiss-Vamosi
8dfcba6aa8 text sel fixes with bidi 2019-11-10 10:52:49 +01:00
Gabor Kiss-Vamosi
6f762bb7c7 fix lv_cpicker_set_color with 16 bit color depth and byte swap
Fixes #1257
2019-11-10 10:45:54 +01:00
Gabor Kiss-Vamosi
96b9114a5a bidi fixes for multi line text handling 2019-11-09 01:53:02 +01:00
Gabor Kiss-Vamosi
40459e01c9 change lv_objmask default style to transparent 2019-11-09 00:57:26 +01:00
Amir Gonnen
0130f3e5f2 Add RTL indication to pos_conv
When getting visual/logical pos, also get whether this pos is RTL (was reversed)
2019-11-09 01:02:51 +02:00
Gabor Kiss-Vamosi
e719853c0a fix conflicts 2019-11-08 23:15:48 +01:00
Gabor Kiss-Vamosi
eb90f3f418 revert accidentally deleted lv_img_buf_set_px_color 2019-11-08 23:12:07 +01:00
Gabor Kiss-Vamosi
5f1d1f4174 minor img transform fix 2019-11-08 23:07:35 +01:00
Gabor Kiss-Vamosi
80896b5114 Merge branch 'img_transform' of https://github.com/littlevgl/lvgl into img_transform 2019-11-08 22:58:26 +01:00
Gabor Kiss-Vamosi
42cde31888 minor img transform fixes 2019-11-08 22:58:09 +01:00
Gabor Kiss-Vamosi
48d81aab5e fix conflicts 2019-11-08 22:49:03 +01:00
Gabor Kiss-Vamosi
e29210889a add image zoom 2019-11-08 22:47:03 +01:00
Gabor Kiss-Vamosi
a3a326c2ff fix lv_label_get_letter_on in case of multi-line texts 2019-11-08 13:49:52 +01:00
Gabor Kiss-Vamosi
2bcbb309c8 Merge pull request #1250 from TridentTD/dev-7.0
[Dev 7.0]  lv_arc  fix rounded-ending arc
2019-11-08 13:07:41 +01:00
Gabor Kiss-Vamosi
18d1fdb3f5 preloader: fix top point position
in dev7.0 arc angle=0 is on the left and not on the bottom as it was in v6.0
2019-11-08 10:23:49 +01:00
Gabor Kiss-Vamosi
f1aa679e12 blend map optimization 2019-11-08 09:42:08 +01:00
Gabor Kiss-Vamosi
66a67ff24a Merge branch 'img_transform' of https://github.com/littlevgl/lvgl into img_transform 2019-11-08 09:21:05 +01:00
Gabor Kiss-Vamosi
62f6aa45e6 lv_img_rotate optimize anti aliasing 2019-11-08 09:20:35 +01:00
Gabor Kiss-Vamosi
a38734cb9a Merge branch 'img_transform' of https://github.com/littlevgl/lvgl into img_transform 2019-11-08 08:26:40 +01:00
Gabor Kiss-Vamosi
bf42c35cc0 fix conflicts 2019-11-08 08:26:05 +01:00
Gabor Kiss-Vamosi
cde17104a0 add alpha to lv_canvas_fill_bg 2019-11-08 08:21:08 +01:00
Gabor Kiss-Vamosi
49bafb1d36 improve img rotate quality 2019-11-08 08:20:42 +01:00
Gabor Kiss-Vamosi
c632c62cb9 static inline lv_img_buf_get_px 2019-11-07 06:00:16 +01:00
Gabor Kiss-Vamosi
1e685324cf add lv_img_buf_get_px() 2019-11-07 05:38:40 +01:00
Gabor Kiss-Vamosi
641ab62f42 img rotate and canvas blur fixes 2019-11-06 16:16:55 +01:00
Gabor Kiss-Vamosi
37743ba8a2 canvas blur fix 2019-11-06 15:03:18 +01:00
Gabor Kiss-Vamosi
f7c5daad85 add area to canvas blur 2019-11-06 14:55:35 +01:00
Gabor Kiss-Vamosi
05ededf8f3 canavs blur: support LV_CANVAS_16_SWAP 2019-11-06 14:37:03 +01:00
Gabor Kiss-Vamosi
a4c456607b Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-11-06 14:21:49 +01:00
Gabor Kiss-Vamosi
bc7fd45ff6 canvas blur optimization 2019-11-06 14:21:39 +01:00
Gabor Kiss-Vamosi
32fb95e7af canvas blur optimization 2019-11-06 14:20:40 +01:00
embeddedt
45c6dbab62 lv_cpicker: credit @AloyseTech and @paulpv 2019-11-06 08:11:58 -05:00
Gabor Kiss-Vamosi
453165a34c canvas blur fix 2019-11-06 13:45:35 +01:00
Gabor Kiss-Vamosi
60b6ef06fa canvas blur optimization 2019-11-06 13:43:57 +01:00
Gabor Kiss-Vamosi
9463633323 add 'safe' option to lv_img_buf_set/get_px_color/opa 2019-11-06 13:36:36 +01:00
Gabor Kiss-Vamosi
1a38783921 canvas blur fixes 2019-11-06 13:12:44 +01:00
Gabor Kiss-Vamosi
c1aae99208 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-11-06 12:43:52 +01:00
Gabor Kiss-Vamosi
3aa3bf49e6 add canvas blur 2019-11-06 12:43:40 +01:00
Gabor Kiss-Vamosi
647341426c Merge pull request #1233 from paulpv/fix-hsv
Fix hsv
2019-11-06 05:33:28 +01:00
Gabor Kiss-Vamosi
86f44c974d cpicker: set default type 2019-11-06 05:32:42 +01:00
Gabor Kiss-Vamosi
a76e65db88 Merge branch 'feat-cpicker' into dev-6.1 2019-11-06 05:27:52 +01:00
Gabor Kiss-Vamosi
5441cf9998 bidi fixes + add missing prefix to lv_encoded_get_char_id 2019-11-06 05:19:06 +01:00
Maximilian Schwab
74254975cd Update comment for logging callback (#1255)
Changed lv_log_register_print to lv_log_register_print_cb
2019-11-05 19:40:22 -05:00
Gabor Kiss-Vamosi
5d5a8b4894 convert lv_bidi_get_visual_pos to byteindex 2019-11-05 16:00:32 +01:00
Gabor Kiss-Vamosi
abb393632e minor fixes 2019-11-05 12:30:33 +01:00
TridentTD
93f5f69f73 move rounded-ending from lv_arc.c to lv_draw.arc.c 2019-11-05 17:44:05 +07:00
TridentTD
60148c5c73 move round-ending from lv_arc.c to lv_draw_arc.c 2019-11-05 17:40:02 +07:00
TridentTD
9f5fc99c9b remove rounded-ending in lv_arc.c 2019-11-05 17:37:32 +07:00
Gabor Kiss-Vamosi
2a25ddd0a2 add lv_draw_px 2019-11-05 06:29:53 +01:00
Amir Gonnen
6f57de051b WIP: pos_conv, bugfixes, use in lv_label 2019-11-05 01:03:40 +02:00
Gabor Kiss-Vamosi
e45d083436 fix warnings 2019-11-04 20:43:49 +01:00
Gabor Kiss-Vamosi
769c1a8f8a define empty LV_DEBUG_ASSERT if LV_USE_DEBUG is 0 2019-11-04 20:35:47 +01:00
Gabor Kiss-Vamosi
b44b926156 add the new files to the makefiles 2019-11-04 16:57:30 +01:00
Gabor Kiss-Vamosi
541a010ee9 fix uninitialized and shadoed warnings 2019-11-04 16:56:57 +01:00
Gabor Kiss-Vamosi
5844319017 Merge pull request #1252 from littlevgl/embeddedt_fix_7_warnings
Fix some more warnings in dev-7.0
2019-11-04 14:45:54 +01:00
Themba Dube
935674313c Fix use of empty initializer braces 2019-11-04 08:18:49 -05:00
Themba Dube
fb227e064f Fix some more warnings in dev-7.0 2019-11-04 08:13:07 -05:00
Gabor Kiss-Vamosi
5d565e577f imgbtn fixes for image rotation 2019-11-04 10:03:34 +01:00
Gabor Kiss-Vamosi
3ca7ce5335 remove 'include lv_version.h' 2019-11-04 08:55:16 +01:00
Gabor Kiss-Vamosi
833849c006 move version to lvgl.h 2019-11-04 08:49:33 +01:00
Gabor Kiss-Vamosi
cbe780de14 img rotate fixes 2019-11-04 08:48:14 +01:00
Gabor Kiss-Vamosi
b74e62edba material theme shadow fixes 2019-11-04 08:48:14 +01:00
Amir Gonnen
c7a7d1adca WIP: pos_conv add lv_bidi_get_logical/visual_pos functions 2019-11-04 09:26:52 +02:00
Amir Gonnen
f6829a17b2 WIP: Bidi pos_conv 2019-11-04 01:31:54 +02:00
embeddedt
f453993abc Update lv_version.h 2019-11-03 12:59:34 -05:00
Gabor Kiss-Vamosi
32d94cf7c9 fix warnings 2019-11-03 16:21:58 +01:00
Gabor Kiss-Vamosi
e7afc94cde fix conflicts 2019-11-03 16:12:05 +01:00
Gabor Kiss-Vamosi
a69d75c3d2 add lv_img_buf.c/h for better mosularity 2019-11-03 15:48:10 +01:00
Gabor Kiss-Vamosi
23b2a2810c drag fixes
Even in case of LV_DRAG_DIR_BOTH only one dir drag was possible if x or y havn't changed during the first movement.
2019-11-03 15:45:41 +01:00
Jan Van Winkel
9472d0d0c7 Added missing lv_indev.h includes (#1251) 2019-11-03 08:43:26 -05:00
Gabor Kiss-Vamosi
2199b30132 optimize clip area with image rotation 2019-11-03 10:08:15 +01:00
Gabor Kiss-Vamosi
722820ee56 img rotate: add support all color formats 2019-11-03 07:13:14 +01:00
Gabor Kiss-Vamosi
5222bf92c4 kb: use LV_SYMBOL_NEW_LINE as new line 2019-11-02 23:33:25 +01:00
Gabor Kiss-Vamosi
916133f8b7 remove test code from lv_mbox_set_text 2019-11-02 21:44:12 +01:00
Gabor Kiss-Vamosi
62e6397f82 Merge branch 'dev-6.1' into dev-7.0 2019-11-02 21:41:43 +01:00
Gabor Kiss-Vamosi
3c662670f0 Merge branch 'master' into dev-6.1 2019-11-02 21:35:14 +01:00
Gabor Kiss-Vamosi
8db8470a60 lv_ta_set_placeholder_text: fix placholder align 2019-11-02 21:34:41 +01:00
Gabor Kiss-Vamosi
e0dee03233 Merge branch 'master' into dev-6.1 2019-11-02 21:32:08 +01:00
Gabor Kiss-Vamosi
abfe2f63a1 img rotate auto set ext draw pad 2019-11-02 21:30:51 +01:00
TridentTD
05da56c839 fix rounded-ending arc 2019-11-02 20:17:45 +07:00
Gabor Kiss-Vamosi
2b955ac8b6 img run-time rotate functionally working 2019-11-02 08:51:38 +01:00
Gabor Kiss-Vamosi
fab8288372 fix conflicts 2019-11-01 20:33:50 +01:00
Gabor Kiss-Vamosi
a1d84e5792 img rotate further optimiziation 2019-11-01 20:32:16 +01:00
Gabor Kiss-Vamosi
1458828b97 img rotation fixes 2019-11-01 20:26:39 +01:00
Gabor Kiss-Vamosi
1ae214a2de img rotate optimization 2019-11-01 20:17:11 +01:00
Gabor Kiss-Vamosi
07317f771e fix warning in lv_draw_mask_angle_init 2019-11-01 16:39:19 +01:00
Gabor Kiss-Vamosi
bdd0acf53a fix conflicts 2019-11-01 11:14:04 +01:00
Gabor Kiss-Vamosi
632fd15775 add lv_api_map.h and rename lv_chart_get_point_cnt to lv_chart_get_point_count 2019-11-01 11:12:20 +01:00
Gabor Kiss-Vamosi
b8f5cad89c add lv_img_get_px_rotated 2019-11-01 11:12:20 +01:00
Gabor Kiss-Vamosi
b8a156e0d4 fix lv_cb_is_inactive 2019-11-01 11:10:43 +01:00
George Slater
3758a82f3a lv_color1_t: Add 'ch' struct to union to fix 1bit color compilation error.
lv_color.h:
Updated lv_color1_t union to include 'ch' structure. This fixes compilation errors when configured for 1bit color.
2019-11-01 11:10:43 +01:00
Gabor Kiss-Vamosi
82e2d53763 img_draw angle testing 2019-11-01 11:10:26 +01:00
Gabor Kiss-Vamosi
40f2586a54 add lv_api_map.h and rename lv_chart_get_point_cnt to lv_chart_get_point_count 2019-11-01 11:09:56 +01:00
Gabor Kiss-Vamosi
b73f7a1f82 merger dev-6.1 2019-11-01 06:04:03 +01:00
Gabor Kiss-Vamosi
84a70d1617 add lv_img_get_px_rotated 2019-11-01 06:00:04 +01:00
Themba Dube
982e2036cf Fix inconsistency between lv_debug.c and lv_debug.h 2019-10-31 20:21:58 -04:00
Themba Dube
b02bf9d804 Merge branch 'dev-6.1' of github.com:littlevgl/lvgl into dev-6.1 2019-10-31 20:21:28 -04:00
Themba Dube
2c790699de Remove unused statement in lv_tileview 2019-10-31 20:19:54 -04:00
Themba Dube
859e14bedc Add default cases in lv_tabview.c 2019-10-31 20:19:21 -04:00
Themba Dube
7a0dad4f17 Fix potential bug with page scrollable fit configuration 2019-10-31 20:19:07 -04:00
Themba Dube
958f0acdc8 Fix inconsistency between lv_debug.c and lv_debug.h 2019-10-31 20:18:50 -04:00
Themba Dube
dd1eed7c1b Handle a GCC warning in lv_draw_triangle 2019-10-31 19:57:30 -04:00
Themba Dube
847527df0d Add LV_USE_OBJMASK to lv_conf_template.h 2019-10-31 19:57:20 -04:00
Themba Dube
f92381b15f Fix incorrect mask parameter usage in lv_draw_mask_map_init() 2019-10-31 19:57:01 -04:00
Themba Dube
d40fb513d3 Merge branch 'dev-7.0' of github.com:littlevgl/lvgl into dev-7.0 2019-10-31 19:47:58 -04:00
Gabor Kiss-Vamosi
fb9fb8d09e add LV_LABEL_TEXT_SEL_OFF again 2019-10-31 19:24:41 +01:00
Gabor Kiss-Vamosi
da7e67b381 fix lv_cb_is_inactive 2019-10-31 14:14:40 +01:00
Gabor Kiss-Vamosi
9726e269ab fix drag throw 2019-10-31 08:51:34 +01:00
Gabor Kiss-Vamosi
4a90980023 border part draw fixes 2019-10-31 08:51:19 +01:00
Gabor Kiss-Vamosi
ded47f705a tabview fix missing indicator 2019-10-31 07:07:22 +01:00
Gabor Kiss-Vamosi
6d954bb7ba rect border part draw fixes 2019-10-31 06:46:50 +01:00
Gabor Kiss-Vamosi
1106a2bba0 Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0 2019-10-31 06:42:26 +01:00
Gabor Kiss-Vamosi
e76b3b42f4 material theme fixes 2019-10-31 06:42:20 +01:00
Gabor Kiss-Vamosi
4632c35f39 style fixes 2019-10-31 06:41:57 +01:00
Gabor Kiss-Vamosi
0f1e5fba16 Merge pull request #1245 from cpegeo/dev-6.1
lv_color1_t: Add 'ch' struct to union to fix 1bit color compilation error
2019-10-31 06:33:08 +01:00
Gabor Kiss-Vamosi
c653977991 lv_label: add LV_LABEL_TEXT_SEL_OFF again 2019-10-31 06:06:47 +01:00
George Slater
3da868a090 lv_color1_t: Add 'ch' struct to union to fix 1bit color compilation error.
lv_color.h:
Updated lv_color1_t union to include 'ch' structure. This fixes compilation errors when configured for 1bit color.
2019-10-30 17:03:56 -05:00
Themba Dube
8c0cbac668 Merge branch 'dev-6.1' into dev-7.0 2019-10-30 11:31:41 -04:00
Themba Dube
9baef1ef96 Add missing definition of LV_LABEL_TEXT_SEL_OFF 2019-10-30 11:31:24 -04:00
Themba Dube
30a5b29690 Fix issue when LV_USE_BIDI is 0 2019-10-30 11:00:48 -04:00
Gabor Kiss-Vamosi
d0f257d4dd merge dev-6.1 2019-10-30 10:34:39 +01:00
Gabor Kiss-Vamosi
c86e2722bd lv_draw_label: fix warning with txt_sel by adding lv_draw_label_txt_sel_t parameter 2019-10-30 10:16:06 +01:00
Gabor Kiss-Vamosi
a6a3390cbd style fixes 2019-10-30 09:47:28 +01:00
Gabor Kiss-Vamosi
7633fe2a3e clean up styles 2019-10-30 09:47:07 +01:00
Gabor Kiss-Vamosi
224e422f43 fix rectangle border part draw 2019-10-30 09:47:07 +01:00
Gabor Kiss-Vamosi
77706614e2 fix 1px error in the bottom of radius mask 2019-10-30 08:40:16 +01:00
Gabor Kiss-Vamosi
53ff55434a imgbtn minor fix 2019-10-30 07:07:31 +01:00
Gabor Kiss-Vamosi
a75640adc2 merge dev-6.1 2019-10-30 06:59:51 +01:00
Gabor Kiss-Vamosi
cfb72d5b69 fix text recolor processing 2019-10-30 06:49:21 +01:00
Gabor Kiss-Vamosi
38ba12a866 imgbtn fix 2019-10-30 06:32:58 +01:00
Gabor Kiss-Vamosi
42070162b9 add image.intense to btn styles 2019-10-30 06:26:51 +01:00
Gabor Kiss-Vamosi
48a6bf8730 fixes with LV_COLOR_16_SWAP 1 2019-10-30 06:00:13 +01:00
Gabor Kiss-Vamosi
093b522738 minor fixes 2019-10-30 05:29:31 +01:00
Gabor Kiss-Vamosi
dd100e5e07 ta: fix place holder alignment. Fixes #1241 2019-10-29 14:33:59 +01:00
Gabor Kiss-Vamosi
033b42fa3c add comments 2019-10-28 15:52:12 +01:00
Gabor Kiss-Vamosi
1ead05c885 upadte polygon drawing 2019-10-28 15:03:11 +01:00
Gabor Kiss-Vamosi
8fe92bcd9a lv_task: rename task_handler_mutex to already_running. Fixes #1238 2019-10-28 06:24:47 +01:00
Gabor Kiss-Vamosi
dd68877aae bidi bracket handling fixies 2019-10-28 05:47:31 +01:00
Themba Dube
98b353879f Merge remote-tracking branch 'origin/dev-6.1' into feat-cpicker 2019-10-27 09:13:47 -04:00
Themba Dube
6051e20b6c Merge remote-tracking branch 'paulpv/feat-cpicker' into feat-cpicker 2019-10-27 09:10:41 -04:00
Gabor Kiss-Vamosi
98a4d9b062 bidi: barcket process fixes 2019-10-27 10:44:00 +01:00
Gabor Kiss-Vamosi
1c4695a21e Merge branch 'dev-6.1' into feat-bidi 2019-10-27 10:25:51 +01:00
Gabor Kiss-Vamosi
9048e8072b fix conflicts 2019-10-27 10:25:33 +01:00
Gabor Kiss-Vamosi
081b2c2271 bidi: barcket handle fixes 2019-10-27 10:21:37 +01:00
Gabor Kiss-Vamosi
7f19fb53e6 set LV_MEM_JUNK to 0 2019-10-25 13:37:39 +02:00
Gabor Kiss-Vamosi
57a8ee8e32 bidi: add bracket algorithm 2019-10-25 06:15:11 +02:00
Paul Peavyhouse
6df1fe190a #include and use LV_MATH_ABS 2019-10-24 20:13:03 -07:00
Paul Peavyhouse
372b133b18 Converting to integer based math 2019-10-24 16:46:30 -07:00
Gabor Kiss-Vamosi
f02d52a598 merge dev-6.1 2019-10-24 15:25:52 +02:00
Gabor Kiss-Vamosi
d5aabef42d Merge pull request #1231 from amirgon/feat-bidi-wrap
Bidi multi-line text wrap
2019-10-24 13:29:20 +02:00
Gabor Kiss-Vamosi
4158334a40 bidi: ahndle LV_BIDI_DIR_AUTO in lv_bidi_process_paragraph 2019-10-24 07:15:00 +02:00
Gabor Kiss-Vamosi
f38b12ee6c Merge branch 'dev-6.1' of https://github.com/littlevgl/lvgl into dev-6.1 2019-10-24 06:15:45 +02:00
Gabor Kiss-Vamosi
437b34390c fix compiler error with LV_COLOR_16_SWAP adnd LV_SUBPX_BGR 2019-10-24 06:15:19 +02:00
Gabor Kiss-Vamosi
32689cb3e5 Merge pull request #1234 from Boldie/fix_racecondition_flushing
Reset flushing after setting the buffer content to fix race condition.
2019-10-24 06:11:14 +02:00
Sven Steckmann
6f6c26b058 Reset flushing after setting the buffer content to fix race condition.
Flushing flag is used to wait for the finish of the transfer. If this
is reset to 0, the other parts of the code will start accessing the buf_act
(see src/lv_core/lv_refr.c:106) and thus may create a race condition. Exchanging
the resetting to 0 and memset will fix this issue.
2019-10-23 23:48:52 +02:00
Paul Peavyhouse
ddd7c1d30c Adding ending newline 2019-10-22 13:29:38 -07:00
Paul Peavyhouse
a572d8a648 Keeping some original variable names 2019-10-22 13:19:22 -07:00
Paul Peavyhouse
65252024bf Formatting 2019-10-22 13:17:53 -07:00
Paul Peavyhouse
69d7d53768 Documenting code 2019-10-22 13:07:01 -07:00
Paul Peavyhouse
6aff9f65ed Floating point fix for RGB to HSV
Test code at https://github.com/paulpv/lv_examples/blob/master/lv_tests/lv_test_misc/lv_test_color/lv_test_color.ino
2019-10-22 13:02:31 -07:00
Gabor Kiss-Vamosi
cfddd8df65 ddlist: fix label alignment after style change 2019-10-22 06:01:48 +02:00
Amir Gonnen
0634b11578 Add minus (hyphen) as neutral letter 2019-10-22 01:36:37 +03:00
Paul Peavyhouse
3264af9f0e Fixing failure to invalidate indicator 2019-10-21 15:27:57 -07:00
Paul Peavyhouse
901d108bae Merge branch 'dev-6.1' into feat-cpicker 2019-10-21 15:25:36 -07:00
Gabor Kiss-Vamosi
c241905d88 lv_font_roboto_16: add missing symbols 2019-10-21 07:13:04 +02:00
Gabor Kiss-Vamosi
23ec092c14 fix subpxixel rendering with LV_COLOR_16_SWAP 2019-10-21 06:41:40 +02:00
Gabor Kiss-Vamosi
246adc7b43 Merge pull request #1218 from paulpv/fix-rgb565
Fix RGB 565 to 888
2019-10-21 06:30:49 +02:00
Gabor Kiss-Vamosi
0bd200a36a Merge pull request #1228 from tgillbe/feature_arc_antialias
Add arc antialiasing
2019-10-21 05:26:33 +02:00
Amir Gonnen
f7c2512c76 Bidi fixes
Add bidi_dir parameter to lv_draw_label

Use draw buffer for bidi processing

condition bidi code according to LV_USE_BIDI
2019-10-20 02:16:57 +03:00
Paul Peavyhouse
ae006b2bc9 typo 2019-10-19 05:26:18 -07:00
Paul Peavyhouse
a11a06547f More mathematically worded 2019-10-19 05:24:25 -07:00
Paul Peavyhouse
8694b3889b Not so concise comment 2019-10-19 05:17:22 -07:00
Paul Peavyhouse
649e438f0d Experimented and found "smaller" math 2019-10-19 04:04:07 -07:00
Gabor Kiss-Vamosi
9a7b7f8511 btnm, tabview: in LV_SIGNAL_FOCUS assume the last indev if not focused by the an indev 2019-10-19 11:01:10 +02:00
Gabor Kiss-Vamosi
4c944f4050 subpx fixes 2019-10-19 10:29:59 +02:00
tgillbe
6cfb0af7c3 Add arc antialiasing 2019-10-18 15:34:57 +01:00
Gabor Kiss-Vamosi
e1c46cb9bc Merge branch 'feat-subpixel' into dev-6.1 2019-10-18 14:58:04 +02:00
Gabor Kiss-Vamosi
f282c3bd08 subpx: read fro mteh font if subpx is supported 2019-10-18 14:57:27 +02:00
Amir Gonnen
c6b7cf130b Support text wrap for bidi text
TODO: conditional LV_USE_BIDI, allocate global buffer once, pass dir as parameter to lv_draw_label
2019-10-18 02:13:41 +03:00
Paul Peavyhouse
04158b39cd Fully tested values 5 bit red/blue 0 to 31 and 6 bit green 0 to 63 2019-10-16 23:21:30 -07:00
Paul Peavyhouse
92be109cba Fixing +/- 3 conversion problem 2019-10-16 22:41:56 -07:00
Gabor Kiss-Vamosi
87d191e737 lv_font.h: change field order 2019-10-17 06:47:51 +02:00
Gabor Kiss-Vamosi
73a0686672 page, tabview bidi fixes 2019-10-17 06:10:29 +02:00
Gabor Kiss-Vamosi
dbaaaa31a6 lv_obj_set_parent: reposition according to base dir 2019-10-17 06:10:08 +02:00
Themba Dube
2e612c91bd Merge remote-tracking branch 'origin/dev-6.1' into feat-cpicker 2019-10-16 20:37:54 -04:00
Amir Gonnen
770645ecd0 add Hebrew font 2019-10-16 23:35:38 +03:00
Amir Gonnen
93a94bc4d5 Add exported constants to log-level macros (#1226)
See GitHub comments on 0df7d0d996.
2019-10-16 16:21:07 -04:00
Amir Gonnen
c7b8626780 Add exported constants to log-level macros
See comments to 0df7d0d996
2019-10-16 23:09:55 +03:00
Gabor Kiss-Vamosi
51226f7bfb merge bidi 2019-10-16 20:54:46 +02:00
Gabor Kiss-Vamosi
5491b5dc40 optimize triangle and line drawing by reducing mask 2019-10-16 20:38:45 +02:00
Gabor Kiss-Vamosi
1521aad41e move 'corner mask' to style.body 2019-10-16 20:25:53 +02:00
Gabor Kiss-Vamosi
a6f68e5387 add subpx rendering 2019-10-16 14:42:15 +02:00
Gabor Kiss-Vamosi
27c8a88c94 lv_tabiew: fix indicator position 2019-10-16 11:16:16 +02:00
Gabor Kiss-Vamosi
bd9695ab03 font: fix of decompression if size = 0 2019-10-16 11:16:03 +02:00
Gabor Kiss-Vamosi
10b3463a5f add lv_font_subpx_t 2019-10-16 10:34:54 +02:00
Gabor Kiss-Vamosi
bcdd680a2f table: apply bidi on cell values 2019-10-16 05:08:21 +02:00
Gabor Kiss-Vamosi
6b5c89baf7 lv_label_ins_text: consider base dir 2019-10-15 14:25:47 +02:00
Gabor Kiss-Vamosi
54e34c15b9 btnm, tabview: revers the button/tab order with RTL base dir 2019-10-15 11:04:49 +02:00
Gabor Kiss-Vamosi
06746dfd63 fix page overflow when object created on the right due to RTL base dir 2019-10-15 10:32:15 +02:00
Gabor Kiss-Vamosi
f1c7e19985 bidi: remove debug printfs 2019-10-14 16:02:28 +02:00
Gabor Kiss-Vamosi
9d2a2c58f9 In case of RTL with LV_LAYOUT_ROW_X arrangle from the right 2019-10-14 15:25:40 +02:00
Themba Dube
de55986fc0 Merge branch 'dev-6.1' into feat-cpicker 2019-10-12 21:04:21 -04:00
Themba Dube
93ce1b9e1c Silence GCC warning about extra semicolons 2019-10-12 21:03:54 -04:00
Themba Dube
0df7d0d996 Partially revert lv_log.h to fix compilation issue until consensus is reached 2019-10-12 21:00:00 -04:00
Themba Dube
7f5ce8ca37 Merge branch 'dev-6.1' into feat-cpicker 2019-10-12 20:55:29 -04:00
Themba Dube
dcc287c936 Merge remote-tracking branch 'origin/master' into dev-6.1 2019-10-12 20:55:17 -04:00
Themba Dube
bd402605da Merge branch 'dev-6.1' of github.com:littlevgl/lvgl into dev-6.1 2019-10-12 20:54:02 -04:00
Gabor Kiss-Vamosi
c2b3976d5a Merge pull request #1219 from TridentTD/master
Update drawing round-ending lines for the canvas's obj
2019-10-11 16:10:24 +02:00
Gabor Kiss-Vamosi
6d93057532 minor fixes 2019-10-11 15:03:17 +02:00
Gabor Kiss-Vamosi
bae1cb6ae0 lv_conf_checker.py: support macros with parentheses 2019-10-11 15:03:12 +02:00
Gabor Kiss-Vamosi
7325a3cdde Merge branch 'dev-6.1' of https://github.com/littlevgl/lvgl into dev-6.1 2019-10-11 14:43:36 +02:00
Gabor Kiss-Vamosi
641117e896 tabview: on FOCUS preselect the currently active tab 2019-10-11 14:43:29 +02:00
Gabor Kiss-Vamosi
fe35307d9f fix page oveflow with right aligned object (due to RTL base dir) 2019-10-11 14:15:38 +02:00
Gabor Kiss-Vamosi
6f001958ce bidi: fix btnm, kb, ta, table behaviour in RTL context 2019-10-11 12:01:58 +02:00
Gabor Kiss-Vamosi
ca45bfaf07 add triangle drawing 2019-10-10 15:36:53 +02:00
Gabor Kiss-Vamosi
c747f29664 ddlist: RTL deafult pos fixes 2019-10-10 14:34:39 +02:00
Gabor Kiss-Vamosi
cadf2bd97d with RTL base dir: create the object on the right and grow to the right in lv_obj_set_width 2019-10-10 14:16:11 +02:00
Gabor Kiss-Vamosi
7f7abe9a93 subpixel: update drawing to support both types 2019-10-10 07:09:30 +02:00
TridentTD
aa1d5080e4 add if(style->line.rounded) 2019-10-09 23:12:47 +07:00
TridentTD
8af6043e75 add if(style->line.rounded) 2019-10-09 23:11:16 +07:00
Gabor Kiss-Vamosi
7a0728fc3c bidi: minor fixes 2019-10-09 15:36:38 +02:00
Gabor Kiss-Vamosi
a12bbfe0d2 subpixel: add test font 2019-10-09 14:29:22 +02:00
Gabor Kiss-Vamosi
1016b8bb47 Merge pull request #1220 from ScarsFun/master
hide sign in spinbox widget if only positive values
2019-10-09 14:26:31 +02:00
Gabor Kiss-Vamosi
0257fbcd5a bidi: process in paragraphs 2019-10-09 14:00:28 +02:00
Gabor Kiss-Vamosi
eeabd32b9e bidi: minor fixes 2019-10-08 16:54:28 +02:00
crnchbng
68c752ab50 Fix compile issue with LV_EXT_CLICK_AREA_TINY (#1221)
Discussed in https://github.com/littlevgl/lv_gui_builder/issues/2#issuecomment-495246128.
2019-10-08 10:53:31 -04:00
Gabor Kiss-Vamosi
34e133586e make LV_USE_BIDI = 0 by default 2019-10-08 16:31:32 +02:00
Gabor Kiss-Vamosi
b06ef2620a merge dev-6.1 2019-10-08 16:29:40 +02:00
Gabor Kiss-Vamosi
6190763382 bidi: add LV_LABEL_ALIGN_AUTO, LV_BIDI_DIR_AOUT/INHERIT, LV_SIGNAL_BASE_DIR_CHG 2019-10-08 16:26:55 +02:00
Pusillus
99fd136758 hide sign if only positive values 2019-10-08 06:25:40 +02:00
Gabor Kiss-Vamosi
2117c4dab2 fix lv_btn_get_ink_out_time 2019-10-08 06:04:58 +02:00
Gabor Kiss-Vamosi
beafc32594 subpixel: initial test 2019-10-07 20:50:44 +02:00
Pusillus
dbccceea51 hide sign if only positive values 2019-10-06 08:29:15 +02:00
TridentTD
80448a1d54 Update drawing round-ending lines for the canvas's obj 2019-10-06 11:46:44 +07:00
Paul Peavyhouse
e0ca7581ef Initial commit of only 565 to 888; will check others next 2019-10-04 17:03:40 -07:00
Paul Peavyhouse
05f23d5ff0 Merge remote-tracking branch 'littlevgl/dev-6.1' into dev-6.1 2019-10-04 16:16:30 -07:00
Gabor Kiss-Vamosi
92b9141788 Merge pull request #1217 from amirgon/dev-6.1
use "export" macro to export interesting defines to binding
2019-10-04 12:25:23 +02:00
Amir Gonnen
02755339bc Move LV_EXPORT_CONST_INT to compiler settings section 2019-10-04 12:26:33 +03:00
Paul Peavyhouse
34faac98a7 Cleaner calls to get_indic_area 2019-10-03 23:35:57 -07:00
Amir Gonnen
d1d3ef4305 use "export" macro to export interesting defines to binding 2019-10-03 23:20:50 +03:00
Paul Peavyhouse
68c39030a6 Missed a line! 2019-10-03 04:04:27 -07:00
Paul Peavyhouse
61dfb56648 Consolidating common indicator_area calculation code 2019-10-03 04:02:38 -07:00
Paul Peavyhouse
ca9c4c8fda Code formatting 2019-10-03 03:11:38 -07:00
Paul Peavyhouse
c74e6a6207 Shrinking the gap between outer ring and inner preview a little 2019-10-02 21:14:28 -07:00
Gabor Kiss-Vamosi
abb480f988 lv_win_set_content_size: fix setting the size 2019-10-03 06:11:40 +02:00
Gabor Kiss-Vamosi
de96092537 remove unused vars 2019-10-03 06:06:27 +02:00
Gabor Kiss-Vamosi
3753265f56 update makefile 2019-10-03 06:06:20 +02:00
Gabor Kiss-Vamosi
8fb484ab91 font: fix the use of signed/unsiged types 2019-10-03 06:02:21 +02:00
Gabor Kiss-Vamosi
dd87cb8ef4 fix built-in fonts' include path 2019-10-03 05:55:53 +02:00
Gabor Kiss-Vamosi
e4bd622c78 Merge branch 'master' into dev-6.1 2019-10-03 05:54:43 +02:00
Gabor Kiss-Vamosi
dab042fe06 fix lv_font_unscii_8 include 2019-10-03 05:54:21 +02:00
Gabor Kiss-Vamosi
6d52976a16 update (re-generate) lv_font_unscii_8 2019-10-03 05:48:49 +02:00
Themba Dube
0d31e63a1e Merge remote-tracking branch 'origin/master' into dev-6.1 2019-10-02 20:12:58 -04:00
Paul Peavyhouse
b49edd91a2 All color setters use lv_cpicker_set_hsv and return bool for change 2019-10-02 16:21:44 -07:00
Paul Peavyhouse
994057b578 Removing extra indentation 2019-10-02 15:25:25 -07:00
Paul Peavyhouse
8fc9b12c64 Merge remote-tracking branch 'littlevgl/feat-cpicker' into feat-cpicker 2019-10-02 15:20:15 -07:00
Gabor Kiss-Vamosi
4396e0e496 Merge branch 'feat-cpicker' into new_draw 2019-10-02 16:59:50 +02:00
Gabor Kiss-Vamosi
87dd0baca9 merge feat-cpicker 2019-10-02 16:59:11 +02:00
Gabor Kiss-Vamosi
434ef7e667 cpicker: minor fixes 2019-10-02 16:58:41 +02:00
Gabor Kiss-Vamosi
d4196c7534 cpicker: add preview feature 2019-10-02 16:47:08 +02:00
Gabor Kiss-Vamosi
1dfc11ef4f tabview: fix slide navigation and auto-fits 2019-10-02 16:35:02 +02:00
Gabor Kiss-Vamosi
e8625aaf65 add cpicker to lv_conf_template.h 2019-10-02 09:02:43 +02:00
Gabor Kiss-Vamosi
0a25c5ab36 draw_rect: separate bg and border draw + fix artifacts with LV_OPA_COVER borders 2019-10-02 09:00:12 +02:00
Gabor Kiss-Vamosi
11d5fcb9ae cpicker: on double click reset only the current color mode 2019-10-02 08:32:10 +02:00
Gabor Kiss-Vamosi
d6ae10473b cpicker: cleanup 2019-10-02 08:28:24 +02:00
Gabor Kiss-Vamosi
c03744a048 blend: remove unnecessary checks 2019-10-02 07:05:14 +02:00
Gabor Kiss-Vamosi
1edeba573f mask: fix write out-of-bounds of mask_buf 2019-10-02 07:03:53 +02:00
Gabor Kiss-Vamosi
3761987d32 lv_color_mix: reduce rounding error 2019-10-02 07:02:36 +02:00
xennex22
23009e8de9 Update lv_kb.c
Fixed enum prefix
2019-10-01 21:35:12 -07:00
xennex22
3c7cb46318 Update lv_kb.h
Fixed enum prefix
2019-10-01 21:31:50 -07:00
Paul Peavyhouse
786eabe1c7 Merge remote-tracking branch 'littlevgl/feat-cpicker' into feat-cpicker 2019-10-01 20:22:57 -07:00
Gabor Kiss-Vamosi
4f4d963d77 merge feat-cpicker 2019-10-01 22:20:55 +02:00
Gabor Kiss-Vamosi
7a707ff94c merge dev-6.1 2019-10-01 22:16:25 +02:00
Gabor Kiss-Vamosi
10d90a8baa cpicker: minor fixes 2019-10-01 22:08:14 +02:00
Gabor Kiss-Vamosi
eda607d824 cpicker: minor fixes 2019-10-01 22:00:23 +02:00
Gabor Kiss-Vamosi
2600c1c3d9 cpicker: rework 2019-10-01 21:16:30 +02:00
Gabor Kiss-Vamosi
c64dc1d645 bidi: compose otput string and swap arithmetical symbols 2019-10-01 05:48:46 +02:00
Gabor Kiss-Vamosi
8cb508dfec cpicker minor renames 2019-10-01 05:20:20 +02:00
Paul Peavyhouse
af7b2857ee Moving a method 2019-09-30 15:51:18 -07:00
Paul Peavyhouse
98d29cdcd1 Merge remote-tracking branch 'littlevgl/feat-cpicker' into feat-cpicker 2019-09-30 15:46:15 -07:00
Paul Peavyhouse
974e4a245e Consolidating Disc and Rect lv_cpicker_signal 2019-09-30 15:43:02 -07:00
Paul Peavyhouse
333812ba7a Improvements to color picker (#1208) 2019-09-30 10:00:34 -04:00
Gabor Kiss-Vamosi
5e7edc30be Merge pull request #1209 from liuduanfei/master
fixed comment error.
2019-09-30 12:28:14 +02:00
Gabor Kiss-Vamosi
c190374c79 img_cache: store the filename instead of its pointer 2019-09-30 11:56:38 +02:00
HappyTime
a5de64f93c fixed comment error. 2019-09-30 16:56:47 +08:00
Gabor Kiss-Vamosi
a35a79ba4e lv_img: fix caching when image source changes 2019-09-30 06:21:18 +02:00
Paul Peavyhouse
93d2d422b8 Not emitting LV_EVENT_VALUE_CHANGED if double-click doesn't change value 2019-09-29 21:11:53 -07:00
Paul Peavyhouse
1339d92ccd Code formatting 2019-09-29 21:02:12 -07:00
Paul Peavyhouse
bf9ed06bac Consolidating identical LV_KEY_RIGHT/UP and LV_KEY_LEFT/DOWN code 2019-09-29 21:00:00 -07:00
Paul Peavyhouse
3a5293fa32 Tiny consolidation of identical LV_SIGNAL_PRESS_LOST code 2019-09-29 20:56:05 -07:00
xennex22
90b8b3eb76 Update lv_kb.c
Changed keyboard mapping to set a map copy for each keyboard shift state.
2019-09-28 09:19:27 -07:00
xennex22
d9f80ecf1a Update lv_kb.h
Changed keyboard map set functions to take 'lv_kb_shift_t' keyboard shift parameter
2019-09-28 09:15:22 -07:00
Paul Peavyhouse
ab2114e4e7 Eventing LV_EVENT_VALUE_CHANGED when double-clicked 2019-09-28 01:54:10 -07:00
Paul Peavyhouse
1a3d61e074 Consolidate separate h, s, & v vars in to single lv_color_hsv_t var 2019-09-28 01:46:43 -07:00
Gabor Kiss-Vamosi
1a5001d7a3 Merge pull request #1196 from paulpv/color_picker_6
Porting @AloyseTech's color picker from lvgl v5 to v6
2019-09-28 09:16:55 +02:00
Gabor Kiss-Vamosi
a50e597942 bidi: support currencies in rtl 2019-09-28 08:40:02 +02:00
Gabor Kiss-Vamosi
c1e0faf440 Merge pull request #1206 from pete-pjb/dev-6.1
Added extra keyboard mode to enable caps-lock defined as
2019-09-27 10:07:07 +02:00
pete-pjb
3f89a91d9c Changed LV_KB_MODE_TEXT_UC to LV_KB_MODE_TEXT_UPPER as suggested to make
it more intuitive.
2019-09-27 08:43:14 +01:00
pete-pjb
e94f8e3cfc Changed LV_KB_MODE_TEXT_UC to LV_KB_MODE_TEXT_UPPER as suggested to make
it more intuitive.
2019-09-27 08:39:23 +01:00
Gabor Kiss-Vamosi
3aac71b16e lv_btnm: fix row positions 2019-09-27 09:10:26 +02:00
Paul Peavyhouse
7ac2aff982 Using #define defaults instead of hard-coded numbers 2019-09-26 22:35:41 -07:00
Paul Peavyhouse
280c291db7 Cleaned up and ready for [hopefully] final code review! 2019-09-26 22:22:27 -07:00
Gabor Kiss-Vamosi
ac269ebaad bidi: fixes 2019-09-27 06:03:54 +02:00
Gabor Kiss-Vamosi
a3b61e72fc imgbtn: support symbols 2019-09-27 04:04:57 +02:00
Gabor Kiss-Vamosi
5370543e95 Merge branch 'feat-debug' into dev-6.1 2019-09-27 03:29:34 +02:00
Gabor Kiss-Vamosi
f00c24f312 debug: add style sentinel 2019-09-27 03:28:44 +02:00
Paul Peavyhouse
85ffe5f974 Merge branch 'dev-6.1' into color_picker_6 2019-09-26 12:48:04 -07:00
Paul Peavyhouse
c5e7fbd953 Merge remote-tracking branch 'littlevgl/dev-6.1' into dev-6.1 2019-09-26 12:47:31 -07:00
Paul Peavyhouse
8476692731 [Still] working cleanup checkpoint 2019-09-26 12:32:05 -07:00
Paul Peavyhouse
25d4991683 Whitespace changes 2019-09-26 11:24:47 -07:00
Paul Peavyhouse
d3962fc26c [Still] working cleanup checkpoint 2019-09-26 11:17:13 -07:00
pete-pjb
96e64ad6fc Added extra keyboard mode to enable caps-lock defined as
LV_KB_MODE_TEXT_UC
2019-09-26 18:24:28 +01:00
Gabor Kiss-Vamosi
fa6ae44f0f fix conflicts 2019-09-26 15:24:47 +02:00
Gabor Kiss-Vamosi
0a9eeba4e4 dubug: add asserts to every object type's API functions 2019-09-26 15:13:33 +02:00
Gabor Kiss-Vamosi
ede392b7c9 debug: add assterts to lv_obj and update signal functions 2019-09-26 10:51:54 +02:00
Paul Peavyhouse
8e7bd571af Syncing... 2019-09-25 23:41:32 -07:00
Paul Peavyhouse
4d44d16b2e Changing QF from 1 to 3 2019-09-25 23:16:12 -07:00
Gabor Kiss-Vamosi
8dcb1ff21c cpicker: fix line indicator artifact 2019-09-26 07:23:23 +02:00
Gabor Kiss-Vamosi
6e9f10451d Merge branch 'color_picker_6' of https://github.com/paulpv/lvgl into paulpv-color_picker_6 2019-09-26 07:06:58 +02:00
Paul Peavyhouse
46dead9ab9 Consolidating all angle2color/color2angle calculations 2019-09-25 22:02:06 -07:00
Paul Peavyhouse
e9941eaf4c Persist gradient_w & gradient_h to ext
Thought was that it would help invalidating, but it did not.
Still, it helps to clean up the code a tad.
2019-09-25 20:39:56 -07:00
Gabor Kiss-Vamosi
8ce6c32415 add symbols: NEW_LINE, SD_CARD, USB, EYE_OPEN, EYE_CLOSE 2019-09-25 11:37:56 +02:00
Gabor Kiss-Vamosi
e9b6fcd58d debug: minor fixes 2019-09-25 08:58:12 +02:00
Paul Peavyhouse
53a1188f7c Fixing create bug 2019-09-24 21:10:23 -07:00
Paul Peavyhouse
c4e9f69868 Adding lv_cpicker_set_type 2019-09-24 21:06:51 -07:00
Paul Peavyhouse
93cef9e121 Checkpoint of only **partially** working optimized invalidation :/ 2019-09-24 18:48:57 -07:00
Paul Peavyhouse
0b4e7629b8 Got most modes fully working; Rect invalidation not optimized. 2019-09-24 18:00:39 -07:00
Gabor Kiss-Vamosi
5660181b81 debug: rework asserts 2019-09-24 23:14:17 +02:00
Paul Peavyhouse
a7dc9e852c Fix Rect by using persisted gradient & preview area in touch calculation 2019-09-24 13:48:41 -07:00
Gabor Kiss-Vamosi
3dfbc5c85d create lv_bidi.c/h 2019-09-24 21:00:58 +02:00
Gabor Kiss-Vamosi
366f958e1a debug: add the basics of LV_DEBUG 2019-09-24 16:30:38 +02:00
Gabor Kiss-Vamosi
7ef624054a bidi: update list weak and neutral chars 2019-09-24 10:50:43 +02:00
Gabor Kiss-Vamosi
bddf31824c bidi: handle starting and trailing neutrals 2019-09-24 10:30:58 +02:00
Johannes Bauer
4479a22696 Fixed outdated filename in README.md (#1201)
Template header file has been renamed from lv_conf_templ.h to
lv_conf_template.h; reflect that change in the README.md.
2019-09-23 10:11:41 -04:00
Gabor Kiss-Vamosi
2c5c4abdce bidi: clean up 2019-09-23 14:24:15 +02:00
Gabor Kiss-Vamosi
62c6ede15e bidi: first attempt to get runs 2019-09-23 14:17:27 +02:00
embeddedt
bebd2dd896 Update lv_version.h to reflect new development version 2019-09-21 07:02:34 -04:00
Gabor Kiss-Vamosi
6d81b453b3 Merge branch 'master' into dev-6.1 2019-09-20 16:31:33 +02:00
Gabor Kiss-Vamosi
9f978cb087 lv_ta: copy fixes 2019-09-20 16:31:12 +02:00
Gabor Kiss-Vamosi
1439877958 lv_bar: indicator draw fixes 2019-09-20 15:36:08 +02:00
Gabor Kiss-Vamosi
a67463db5b lv_bar: mask the gradient indicators 2019-09-20 11:03:13 +02:00
Gabor Kiss-Vamosi
2c5dd5f3eb lv_tabview: calculate with paddings 2019-09-20 10:57:20 +02:00
Gabor Kiss-Vamosi
87c3296d92 lv_kb: use LV_SYMBOL_BACKSPACE 2019-09-20 07:52:13 +02:00
Gabor Kiss-Vamosi
f341ad9b60 use FontAwesome v5 and add Backspace and Paste symbols 2019-09-20 07:52:13 +02:00
Themba Dube
e4bcade975 Merge remote-tracking branch 'origin/master' into dev-6.1 2019-09-19 09:01:25 -04:00
Gabor Kiss-Vamosi
fc88148e52 scroll prop fixes 2019-09-19 14:58:07 +02:00
embeddedt
cf1fed89e0 Make lv_ta_get_placeholder_text do what it says
Thanks to @TridentTD on the forum for reporting this: https://forum.littlevgl.com/t/bug-at-textareas-lv-ta-get-placeholder-text/707
2019-09-19 08:56:16 -04:00
Paul Peavyhouse
305ac5ff69 Got invalidation working 2019-09-18 21:37:18 -07:00
Paul Peavyhouse
fc1b5c682d Mostly working except for [I think] invalidation; refactoring a bit 2019-09-18 21:23:56 -07:00
Paul Peavyhouse
b67f40ed39 Got the gradient to draw and background honor theme 2019-09-18 17:22:16 -07:00
Paul Peavyhouse
12ee870e2c Got the center button to draw, albeit seems like the wrong color 2019-09-18 15:14:23 -07:00
Paul Peavyhouse
7f565f419a Initial commit of porting @AloyseTech's color picker from lvgl v5 to v6 2019-09-18 12:03:32 -07:00
Gabor Kiss-Vamosi
a79da64757 lv_page: add support to nested (chained) scroll propagation 2019-09-18 16:03:29 +02:00
Vadym Mishchuk
3dc57783ad lv_chart: add secondary Y axis and ability to reverse label order (#1194) 2019-09-18 08:44:57 -04:00
Gabor Kiss-Vamosi
9c8e0f0552 lv_win: add lv_win_set_content_size 2019-09-18 06:30:17 +02:00
Gabor Kiss-Vamosi
e523070d0f scroll propagaton reworked to use drag_parent 2019-09-17 16:07:30 +02:00
Gabor Kiss-Vamosi
c79ada1a46 scroll propagation: start to rework 2019-09-17 14:38:55 +02:00
Gabor Kiss-Vamosi
f445f1965b shadow draw: update mask to fully cover the edge of the bg 2019-09-17 05:07:50 +02:00
Gabor Kiss-Vamosi
31c628f332 update bar, slider, sw drawing 2019-09-16 10:58:28 +02:00
Gabor Kiss-Vamosi
a611160636 Merge branch 'master' into dev-6.1 2019-09-14 11:46:51 +02:00
Gabor Kiss-Vamosi
55badbd0de support disabled antialiasing 2019-09-14 11:46:25 +02:00
Gabor Kiss-Vamosi
88bda09f5f btnm: fix keyboard navigation 2019-09-14 11:24:48 +02:00
Gabor Kiss-Vamosi
f190c78195 font compression: add prefilter support 2019-09-13 15:40:12 +02:00
Gabor Kiss-Vamosi
915046d3ba add font decompression and bpp=3 support 2019-09-13 11:51:31 +02:00
Gabor Kiss-Vamosi
a031af4f1e lv_list: fix the use of last_clicked_btn 2019-09-12 16:04:11 +02:00
Gabor Kiss-Vamosi
8e5e33d746 add lv_slider_set/get_sym 2019-09-12 15:25:49 +02:00
Gabor Kiss-Vamosi
6e4364228f lv_line: update rounded line ending 2019-09-11 15:30:51 +02:00
Gabor Kiss-Vamosi
eb6e8c4563 draw line fixes
the positions weren't pixel perfect
2019-09-11 15:30:13 +02:00
Gabor Kiss-Vamosi
7d675cf1d1 add horizontal gradient main/grad_color_stop 2019-09-11 06:47:52 +02:00
Gabor Kiss-Vamosi
777094cc81 arc mask fixes 2019-09-10 13:31:29 +02:00
Gabor Kiss-Vamosi
cdcb9bebf9 draw inteface fixes 2019-09-10 08:12:10 +02:00
Gabor Kiss-Vamosi
989b2f14e8 simplify draw interface 2019-09-10 07:34:46 +02:00
Gabor Kiss-Vamosi
a296e50650 ad lv_draw_mask_map 2019-09-10 07:02:33 +02:00
Gabor Kiss-Vamosi
d0bc387c14 suppor blend modes on images 2019-09-10 06:13:08 +02:00
Gabor Kiss-Vamosi
2acbc59a46 use set_px_cb and handle image opacity 2019-09-10 05:36:11 +02:00
Gabor Kiss-Vamosi
3f484bcba0 optimize drawing 2019-09-09 06:04:49 +02:00
Gabor Kiss-Vamosi
e008af9768 darw: bugfixes 2019-09-09 05:53:40 +02:00
Gabor Kiss-Vamosi
305198f073 lv_canvas support drawing with TRUE_COLOR_APLHA and ALPHA1/2/4/8BIT 2019-09-08 15:25:20 +02:00
Gabor Kiss-Vamosi
033ed99f1f draw fixes 2019-09-07 01:23:55 +02:00
Gabor Kiss-Vamosi
4e11456706 add lv_draw_mask_fade 2019-09-06 22:50:46 +02:00
Gabor Kiss-Vamosi
5a72e6356f lv_chart: add LV_CHART_AREA_FADE 2019-09-06 22:49:35 +02:00
Gabor Kiss-Vamosi
d246cc3ddb add lv_objmask object type 2019-09-06 19:53:51 +02:00
Gabor Kiss-Vamosi
60cd00f9cc add lv_design_res_t 2019-09-06 19:53:39 +02:00
Gabor Kiss-Vamosi
c8eb31af59 restructrue drawings 2019-09-06 12:24:15 +02:00
Gabor Kiss-Vamosi
2052f202eb handle blend modes 2019-09-06 09:25:08 +02:00
Gabor Kiss-Vamosi
139eb48cf6 enhanced shadow width refinement 2019-09-06 08:20:52 +02:00
Gabor Kiss-Vamosi
935348330e shadow spread fixes 2019-09-05 22:43:44 +02:00
Gabor Kiss-Vamosi
88e88d7ca7 shadow draw fixes 2019-09-05 21:44:29 +02:00
Gabor Kiss-Vamosi
41074a88b8 handle new shadow attributes 2019-09-05 21:19:32 +02:00
Gabor Kiss-Vamosi
424ece6628 add style.body.shadow.offset/spread/opa attributes 2019-09-05 20:52:04 +02:00
Gabor Kiss-Vamosi
a51ffce1b4 add enhanced shadow drawing option 2019-09-05 16:28:12 +02:00
Gabor Kiss-Vamosi
de596cef45 rect draw fixes 2019-09-05 14:29:35 +02:00
Gabor Kiss-Vamosi
eefd9c4e0d lv_table: fix crash on copy in lv_table_create 2019-09-04 16:07:05 +02:00
Gabor Kiss-Vamosi
ffd4708ac3 Remove survey 2019-09-04 15:58:05 +02:00
Gabor Kiss-Vamosi
80280557c6 optimize shadow drawing 2019-09-04 15:39:39 +02:00
Gabor Kiss-Vamosi
0497575b9c improve shadow drawing 2019-09-04 07:35:33 +02:00
embeddedt
49c2bbedbb Fix alpha indexed images with 1 bit color depth (#1184) 2019-09-03 13:53:56 -04:00
Deon Marais
8efba76073 Make sin table constant in lv_math.c (#1185) 2019-09-01 09:19:14 -04:00
Gabor Kiss-Vamosi
78125b66db Update lv_version.h 2019-08-30 10:59:04 +02:00
Gabor Kiss-Vamosi
b273e1a7e6 shadow draw experiments 2019-08-29 19:01:38 +02:00
Gabor Kiss-Vamosi
f15bd1c59b Merge pull request #1183 from tgillbe/dev-6.1
Add transparency support to indexed images
2019-08-29 15:32:18 +02:00
Gabor Kiss-Vamosi
e4d7626ca2 lv_blend_fill simplify API + shadow drawing experiments 2019-08-29 10:07:22 +02:00
Gabor Kiss-Vamosi
3cbc86fedb lv_sqrt: extend lookup table to 1024 2019-08-29 05:34:52 +02:00
Themba Dube
2a4ba5042e Merge branch 'dev-6.1' of github.com:littlevgl/lvgl into dev-6.1 2019-08-28 18:53:48 -04:00
Themba Dube
b1047f4b59 ddlist: move arrow to other side if right alignment is used 2019-08-28 18:53:30 -04:00
Gabor Kiss-Vamosi
cfc5260912 draw rect optimization 2019-08-28 16:33:05 +02:00
tgillbe
54a9ea6179 Action review comments 2019-08-28 15:07:17 +01:00
tgillbe
1ff1e31ed8 Add transparency support to indexed images 2019-08-28 14:24:17 +01:00
HarryManderTait
74d5ac5553 lv_preload: add constant-speed loader (#1181) 2019-08-28 08:01:50 -04:00
Gabor Kiss-Vamosi
3d72e3915b add arc drawing 2019-08-28 09:46:56 +02:00
Themba Dube
cfc86713ce Merge remote-tracking branch 'origin/master' into dev-6.1 2019-08-27 17:33:51 -04:00
Gabor Kiss-Vamosi
63935d283d add mask handling to images and letters 2019-08-27 15:16:05 +02:00
Gabor Kiss-Vamosi
d319ce78a6 darw img optimization 2019-08-27 07:05:51 +02:00
Gabor Kiss-Vamosi
26d71383b2 img draw add alpha and chroma key support 2019-08-27 06:11:33 +02:00
Gabor Kiss-Vamosi
3eb06252e9 indev: fix lv_indev_enable 2019-08-26 09:05:30 +02:00
Gabor Kiss-Vamosi
a5d89e6ece Merge pull request #1179 from explora26/fix_readme
Fix the read input device example in README.md
2019-08-26 07:36:02 +02:00
Harry Jiang
c0180b05b4 Fix the read input device example in README.md 2019-08-26 13:28:04 +08:00
Gabor Kiss-Vamosi
50859a9660 letter draw optimization: draw multiple lines at once 2019-08-26 07:18:08 +02:00
Gabor Kiss-Vamosi
68ded834bb new letter draw 2019-08-26 06:13:28 +02:00
Gabor Kiss-Vamosi
6b4db6e9fc mask and blend fixes 2019-08-26 05:06:49 +02:00
Gabor Kiss-Vamosi
3b54976227 update line daraw with 2d blend 2019-08-24 16:35:25 +02:00
Gabor Kiss-Vamosi
35607533b0 border draw optimization 2019-08-24 15:59:19 +02:00
Gabor Kiss-Vamosi
248c3a51ea btnm: fix padding.bottom handling 2019-08-24 10:15:15 +02:00
Gabor Kiss-Vamosi
85507c4af4 add 2d blending 2019-08-23 10:53:38 +02:00
Gabor Kiss-Vamosi
9b5e84eaca lv_sqrt: fix look up table 2019-08-22 16:17:43 +02:00
Gabor Kiss-Vamosi
801bff7a41 mask fixes 2019-08-22 15:23:53 +02:00
embeddedt
94c95bc9e4 lv_table: fix memory leak when deleted (#1178) 2019-08-21 09:53:55 -04:00
Gabor Kiss-Vamosi
1b5b2bfb4f add real draw functions 2019-08-21 15:44:35 +02:00
seyyah
941409f3f9 docs/CODING_STYLE.md: add src prefix to path (#1174) 2019-08-19 09:24:06 -04:00
Themba Dube
7ea67301d7 Fix off-by-one error in lv_label_set_text_fmt 2019-08-18 16:00:57 -04:00
Themba Dube
d5d8eb5afd Merge remote-tracking branch 'origin/master' into dev-6.1 2019-08-18 15:25:59 -04:00
Gabor Kiss-Vamosi
82e3ee3e76 mask fixes 2019-08-17 16:32:06 +02:00
Gabor Kiss-Vamosi
459bd81695 angle mask experiemnts 2019-08-16 22:37:34 +02:00
Gabor Kiss-Vamosi
bbb0d2f60e lv_roller: fix misalignment when an other obj is cliked while rolling 2019-08-16 16:43:05 +02:00
Gabor Kiss-Vamosi
71e950614f roller, ddlist and lv_label_get_letter_on fixes 2019-08-16 13:43:39 +02:00
Gabor Kiss-Vamosi
c23bdeca90 mask: performance improvments 2019-08-16 08:01:12 +02:00
Gabor Kiss-Vamosi
0840f6c867 angle mask start to implement 2019-08-16 07:54:32 +02:00
embeddedt
c35c84c7d0 Guard uses of antialiasing option with LV_ANTIALIAS 2019-08-15 09:24:22 -04:00
Gabor Kiss-Vamosi
0be096295b radius mask: bug fixes 2019-08-15 06:49:16 +02:00
Gabor Kiss-Vamosi
688f8ee682 radius mask: both sides works 2019-08-14 22:20:05 +02:00
Gabor Kiss-Vamosi
aa092bc353 radius mask: left side works 2019-08-14 22:09:56 +02:00
Gabor Kiss-Vamosi
8d7c9315cb line mask: optimization to avoid division 2019-08-14 16:02:06 +02:00
Gabor Kiss-Vamosi
b1d4d6faef line mask: support all direction and inversion 2019-08-14 11:06:04 +02:00
Gabor Kiss-Vamosi
9b91dc057e line_mask anti-alaising fixes 2019-08-13 17:39:15 +02:00
Gabor Kiss-Vamosi
0aa19da0c7 draw: line mask support all directions 2019-08-13 16:36:56 +02:00
Gabor Kiss-Vamosi
607bd3e31b draw: start line mask 2019-08-13 06:14:38 +02:00
Themba Dube
49afd3f46c Merge branch 'master' into dev-6.1 2019-08-11 12:58:34 -04:00
Gabor Kiss-Vamosi
7c90b84560 Update README.md 2019-08-07 09:42:02 +02:00
Gabor Kiss-Vamosi
5e8a3e180e Update README.md 2019-08-07 09:41:01 +02:00
Gabor Kiss-Vamosi
18eb517cff Update README.md 2019-08-07 09:39:35 +02:00
embeddedt
d4a22cb713 PlatformIO needs 6.0.2 in library.json 2019-08-06 09:33:05 -04:00
Themba Dube
ba1fba1f10 Add lv_label_set_text_fmt 2019-08-06 09:28:50 -04:00
Themba Dube
e53a30381a Merge branch 'master' into dev-6.1 2019-08-06 09:13:27 -04:00
embeddedt
9a69d142fe Update library.json 2019-08-06 08:58:15 -04:00
embeddedt
677e25397b Prevent chart contents from being drawn outside margin (#1169) 2019-08-06 08:47:45 -04:00
Themba Dube
5c735c0fc8 Do not add right padding to calendar label's x1 coordinate 2019-08-05 14:22:37 -04:00
Themba Dube
bdce05e20f Merge branch 'master' into dev-6.1 2019-08-05 13:55:16 -04:00
Themba Dube
7f653e6924 Merge branch 'master' of github.com:littlevgl/lvgl 2019-08-05 13:53:23 -04:00
Themba Dube
22aee91fc2 Fix two issues with keyboard
* Duplicate characters on long press
* Certain keys on the numeric keyboard were not auto-repeating
2019-08-05 13:52:39 -04:00
Jan Van Winkel
ebb29f09fb Corrected warning in theme material (#1168)
Corrected warning for unused variable hue2 in the function style_mod_edit of
the material theme in case color depth = 1.
2019-08-05 08:46:48 -04:00
Brian Pugh
d845cd73b0 Fix compiler warnings in lv_draw_img.c (#1166) 2019-08-04 12:33:46 -04:00
Gabor Kiss-Vamosi
1efff93dda draw_line: fix skew line draw error 2019-08-01 21:01:02 +02:00
Gabor Kiss-Vamosi
17111843a0 fonts: add missing symbols 2019-07-31 12:31:21 +02:00
embeddedt
1f4f333a01 Add library.json 2019-07-30 08:24:26 -04:00
embeddedt
3eeb104463 Update bug-report.md 2019-07-29 12:20:06 -04:00
Gabor Kiss-Vamosi
6bb86f0963 fix typo in comment 2019-07-29 16:19:30 +02:00
Gabor Kiss-Vamosi
8ad5aa36dd lv_label: disable hint on 'LV_LABEL_LONG_TXT_HINT 0' 2019-07-29 16:00:59 +02:00
Gabor Kiss-Vamosi
ec63826d53 lv_draw_label: fix hint 2019-07-29 15:56:20 +02:00
Gabor Kiss-Vamosi
ff853105d9 Revert "font: add const to lv_font_fmt_txt_dsc_t"
This reverts commit 8361a9c23d.
2019-07-29 15:42:54 +02:00
Gabor Kiss-Vamosi
8361a9c23d font: add const to lv_font_fmt_txt_dsc_t 2019-07-29 15:09:21 +02:00
Gabor Kiss-Vamosi
f5dca830c4 add relative include path for lvgl.h in built-in fonts 2019-07-29 14:06:39 +02:00
Gabor Kiss-Vamosi
6a65f6e5d9 add const in arrays of unscii font 2019-07-29 12:26:00 +02:00
Gabor Kiss-Vamosi
4f0393f704 font: make some arrays const 2019-07-29 12:20:55 +02:00
Gabor Kiss-Vamosi
7a73cb00a5 fix display_template example 2019-07-29 11:00:28 +02:00
Gabor Kiss-Vamosi
786e793634 theme_material: improve group style mod funvtions 2019-07-27 17:40:20 +02:00
Gabor Kiss-Vamosi
a9ec60b5cd lv_theme_nigh: update list button's style 2019-07-26 20:35:58 +02:00
Gabor Kiss-Vamosi
3cfe72c0fb lv_calendar_get_pressed_date: return NULL if not date pressed 2019-07-26 13:23:19 +02:00
Gabor Kiss-Vamosi
a4c6d511b7 theme_material: bar, slider, sw padding fixes 2019-07-26 13:22:55 +02:00
Gabor Kiss-Vamosi
fd6d7119f5 indev: seng LV_EVENT_CLICK on if the object is not dragged 2019-07-26 13:22:09 +02:00
Gabor Kiss-Vamosi
0ab5e6e65c theme zen: make scrollbar thinner 2019-07-25 11:36:42 +02:00
Gabor Kiss-Vamosi
6d2bbf2862 lv_canvas: disable anti alaising when drawing with transparent color to chroma keyed canvas 2019-07-25 11:36:42 +02:00
Themba Dube
2093b43045 Add LV_FS_MAX_PATH_LENGTH 2019-07-24 12:25:48 -04:00
Gabor Kiss-Vamosi
ebeeb28e85 Merge pull request #1159 from joltwallet/long_txt_6_1_clean
lv_txt.c long word text wrapping initial commit (refactor).
2019-07-24 06:12:30 +02:00
Gabor Kiss-Vamosi
5a9904fa12 lv_txt_get_next_line: step at least one to avoid infinite loops 2019-07-24 06:07:20 +02:00
Gabor Kiss-Vamosi
28505b09e6 update lv_conf_checker.h 2019-07-24 06:06:41 +02:00
Brian Pugh
29b145ffb2 lv_txt.c long word text wrapping initial commit (refactor). 2019-07-23 09:19:14 -07:00
embeddedt
bf2453ce0e Merge pull request #1158 from engSinteck/master
fix comment
2019-07-23 10:12:26 -04:00
rinaldo
c519b73ae2 fix comment 2019-07-23 10:52:53 -03:00
Gabor Kiss-Vamosi
5d44e66d42 format comments 2019-07-23 08:23:33 +02:00
Gabor Kiss-Vamosi
04be7cc6a6 kb: fix kb_ctrl_spec_map 2019-07-22 15:30:50 +02:00
Gabor Kiss-Vamosi
3977a33ac4 Merge branch 'master' into dev-6.1 2019-07-22 06:30:26 +02:00
Gabor Kiss-Vamosi
c5f69ca3b1 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-22 06:30:07 +02:00
Gabor Kiss-Vamosi
aa2f70fabc add lv_printf 2019-07-22 06:29:58 +02:00
Gabor Kiss-Vamosi
465bd3edd9 lv_list: fix comment 2019-07-22 06:29:34 +02:00
Gabor Kiss-Vamosi
639409b881 Merge pull request #1156 from vanwinkeljan/fix_disp_lv_inv_area
Pass disp->driver to rounder_cb in lv_inv_area
2019-07-20 06:27:01 +02:00
Jan Van Winkel
9401353ccb Pass disp->driver to rounder_cb in lv_inv_area
Pass pointer to disp->driver to rounder_cb in lv_inv_area instead of
pointer to disp_refr->driver as lv_inv_area is called when no refresh is
ongoing (lv_disp_drv_register).

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-07-19 18:07:50 +02:00
Gabor Kiss-Vamosi
196da100b1 Update README.md 2019-07-19 12:09:55 +02:00
Gabor Kiss-Vamosi
24c17a9e5f Update README.md 2019-07-19 11:08:08 +02:00
Gabor Kiss-Vamosi
d1bc187ec6 Update README.md 2019-07-19 08:10:50 +02:00
Gabor Kiss-Vamosi
884b0b8025 Update README.md 2019-07-19 08:07:53 +02:00
Gabor Kiss-Vamosi
9f333d50d7 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-17 12:44:08 +02:00
Gabor Kiss-Vamosi
1c859fc3d6 lv_page: propagate the DRAG_START/END events too from scrollable to the bancground 2019-07-17 12:43:50 +02:00
Gabor Kiss-Vamosi
cd0d311531 fix sending of DRAG_BEGIN/END siganls and events 2019-07-17 12:43:10 +02:00
Gabor Kiss-Vamosi
33b4072138 Update CONTRIBUTING.md 2019-07-16 20:57:08 +02:00
Gabor Kiss-Vamosi
da3785240a Create CODING_STYLE.md 2019-07-16 20:53:43 +02:00
Gabor Kiss-Vamosi
ea00b24cdf add LV_STYLE_CREATE 2019-07-15 15:01:50 +02:00
Gabor Kiss-Vamosi
d7fd9eca35 Merge branch 'master' into dev-6.1 2019-07-15 14:56:55 +02:00
embeddedt
27db08eb23 Merge pull request #1151 from sie0x01/master
Fix header color format check in lv_img_decoder_built_in_info
2019-07-14 17:16:20 -04:00
Alexander Siebert
93357446a4 Fix header color format check in lv_img_decoder_built_in_info 2019-07-14 21:26:19 +02:00
Themba Dube
f55abd4e97 Merge remote-tracking branch 'origin/master' into dev-6.1 2019-07-13 21:27:18 -04:00
Gabor Kiss-Vamosi
a421547774 Merge pull request #1144 from BigHeadCreations/master
Fix typos
2019-07-10 15:05:01 +02:00
Gabor Kiss-Vamosi
4a036d8c28 declare lv_font_fmt_txt_cmap_type_t as uint8_t
it causes issue if the bitfield ar interpreted as signed
2019-07-10 14:51:59 +02:00
Timothy Pearson
362378b4e4 Fix typos 2019-07-10 11:56:36 +02:00
Themba Dube
0c8794d557 Merge branch 'master' into dev-6.1 2019-07-09 16:22:02 -04:00
Gabor Kiss-Vamosi
2cead48cd5 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-09 15:38:06 +02:00
Gabor Kiss-Vamosi
5312875972 LV_LAYOUT_GRID: fix 2019-07-09 15:37:50 +02:00
Gabor Kiss-Vamosi
fca1a1d434 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-09 08:19:26 +02:00
Gabor Kiss-Vamosi
1618930f9b update the fs porting example 2019-07-09 08:19:14 +02:00
Gabor Kiss-Vamosi
014850e73a make lv_fs_get_drv public 2019-07-09 08:18:58 +02:00
Gabor Kiss-Vamosi
1a7e7ef125 Merge pull request #1140 from C47D/horizontal_list
lv_list: Add list layout, implements #1138
2019-07-09 06:52:15 +02:00
embeddedt
f984c35875 Merge pull request #1141 from Jason-Cooke/patch-1
docs: fix typo
2019-07-08 17:38:31 -04:00
Jason Cooke
dec310a78d docs: fix typo 2019-07-09 09:34:46 +12:00
Gabor Kiss-Vamosi
a568a131d6 list: set/get lyout directly, not store in 'ext' 2019-07-08 17:24:30 +02:00
Gabor Kiss-Vamosi
5f9324cec5 Merge branch 'horizontal_list' of https://github.com/C47D/lvgl into C47D-horizontal_list 2019-07-08 17:18:29 +02:00
Gabor Kiss-Vamosi
40c86ea34e color_mix_2_alpha fixes 2019-07-08 13:10:16 +02:00
Gabor Kiss-Vamosi
df91d5bcad add lv_async to makefile 2019-07-08 13:02:48 +02:00
Gabor Kiss-Vamosi
2f29a9f361 fix compiler errors 2019-07-08 13:00:27 +02:00
Gabor Kiss-Vamosi
7bacac488e theme: solve warnings when some object types are disabled 2019-07-08 12:51:47 +02:00
Gabor Kiss-Vamosi
e792352f45 disable color_mix_2_alpha if no used 2019-07-08 12:51:12 +02:00
C47D
b4b4c764a3 [lv_list] Replace lv_list_layout_t with lv_layout_t 2019-07-07 23:41:03 -05:00
C47D
1dfded27d4 [lv_list] Set vertical layout as default 2019-07-07 18:50:35 -05:00
C47D
3654253472 [lv_list] Fix comments and add implementation of list layout 2019-07-07 13:30:19 -05:00
C47D
95149e466f [lv_list] Add list layout prototypes 2019-07-07 12:17:06 -05:00
Themba Dube
1d53e5eaec Move lv_obj_del_async to lv_obj.h 2019-07-06 15:48:18 -04:00
embeddedt
91f8755690 Rename async header guards
Co-Authored-By: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2019-07-06 15:47:43 -04:00
Themba Dube
5ae4b62f4d Initial addition of asynchronous callbacks 2019-07-06 15:47:36 -04:00
Themba Dube
8e9764532d Add unscii to lv_font.mk 2019-07-05 14:33:00 -04:00
Gabor Kiss-Vamosi
03f18260a9 lv_img_decoder_close: fix if closed after error 2019-07-05 15:16:02 +02:00
Gabor Kiss-Vamosi
9023588fef make the built-in image decoders public 2019-07-05 15:06:01 +02:00
Gabor Kiss-Vamosi
89bc24a7d9 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-05 07:49:01 +02:00
Gabor Kiss-Vamosi
f66b21433c Merge branch 'dev-6.1' of https://github.com/littlevgl/lvgl into dev-6.1 2019-07-05 07:48:22 +02:00
Gabor Kiss-Vamosi
c021de5968 lv_obj_set_opa_scale: update comment 2019-07-05 07:19:09 +02:00
Gabor Kiss-Vamosi
2dce4407c7 add LV_FONT_FMT_TXT_LARGE to support very large fonts 2019-07-05 06:11:49 +02:00
embeddedt
6989a9c797 Upgrade README button example to 6.0 2019-07-04 19:05:03 -04:00
Gabor Kiss-Vamosi
471ff8a5b5 Merge pull request #1128 from littlevgl/lv_img_buf_alloc
[v6.1] Add lv_img_buf_alloc and lv_img_buf_free functions
2019-07-04 06:39:14 +02:00
Themba Dube
55740d2a96 Move lv_img_buf_get_img_size to C file instead of inlining 2019-07-03 09:47:08 -04:00
Gabor Kiss-Vamosi
6c59216b46 Replace uintptr_t with lv_uintptr_t
uintptr_t is not supported by the 16 bit PIC's compiler (e.g. dsPIC33)
2019-07-03 10:07:12 +02:00
Gabor Kiss-Vamosi
3a8a004e8b Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-03 06:54:15 +02:00
Gabor Kiss-Vamosi
a78d0489f5 with line draw out ouf mask test 2019-07-03 06:54:10 +02:00
embeddedt
507c220d3f Merge pull request #1131 from pabigot/pr/20190702
lv_img_cache: fix buffer overrun
2019-07-02 19:18:24 -04:00
Peter A. Bigot
f2f024b610 lv_img_cache: fix buffer overrun
Reset the cache entry, not the pointer to the cache entry.
2019-07-02 17:59:28 -05:00
Gabor Kiss-Vamosi
4f77d8fc1a Update memory usage 2019-07-03 00:46:53 +02:00
Gabor Kiss-Vamosi
3eb14e198a Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-03 00:14:26 +02:00
Gabor Kiss-Vamosi
63b070164f use relative include path in built-in files 2019-07-03 00:10:38 +02:00
Gabor Kiss-Vamosi
6eb9975966 add LV_LOG_LEVEL_NONE 2019-07-03 00:10:19 +02:00
Gabor Kiss-Vamosi
0f24ef3666 lv_conf_template.h updates 2019-07-03 00:05:24 +02:00
Gabor Kiss-Vamosi
50d134fa8c remove user data set get from anims to allow LV_USE_USER_DATA 0 2019-07-03 00:05:12 +02:00
embeddedt
5b9d969fa4 Fix Flash memory estimate 2019-07-02 14:34:15 -04:00
Themba Dube
27155720d5 Switch from size_t to uint32_t 2019-07-02 14:26:52 -04:00
embeddedt
90a3edd218 Fix typo in README.md 2019-07-01 21:45:40 -04:00
Themba Dube
9ad51e529e Add API for retrieving raw image bitmap size 2019-07-01 21:38:01 -04:00
embeddedt
0dde2937d7 Merge pull request #1130 from amirgon/master
Add missing gc root
2019-07-01 18:18:05 -04:00
Amir Gonnen
b0870156c8 Merge branch 'dev-6.0' 2019-07-02 00:32:36 +03:00
Amir Gonnen
f7b8e5d415 Add missing gc root 2019-07-02 00:31:50 +03:00
Gabor Kiss-Vamosi
7b0b28f5a7 Merge branch 'master' of https://github.com/littlevgl/lvgl 2019-07-01 07:08:54 +02:00
Gabor Kiss-Vamosi
38cbc2fdea Update README.md 2019-07-01 06:23:34 +02:00
Themba Dube
28e321f223 Add lv_img_buf_alloc and lv_img_buf_free functions 2019-06-30 22:05:28 -04:00
embeddedt
86c28355ab Update links in README.md 2019-06-30 09:31:01 -04:00
309 changed files with 197666 additions and 46425 deletions

View File

@@ -1,97 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Middle
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
custom: ["https://paypal.me/littlevgl?locale.x=en_US"]

View File

@@ -7,6 +7,8 @@ assignees: ''
---
> # Important: issues that don't use this template will be ignored/closed.
**Describe the bug**
A clear and concise description of what the bug is.

14
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://docs.lvgl.io
about: Be sure to read to documentation first
- name: Forum
url: https://forum.lvgl.io
about: For how-to questions use the forum
- name: CONTIBUTING.md
url: https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md#faq-about-contributing
about: The basic rules of contributing
- name: CODING_STYLE.md
url: https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md
about: Quick summary of LVGL's code style

12
.github/auto-comment.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# Comment to a new issue.
pullRequestOpened: |
Thank you for raising your pull request.
To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin).
The text of DCO can be read here: https://developercertificate.org/
For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site.
By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO.
No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment.

17
.github/workflows/ccpp.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: C/C++ CI
on:
push:
branches: [ master, dev ]
pull_request:
branches: [master, dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: cd tests; python ./build.py

17
.github/workflows/merge-to-dev.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Merge master branch to dev
on:
push:
branches:
- 'master'
jobs:
merge-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge to dev branch
uses: devmasx/merge-branch@v1.1.0
with:
type: now
target_branch: 'dev'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

3
.gitignore vendored
View File

@@ -1,5 +1,8 @@
**/*.o
**/*bin
**/*.swp
**/*.swo
tags
docs/api_doc
scripts/cppcheck_res.txt
scripts/built_in_font/lv_font_*

240
CHANGELOG.md Normal file
View File

@@ -0,0 +1,240 @@
# Changelog
## v7.4.0 (planned on 01.09.2020)
*Available in the `dev` branch*
## v7.3.1 (18.08.2020)
### Bugfixes
- Fix drawing value string twice
- Rename `lv_chart_clear_serie` to `lv_chart_clear_series` and `lv_obj_align_origo` to `lv_obj_align_mid`
- Add linemeter's mirror feature again
- Fix text decor (udnerline strikethrough) with older versions of font converter
- Fix setting local style property multiple times
- Add missing background drawing and radius handling to image button
- Allow adding extra label to list buttons
- Fix crash if `lv_table_set_col_cnt` is called before `lv_table_set_row_cnt` for the first time
- Fix overflow in large image transformations
- Limit extra button click area of button matrix's buttons. With large paddings it was counter intuitive. (Gaps are mapped to button when clicked).
- Fix color picker invalidation in rectangle mode
- Init disabled days to gray color in calendar
## v7.3.0 (04.08.2020)
### New features
- Add `lv_task_get_next`
- Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object
- Add `lv_tabview_set_tab_name()` function - used to change a tab's name
- Add `LV_THEME_MATERIAL_FLAG_NO_TRANSITION` and `LV_THEME_MATERIAL_FLAG_NO_FOCUS` flags
- Reduce code size by adding: `LV_USE_FONT_COMPRESSED`, `LV_FONT_USE_SUBPX`, `LV_USE_OUTLINE`, `LV_USE_PATTERN`, `LV_USE_VALUE_STR` and applying some optimization
- Add `LV_MEMCPY_MEMSET_STD` to use standard `memcpy` and `memset`
### Bugfixes
- Do not print warning for missing glyph if its height OR width is zero.
- Prevent duplicated sending of `LV_EVENT_INSERT` from text area
- Tidy outer edges of cpicker widget.
- Remove duplicated lines from `lv_tabview_add_tab`
- btnmatrix: hadle combined states of buttons (e.g. chacked + disabled)
- textarea: fix typo in lv_textarea_set_sscrollbar_mode
- gauge: fix image needle drawing
- fix using freed memory in _lv_style_list_remove_style
## v7.2.0 (21.07.2020)
### New features
- Add screen transitions with `lv_scr_load_anim()`
- Add display background color, wallpaper and opacity. Shown when the screen is transparent. Can be used with `lv_disp_set_bg_opa/color/image()`.
- Add `LV_CALENDAR_WEEK_STARTS_MONDAY`
- Add `lv_chart_set_x_start_point()` function - Set the index of the x-axis start point in the data array
- Add `lv_chart_set_ext_array()` function - Set an external array of data points to use for the chart
- Add `lv_chart_set_point_id()` function - Set an individual point value in the chart series directly based on index
- Add `lv_chart_get_x_start_point()` function - Get the current index of the x-axis start point in the data array
- Add `lv_chart_get_point_id()` function - Get an individual point value in the chart series directly based on index
- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series
- Add `lv_chart_set_series_axis()` to assign series to primary or secondary axis
- Add `lv_chart_set_y_range()` to allow setting range of secondary y axis (based on `lv_chart_set_range` but extended with an axis parameter)
- Allow setting different font for the selected text in `lv_roller`
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the MicroPython binding
- Add `lv_theme_set_base()` to allow easy extension of built-in (or any) themes
- Add `lv_obj_align_x()` and `lv_obj_align_y()` functions
- Add `lv_obj_align_origo_x()` and `lv_obj_align_origo_y()` functions
### Bugfixes
- `tileview` fix navigation when not screen sized
- Use 14px font by default to for better compatibility with smaller displays
- `linemeter` fix conversation of current value to "level"
- Fix drawing on right border
- Set the cursor image non clickable by default
- Improve mono theme when used with keyboard or encoder
## v7.1.0 (07.07.2020)
### New features
- Add `focus_parent` attribute to `lv_obj`
- Allow using buttons in encoder input device
- Add lv_btnmatrix_set/get_align capability
- DMA2D: Remove dependency on ST CubeMX HAL
- Added `max_used` propriety to `lv_mem_monitor_t` struct
- In `lv_init` test if the the strings are UTF-8 encoded.
- Add `user_data` to themes
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
- Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality.
- Add inline function lv_checkbox_set_state(const lv_obj_t * cb, lv_btn_state_t state ) to extend the checkbox functionality.
### Bugfixes
- `lv_img` fix invalidation area when angle or zoom changes
- Update the style handling to support Big endian MCUs
- Change some methods to support big endian hardware.
- remove use of c++ keyword 'new' in parameter of function lv_theme_set_base().
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
- Fix inserting chars in text area in big endian hardware.
## v7.0.2 (16.06.2020)
### Bugfixes
- `lv_textarea` fix wrong cursor position when clicked after the last character
- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545
- Fix gestures
- Do not call `set_px_cb` for transparent pixel
- Fix list button focus in material theme
- Fix crash when the a text area is cleared with the backspace of a keyboard
- Add version number to `lv_conf_template.h`
- Add log in true double buffering mode with `set_px_cb`
- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder
- `lv_tileview`: fix if not the {0;0} tile is created first
- `lv_debug`: restructure to allow asserting in from `lv_misc` too
- add assert if `_lv_mem_buf_get()` fails
- `lv_textarea`: fix character delete in password mode
- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range
- `lv_btnm` fix sending events for hidden buttons
- `lv_gaguge` make `lv_gauge_set_angle_offset` offset the labels and needles too
- Fix typo in the API `scrllable` -> `scrollable`
- `tabview` by default allow auto expanding the page only to right and bottom (#1573)
- fix crash when drawing gradient to the same color
- chart: fix memory leak
- `img`: improve hit test for transformed images
## v7.0.1 (01.06.2020)
### Bugfixes
- Make the Microptyhon working by adding the required variables as GC_ROOT
- Prefix some internal API functions with `_` to reduce the API of LVGL
- Fix built-in SimSun CJK font
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
- Fix DMA2D usage when 32 bit images directly blended
- Fix lv_roller in infinite mode when used with encoder
- Add `lv_theme_get_color_secondary()`
- Add `LV_COLOR_MIX_ROUND_OFS` to adjust color mixing to make it compatible with the GPU
- Improve DMA2D blending
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
- `lv_chart` fix X tick drawing
- Fix vertical dashed line drawing
- Some additonal minor fixes and formattings
## v7.0.0 (18.05.2020)
### Documentation
The docs for v7 is available at https://docs.littlevgl.com/v7/en/html/index.html
### Legal changes
The name of the project is changed to LVGL and the new website is on https://lvgl.io
LVGL remains free under the same conditions (MIT license) and a company is created to manage LVGL and offer services.
### New drawing system
Complete rework of LVGL's draw engine to use "masks" for more advanced and higher quality graphical effects.
A possible use-case of this system is to remove the overflowing content from the rounded edges.
It also allows drawing perfectly anti-aliased circles, lines, and arcs.
Internally, the drawings happen by defining masks (such as rounded rectangle, line, angle).
When something is drawn the currently active masks can make some pixels transparent.
For example, rectangle borders are drawn by using 2 rectangle masks: one mask removes the inner part and another the outer part.
The API in this regard remained the same but some new functions were added:
- `lv_img_set_zoom`: set image object's zoom factor
- `lv_img_set_angle`: set image object's angle without using canvas
- `lv_img_set_pivot`: set the pivot point of rotation
The new drawing engine brought new drawing features too. They are highlighted in the "style" section.
### New style system
The old style system is replaced with a new more flexible and lightweighted one.
It uses an approach similar to CSS: support cascading styles, inheriting properties and local style properties per object.
As part of these updates, a lot of objects were reworked and the APIs have been changed.
- more shadows options: *offset* and *spread*
- gradient stop position to shift the gradient area and horizontal gradient
- `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE` blending modes
- *clip corner*: crop the content on the rounded corners
- *text underline* and *strikethrough*
- dashed vertical and horizontal lines (*dash gap*, *dash_width*)
- *outline*: a border-like part drawn out of the background. Can have spacing to the background.
- *pattern*: display and image in the middle of the background or repeat it
- *value* display a text which is stored in the style. It can be used e.g. as a lighweighted text on buttons too.
- *margin*: similar to *padding* but used to keep space outside of the object
Read the [Style](https://docs.littlevgl.com/v7/en/html/overview/style.html) section of the documentation to learn how the new styles system works.
### GPU integration
To better utilize GPUs, from this version GPU usage can be integrated into LVGL. In `lv_conf.h` any supported GPUs can be enabled with a single configuration option.
Right now, only ST's DMA2D (Chrom-ART) is integrated. More will in the upcoming releases.
### Renames
The following object types are renamed:
- sw -> switch
- ta -> textarea
- cb -> checkbox
- lmeter -> linemeter
- mbox -> msgbox
- ddlist -> dropdown
- btnm -> btnmatrix
- kb -> keyboard
- preload -> spinner
- lv_objx folder -> lv_widgets
- LV_FIT_FILL -> LV_FIT_PARENT
- LV_FIT_FLOOD -> LV_FLOOD_MAX
- LV_LAYOUT_COL_L/M/R -> LV_LAYOUT_COLUMN_LEFT/MID/RIGHT
- LV_LAYOUT_ROW_T/M/B -> LV_LAYOUT_ROW_TOP/MID/BOTTOM
### Reworked and improved object
- `dropdown`: Completely reworked. Now creates a separate list when opened and can be dropped to down/up/left/right.
- `label`: `body_draw` is removed, instead, if its style has a visible background/border/shadow etc it will be drawn. Padding really makes the object larger (not just virtually as before)
- `arc`: can draw bacground too.
- `btn`: doesn't store styles for each state because it's done naturally in the new style system.
- `calendar`: highlight the pressed datum. The used styles are changed: use `LV_CALENDAR_PART_DATE` normal for normal dates, checked for highlighted, focused for today, pressed for the being pressed. (checked+pressed, focused+pressed also work)
- `chart`: only has `LINE` and `COLUMN` types because with new styles all the others can be described. LV_CHART_PART_SERIES sets the style of the series. bg_opa > 0 draws an area in LINE mode. `LV_CHART_PART_SERIES_BG` also added to set a different style for the series area. Padding in `LV_CHART_PART_BG` makes the series area smaller, and it ensures space for axis labels/numbers.
- `linemeter`, `gauge`: can have background if the related style properties are set. Padding makes the scale/lines smaller. scale_border_width and scale_end_border_width allow to draw an arc on the outer part of the scale lines.
- `gauge`: `lv_gauge_set_needle_img` allows use image as needle
- `canvas`: allow drawing to true color alpha and alpha only canvas, add `lv_canvas_blur_hor/ver` and rename `lv_canvas_rotate` to `lv_canvas_transform`
- `textarea`: If available in the font use bullet (`U+2022`) character in text area password
### New object types
- `lv_objmask`: masks can be added to it. The children will be masked accordingly.
### Others
- Change the built-in fonts to [Montserrat](https://fonts.google.com/specimen/Montserrat) and add built-in fonts from 12 px to 48 px for every 2nd size.
- Add example CJK and Arabic/Persian/Hebrew built-in font
- Add ° and "bullet" to the built-in fonts
- Add Arabic/Persian script support: change the character according to its position in the text.
- Add `playback_time` to animations.
- Add `repeat_count` to animations instead of the current "repeat forever".
- Replace `LV_LAYOUT_PRETTY` with `LV_LAYOUT_PRETTY_TOP/MID/BOTTOM`
### Demos
- [lv_examples](https://github.com/littlevgl/lv_examples) was reworked and new examples and demos were added
### New release policy
- Maintain this Changelog for every release
- Save old major version in new branches. E.g. `release/v6`
- Merge new features and fixes directly into `master` and release a patch or minor releases every 2 weeks.
### Migrating from v6 to v7
- First and foremost, create a new `lv_conf.h` based on `lv_conf_templ.h`.
- To try the new version it suggested using a simulator project and see the examples.
- If you have a running project, the most difficult part of the migration is updating to the new style system. Unfortunately, there is no better way than manually updating to the new format.
- The other parts are mainly minor renames and refactoring as described above.

View File

@@ -1,5 +1,5 @@
MIT licence
Copyright (c) 2016 Gábor Kiss-Vámosi
Copyright (c) 2020 LVGL LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

297
README.md
View File

@@ -1,193 +1,147 @@
<h1 align="center"> LittlevGL - Open-source Embedded GUI Library</h1>
<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1>
<p align="center">
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
<a href="https://github.com/littlevgl/lvgl/releases/tag/v5.3"><img src="https://img.shields.io/badge/version-5.3-blue.svg"></a>
<br>
<img src="https://littlevgl.com/github/cover_ori_reduced_2.gif">
<img src="https://lvgl.io/assets/images/img_1.png">
</p>
<p align="center">
LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
</p>
<h4 align="center">
<a href="https://littlevgl.com">Website </a> &middot;
<a href="https://littlevgl.com/live-demo">Live demo</a> &middot;
<a href="https://docs.littlevgl.com/#PC-simulator">Simulator</a> &middot;
<a href="https://docs.littlevgl.com/">Docs</a> &middot;
<a href="https://blog.littlevgl.com/">Blog</a>
<a href="https://lvgl.io">Website </a> &middot;
<a href="https://lvgl.io/demos">Online demo</a> &middot;
<a href="https://docs.lvgl.io/">Docs</a> &middot;
<a href="https://forum.lvgl.io">Forum</a>
</h4>
<!--
<p align="center">
:star: Star the project if you like it! And share with your friends <a href="https://twitter.com/intent/tweet?text=LittlevGL%20is%20a%20free%20and%20open%20source%20embedded%20GUI%20library%20with%20easy-to-use%20graphical%20elements,%20beautiful%20visual%20effects%20and%20low%20memory%20footprint.&url=https://littlevgl.com/&hashtags=littlevgl,embedded,gui,free,opensource"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social"></a>
</p>
-->
---
### Features
* **Powerful building blocks** buttons, charts, lists, sliders, images, etc.
* **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling
* **Various input devices** touch pad, mouse, keyboard, encoder, buttons, etc.
* **Multi-language support** with UTF-8 encoding
* **Fully customizable** graphical elements
* **Hardware independent** to use with any microcontroller or display
* **Scalable** to operate with little memory (64 kB Flash, 10 kB RAM)
* **OS, External memory and GPU** supported but not required
* **Single frame buffer** operation even with advances graphical effects
* **Written in C** for maximal compatibility
* **Micropython Binding** exposes [LittlevGL API in Micropython](https://blog.littlevgl.com/2019-02-20/micropython-bindings)
* **Simulator** to develop on PC without embedded hardware
* **Tutorials, examples, themes** for rapid development
* **Documentation** and API references online
## Features
* Powerful [building blocks](https://docs.lvgl.io/latest/en/html/widgets/index.html): buttons, charts, lists, sliders, images, etc.
* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling
* Use [various input devices](https://docs.lvgl.io/latest/en/html/overview/indev.html): touchscreen, mouse, keyboard, encoder, buttons, etc.
* Use [multiple displays](https://docs.lvgl.io/latest/en/html/overview/display.html): e.g. monochrome and color display
* Hardware independent to use with any microcontroller or display
* Scalable to operate with little memory (64 kB Flash, 10 kB RAM)
* Multi-language support with UTF-8 handling, Bidirectional and Arabic script support
* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/latest/en/html/overview/style.html)
* OS, External memory and GPU are supported but not required
* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/latest/en/html/porting/display.html)
* Written in C for maximal compatibility (C++ compatible)
* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
* [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) to develop on PC without embedded hardware
* [Examples](lv_examples) and tutorials for rapid development
* [Documentation](http://docs.lvgl.io/) and API references
### Supported devices
Basically, every modern controller - which is able to drive a display - is suitable to run LittlevGL. The minimal requirements:
- **16, 32 or 64-bit** microcontroller or processor
- **&gt; 16 MHz** clock speed
- **&gt; 8 kB RAM for static data** and **&gt; 2 KB RAM for dynamic data** (graphical objects)
- **&gt; 64 kB flash** program memory
- **Optionally ~1/10 screen sized memory** for buffered drawing (on 240 × 320, 16-bit colors it's 15 kB)
## Requirements
Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are:
Just to mention some **platforms**:
- STM32F1, STM32F3, [STM32F4](https://blog.littlevgl.com/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32)
<table>
<tr>
<td> <strong>Name</strong> </td>
<td><strong>Minimal</strong></td>
<td><strong>Recommended</strong></td>
</tr>
<tr>
<td><strong>Architecture</strong></td>
<td colspan="2">16, 32 or 64 bit microcontroller or processor</td>
</tr>
<tr>
<td> <strong>Clock</strong></td>
<td> &gt; 16 MHz </td>
<td> &gt; 48 MHz</td>
</tr>
<tr>
<td> <strong>Flash/ROM</strong></td>
<td> &gt; 64 kB </td>
<td> &gt; 180 kB</td>
</tr>
<tr>
<td> <strong>Static RAM</strong></td>
<td> &gt; 2 kB </td>
<td> &gt; 4 kB</td>
</tr>
<tr>
<td> <strong>Stack</strong></td>
<td> &gt; 2 kB </td>
<td> &gt; 8 kB</td>
</tr>
<tr>
<td> <strong>Heap</strong></td>
<td> &gt; 2 kB </td>
<td> &gt; 8 kB</td>
</tr>
<tr>
<td> <strong>Display buffer</strong></td>
<td> &gt; 1 &times; <em>hor. res.</em> pixels </td>
<td> &gt; 10 &times; <em>hor. res.</em> pixels </td>
</tr>
<tr>
<td> <strong>Compiler</strong></td>
<td colspan="2"> C99 or newer </td>
</tr>
</table>
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
Just to mention some platforms:
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
- NXP Kinetis, LPC, iMX
- [Linux frame buffer](https://blog.littlevgl.com/2018-01-03/linux_fb) (/dev/fb)
- [Raspberry PI](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
- [Espressif ESP32](https://github.com/littlevgl/esp32_ili9431)
- Nordic nrf52
- Quectell M66
- NXP: Kinetis, LPC, iMX, iMX RT
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
- Nordic NRF52 Bluetooth modules
- Quectel modems
### Quick start in a simulator
The easiest way to get started with LittlevGL is to run it in a simulator on your PC without any embedded hardware.
## Get started
This list shows the recommended way of learning the library:
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes)
2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes)
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page (15 minutes)
4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes)
5. Try out some [Examples](https://github.com/lvgl/lv_examples/)
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=)
7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours)
8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage
9. If you have questions go to the [Forum](http://forum.lvgl.io/)
10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
Choose a project with your favourite IDE:
## Examples
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|-------------|-------------|---------------|-----------|------------|
| [![Eclipse](https://littlevgl.com/logo/ide/eclipse.jpg)](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [![CodeBlocks](https://littlevgl.com/logo/ide/codeblocks.jpg)](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [![VisualStudio](https://littlevgl.com/logo/ide/visualstudio.jpg)](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [![PlatformIO](https://littlevgl.com/logo/ide/platformio.jpg)](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [![QtCreator](https://littlevgl.com/logo/ide/qtcreator.jpg)](https://blog.littlevgl.com/2019-01-03/qt-creator) |
| Cross-platform<br>with SDL | Native Windows | Cross-platform<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository.
### Porting to an embedded hardware
In the most simple case you need to do these steps:
1. Copy `lv_conf_templ.h` as `lv_conf.h` next to `lvgl` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`.
2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL. **It's very important that you don't call `lv_task_handler` in the same loop.**
3. Call `lv_init()`
4. Create a buffer for LittlevGL
```c
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
```
4. Implement and register a function which can **copy a pixel array** to an area of your diplay:
```c
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.hor_res = 480; /*Set the horizontal resolution*/
disp_drv.ver_res = 320; /*Set the vertical resolution*/
disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
disp_drv.buffer = &disp_buf; /*Assign the buffer to teh display*/
lv_disp_drv_register(&disp_drv); /*Finally register the driver*/
void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
int32_t x, y;
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
set_pixel(x, y, *color_p); /* Put a pixel to the display.*/
color_p++;
}
}
lv_disp_flush_ready(disp); /* Tell you are ready with the flushing*/
}
```
5. Register a function which can **read an input device**. E.g. for a touch pad:
```c
lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
bool my_touchpad_read(lv_indev_t * indev, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
/*Save the state and save the pressed coordinate*/
data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y);
/*Set the coordinates (if released use the last pressed coordinates)*/
data->point.x = last_x;
data->point.y = last_y;
return false; /*Return `false` because we are not buffering and no more data to read*/
}
```
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. It will redraw the screen if required, handle input devices etc. **It's very important that you don't call `lv_tick_inc` in the same loop.**
For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting examples](https://github.com/littlevgl/lvgl/tree/multi-disp/lv_porting).
### Code examples
#### Create a button with a label and assign a click callback
### Button with label
```c
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 100, 50); /*Set its size*/
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_btn_set_action(btn, LV_BTN_ACTION_CLICK, btn_action);/*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
lv_res_t btn_action(lv_obj_t * btn)
...
void btn_event_cb(lv_obj_t * btn, lv_event_t event)
{
printf("Clicked\n");
return LV_RES_OK;
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
}
```
![Simple button with LittelvGL](https://littlevgl.com/github/btn1.gif)
![LVGL button with label example](https://raw.githubusercontent.com/lvgl/docs/latest/misc/simple_button_example.gif)
#### Modify the styles
```c
static lv_style_t style_btn_rel; /*A variable to store the released style*/
lv_style_copy(&style_btn_rel, &lv_style_plain); /*Initialize from a built-in style*/
style_btn_rel.body.border.color = LV_COLOR_HEX3(0x269);
style_btn_rel.body.border.width = 1;
style_btn_rel.body.main_color = LV_COLOR_HEX3(0xADF);
style_btn_rel.body.grad_color = LV_COLOR_HEX3(0x46B);
style_btn_rel.body.shadow.width = 4;
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
style_btn_rel.text.color = LV_COLOR_HEX3(0xDEF);
static lv_style_t style_btn_pr; /*A variable to store the pressed style*/
lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from the released style*/
style_btn_pr.body.border.color = LV_COLOR_HEX3(0x46B);
style_btn_pr.body.main_color = LV_COLOR_HEX3(0x8BD);
style_btn_pr.body.grad_color = LV_COLOR_HEX3(0x24A);
style_btn_pr.body.shadow.width = 2;
style_btn_pr.text.color = LV_COLOR_HEX3(0xBCD);
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the button's released style*/
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the button's pressed style*/
```
![Simple button with LittelvGL](https://littlevgl.com/github/btn2.gif)
#### Enable a fancy effect
```c
/*Add some effects when the button is clicked*/
lv_btn_set_ink_in_time(btn, 300);
lv_btn_set_ink_wait_time(btn, 100);
lv_btn_set_ink_out_time(btn, 300);
```
![Simple button with LittelvGL](https://littlevgl.com/github/btn3.gif)
#### Use LittlevGL from Micropython
### LVGL from Micropython
Learn more about [Micropython](https://docs.lvgl.io/latest/en/html/get-started/micropython.html).
```python
# Create a Button and a Label
scr = lv.obj()
@@ -200,22 +154,7 @@ label.set_text("Button")
lv.scr_load(scr)
```
Check out the [Documentation](https://docs.littlevgl.com/) for more!
## Contributing
LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosing your own project under in LVGL.
### Contributing
To ask questions please use the [Forum](https://forum.littlevgl.com).
FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
You can contribute in several ways:
- **Answer other's question** in the Forum
- **Report and/or fix bugs** using the issue tracker and in Pull-request
- **Suggest and/or implement new features** using the issue tracker and in Pull-request
- **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs)
- **Write a blog post about your experiences** learn more [here](https://github.com/littlevgl/blog)
- **Upload your project or product as a reference** to [this site](https://blog.littlevgl.com/2018-12-26/references)
Before contributing, please read [CONTRIBUTING.md](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md).
### Donate
If you are pleased with the library, found it useful, or you are happy with the support you got, please help its further development:
[![Donate](https://littlevgl.com/donate_dir/donate_btn.png)](https://littlevgl.com/donate)
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.

89
docs/CODING_STYLE.md Normal file
View File

@@ -0,0 +1,89 @@
# Coding style
## File format
Use [lv_misc/lv_templ.c](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.h)
## Naming conventions
* Words are separated by '_'
* In variable and function names use only lower case letters (e.g. *height_tmp*)
* In enums and defines use only upper case letters (e.g. *e.g. MAX_LINE_NUM*)
* Global names (API):
* starts with *lv*
* followed by module name: *btn*, *label*, *style* etc.
* followed by the action (for functions): *set*, *get*, *refr* etc.
* closed with the subject: *name*, *size*, *state* etc.
* Typedefs
* prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name`
* always end `typedef struct` and `typedef enum` type names with `_t`
* Abbreviations:
* Only words longer or equal than 6 characters can be abbreviated.
* Abbreviate only if it makes the word at least half as long
* Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button)
## Coding guide
* Functions:
* Try to write function shorter than is 50 lines
* Always shorter than 200 lines (except very straightforwards)
* Variables:
* One line, one declaration (BAD: char x, y;)
* Use `<stdint.h>` (*uint8_t*, *int32_t* etc)
* Declare variables where needed (not all at function start)
* Use the smallest required scope
* Variables in a file (outside functions) are always *static*
* Do not use global variables (use functions to set/get static variables)
## Comments
Before every function have a comment like this:
```c
/**
* Return with the screen of an object
* @param obj pointer to an object
* @return pointer to a screen
*/
lv_obj_t * lv_obj_get_scr(lv_obj_t * obj);
```
Always use `/* Something */` format and NOT `//Something`
Write readable code to avoid descriptive comments like:
`x++; /* Add 1 to x */`.
The code should show clearly what you are doing.
You should write **why** have you done this:
`x++; /*Because of closing '\0' of the string */`
Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/`
In comments use \` \` when referring to a variable. E.g. ``/*Update the value of `x_act`*/``
### Formatting
Here is example to show bracket placing and using of white spaces:
```c
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param text '\0' terminated character string. NULL to refresh with the current text.
*/
void lv_label_set_text(lv_obj_t * label, const char * text)
{ /* Main brackets of functions in new line*/
if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/
lv_obj_inv(label);
lv_label_ext_t * ext = lv_obj_get_ext(label);
/*Comment before a section */
if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/
lv_label_refr_text(label);
return;
}
...
}
```
Use 4 spaces indentation instead of tab.
You can use **astyle** to format the code. Run `code-formatter.sh` from the `scrips` folder.

View File

@@ -1,103 +1,5 @@
# Contributing to Littlev Graphics Library
# Contributing to LVGL
**Welcome! It's glad to see that you are interested in contributing to LittlevGL! There are several types of task where you can help to build a better library! Let's see how to get started!**
There are many different possibilities to join the community. If you have some time to work with us I'm sure you will find something that fits you! You can:
- answer other's questions
- report and/or fix bugs
- suggest and/or implement new features
- improve and/or translate the documentation
- write a blog post about your experiences
But first, start with the most Frequently Asked Questions.
## FAQ about contributing
### What license does my code need to be under?
Any code added to LittlevGL must be licensed under [MIT](https://choosealicense.com/licenses/mit/) or another license that is fully compatible. Contributions under other licenses are highly likely to be rejected.
If you borrow code from another project, please make sure to add their copyright notice to your contribution.
### Where do I ask questions, give feedback, or report bugs?
We use the [forum](http://forum.littlevgl.com/) for questions, feature suggestions, and discussions.
We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) to report bugs.
For both of these there are some rules:
- Be kind and friendly.
- Speak about one thing in one issue.
- Give feedback and close the issue if your question is answered.
- Explain exactly what you experience or expect. _"The button is not working"_ is not enough info to get help.
- For most issues you should send an absolute minimal code example in order to reproduce the issue. Ideally this should be easily usable in the PC simulator.
- Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post.
- If you don't get any answer in a week write a comment like "Can somebody help?". Maybe your issue wasn't noticed.
### How can I send fixes and improvements?
Merging new code happens via Pull Requests. If you are still not familiar with the Pull Requests (PR for short) here is a quick guide about them:
1. **Fork** the [lvgl repository](https://github.com/littlevgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`)
2. **Clone** the forked repository and add your updates
3. **Create a PR** on the GitHub on the page of you `lvgl` repository(`https://github.com/your_name/lvgl`) by hitting the "New pull request" button
4. **Set the base branch**. It means where you want to merge your update. Bugfixes for the last release go to `master`, new features to the actual `dev-x.y` branch.
5. **Describe** what is in the update. An example code is welcome if applicable.
Some advice:
- If you are not sure about your fix or feature it's better to open an issue first, and discuss the details there.
- Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly.
- If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_. So it's better to say don't have time to continue then saying nothing.
- Please read and follow this [guide about the coding style](https://docs.littlevgl.com/#Coding-Style-Guide)
### Where is the documentation?
You can read the documentation here: https://docs.littlevgl.com/
You can edit the documentation here: https://github.com/littlevgl/doc
### Where is the blog?
You can read the blog here: https://blog.littlevgl.com/
You can edit the blog here: https://github.com/littlevgl/blog
## So how and where can I contribute?
### Answering other's questions
It's a great way to contribute to the library if you already use it. Just go the [issue tracker](https://github.com/littlevgl/lvgl/issues), read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion.
### Reporting and/or fixing bugs
For simple bugfixes (typos, missing error handling, fixing a warning) is fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and even add the minimal code snippet.
### Suggesting and/or implementing new features
If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LittlevGL well enough. We will help you to get started.
During the implementation don't forget the [Code style guide](https://docs.littlevgl.com/#Coding-Style-Guide).
### Improving and/or translating the documentation
The documentation of LittlevGL is written in Markdown and available [here](https://github.com/littlevgl/doc) for editing. If you find some parts of the documentation obscure or insufficient just search the related `.md` file, hit the edit icon and add your updates. This way a new Pull request will be generated automatically.
If you can devote more time to improve the documentation you can translate it!
1. Just copy the English `.md` files from the root folder to `locale/LANGUAGE_CODE` (language code is e.g. DE, FR, ES etc)
2. Append the language code the end of files (e.g. Welcome_fr.md)
3. Update the filenames in `_Sidebar.md`
4. Translate the page(s) you want
5. Create a Pull request
### Writing a blog post about your experiences
Have ported LittlevGL to a new platform? Have you created a fancy GUI? Do you know a great trick?
You can share your knowledge on LittelvGL's blog! It's super easy to add your own post:
- Fork and clone the [blog repository](https://github.com/littlevgl/blog)
- Add your post in Markdown to the `_posts` folder.
- Store the images and other resources in a dedicated folder in `assets`
- Create a Pull Request
The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a webpage. You can easily [run Jekyll offline](https://jekyllrb.com/docs/) to check your post before creating the Pull request
## Summary
I hope you have taken a liking to contribute to LittelvGL. A helpful and friendly community is waiting for you! :)
Thank you for considering contributing to LVGL.
For a detailed description of contribution opportunities, please visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.

39
docs/ROADMAP.md Normal file
View File

@@ -0,0 +1,39 @@
# Roadmap
This is a summary for thenew fatures of the major releases and a collection of ideas.
This list indicates only the current intention and can be changed.
## v8
Planned to September/October 2020
- New scrolling:
- See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue.
- Remove `lv_page` and support scrolling on `lv_obj`
- Support "elastic" scrolling when scrolled in
- Support scroll chaining among any objects types (not only `lv_pages`s)
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
- Add snapping?
- Already working
- New layouts:
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
- Work in progress
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
- Work in progress
- Add new label alignment modes
- See [#1656](https://github.com/lvgl/lvgl/issues/1656)
- Remove the align parameter from `lv_canvas_draw_text`
## v9
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
## Ideas
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
- Optmize font decompression
- Switch to RGBA colors in styles
- Need coverage report for tests
- Need static analize (via coverity.io or somehing else)
- Support dot_begin and dot_middle long modes for labels

View File

@@ -0,0 +1,119 @@
#include <lvgl.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];
#if USE_LV_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
{
Serial.printf("%s@%d->%s\r\n", file, line, dsc);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.pushColors(&color_p->full, w * h, true);
tft.endWrite();
lv_disp_flush_ready(disp);
}
/*Read the touchpad*/
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
{
uint16_t touchX, touchY;
bool touched = tft.getTouch(&touchX, &touchY, 600);
if(!touched)
{
data->state = LV_INDEV_STATE_REL;
return false;
}
else
{
data->state = LV_INDEV_STATE_PR;
}
if(touchX>screenWidth || touchY > screenHeight)
{
Serial.println("Y or y outside of expected parameters..");
Serial.print("y:");
Serial.print(touchX);
Serial.print(" x:");
Serial.print(touchY);
}
else
{
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
Serial.print("Data x");
Serial.println(touchX);
Serial.print("Data y");
Serial.println(touchY);
}
return false; /*Return `false` because we are not buffering and no more data to read*/
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
lv_init();
#if USE_LV_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation(1); /* Landscape orientation */
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
tft.setTouch(calData);
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
/*Initialize the (dummy) input device driver*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
/* Try an example from the lv_examples repository
* https://github.com/lvgl/lv_examples*/
lv_ex_btn_1();
}
void loop()
{
lv_task_handler(); /* let the GUI do its work */
delay(5);
}

View File

@@ -0,0 +1,44 @@
# Example for lv_arduino using a slider
This example has the screen set to 320x480 (ILI9488), change this by altering the following lines in the main ino file:
```C
int screenWidth = 480;
int screenHeight = 320;
```
## Backlight
Change pin 32 to your preferred backlight pin using a PNP transistor (2N3906) or remove the following code and connect directly to +ve:
```C
ledcSetup(10, 5000/*freq*/, 10 /*resolution*/);
ledcAttachPin(32, 10);
analogReadResolution(10);
ledcWrite(10,768);
```
## Theme selection
Change the following to change the theme:
```C
lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
lv_theme_set_current(th);
```
## Calibration
This is using the bodmer tft_espi driver for touch. To correctly set the calibration load the calibration sketch and replace the following with your values:
```C
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
```
## Screen rotation
Check the following if you need to alter your screen rotation:
```C
tft.setRotation(3);
```

View File

@@ -0,0 +1,37 @@
# LVGL Arduino examples
LVGL can be installed via Arduino IDE Library Manager or as an .ZIP library.
It will install [lv_exmaples](https://github.com/lvgl/lv_examples) which contains a lot of examples and demos to try LVGL.
## Example
There are simple examples which use the [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library as a TFT driver to simplify testing.
To get all this to work you have to setup TFT_eSPI to work with your TFT display type via editing the `User_Setup.h` file in TFT_eSPI library folder, or by selecting your own configurtion in the `User_Setup_Select.h` file in TFT_eSPI library folder.
LVGL library has its own configuration file called `lv_conf.h`. When LVGL is installed to followings needs to be done to configure it:
1. Go to directory of the installed Arduno libraries
2. Go to `lvgl` and copy `lv_conf_template.h` as `lv_conf.h` next to the `src` folder.
3. Open `lv_conf.h` and change the first `#if 0` to `#if 1`
4. Set the resolution of your display in `LV_HOR_RES_MAX` and `LV_VER_RES_MAX`
5. Set the color depth of you display in `LV_COLOR_DEPTH`
6. Set `LV_TICK_CUSTOM 1`
## Debugging
In case of trouble there are debug informations inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug informations to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:
```c
/*Log settings*/
#define USE_LV_LOG 1 /*Enable/disable the log module*/
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
```
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to the `Serial` port @ 115200 Bd.

View File

@@ -9,7 +9,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_port_disp_templ.h"
#include "lv_port_disp_template.h"
/*********************
* DEFINES
@@ -26,8 +26,9 @@ static void disp_init(void);
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
#if LV_USE_GPU
static void gpu_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void gpu_fill(lv_color_t * dest, uint32_t length, lv_color_t color);
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color);
#endif
/**********************
@@ -53,20 +54,20 @@ void lv_port_disp_init(void)
* Create a buffer for drawing
*----------------------------*/
/* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
*
* There are three buffering configurations:
* 1. Create ONE buffer with some rows:
* LittlevGL will draw the display's content here and writes it to your display
* LVGL will draw the display's content here and writes it to your display
*
* 2. Create TWO buffer with some rows:
* LittlevGL will draw the display's content to a buffer and writes it your display.
* LVGL will draw the display's content to a buffer and writes it your display.
* You should use DMA to write the buffer's content to the display.
* It will enable LittlevGL to draw the next part of the screen to the other buffer while
* It will enable LVGL to draw the next part of the screen to the other buffer while
* the data is being sent form the first buffer. It makes rendering and flushing parallel.
*
* 3. Create TWO screen-sized buffer:
* Similar to 2) but the buffer have to be screen sized. When LittlevGL is ready it will give the
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
* whole frame to display. This way you only need to change the frame buffer's address instead of
* copying the pixels.
* */
@@ -90,7 +91,7 @@ void lv_port_disp_init(void)
/*-----------------------------------
* Register the display in LittlevGL
* Register the display in LVGL
*----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
@@ -112,10 +113,10 @@ void lv_port_disp_init(void)
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
/*Blend two color array using opacity*/
disp_drv.gpu_blend = gpu_blend;
disp_drv.gpu_blend_cb = gpu_blend;
/*Fill a memory array with a color*/
disp_drv.gpu_fill = gpu_fill;
disp_drv.gpu_fill_cb = gpu_fill;
#endif
/*Finally register the driver*/
@@ -151,7 +152,7 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp);
lv_disp_flush_ready(disp_drv);
}
@@ -163,7 +164,6 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
/*It's an example code which should be done by your GPU*/
uint32_t i;
for(i = 0; i < length; i++) {
dest[i] = lv_color_mix(dest[i], src[i], opa);
@@ -172,25 +172,19 @@ static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_colo
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color
* It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
static void gpu_fill_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color);
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color)
{
/*It's an example code which should be done by your GPU*/
uint32_t x, y;
int32_t x, y;
dest_buf += dest_width * fill_area->y1; /*Go to the first line*/
for(y = fill_area->y1; y < fill_area->y2; y++) {
for(x = fill_area->x1; x < fill_area->x2; x++) {
for(y = fill_area->y1; y <= fill_area->y2; y++) {
for(x = fill_area->x1; x <= fill_area->x2; x++) {
dest_buf[x] = color;
}
dest_buf+=dest_width; /*Go to the next line*/
}
uint32_t i;
for(i = 0; i < length; i++) {
dest[i] = color;
}
}
#endif /*LV_USE_GPU*/

View File

@@ -9,7 +9,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_port_fs_templ.h"
#include "lv_port_fs_template.h"
/*********************
* DEFINES
@@ -42,20 +42,20 @@ typedef struct {
**********************/
static void fs_init(void);
static lv_fs_res_t fs_open (void * file_p, const char * path, lv_fs_mode_t mode);
static lv_fs_res_t fs_close (void * file_p);
static lv_fs_res_t fs_read (void * file_p, void * buf, uint32_t btr, uint32_t * br);
static lv_fs_res_t fs_write(void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
static lv_fs_res_t fs_seek (void * file_p, uint32_t pos);
static lv_fs_res_t fs_size (void * file_p, uint32_t * size_p);
static lv_fs_res_t fs_tell (void * file_p, uint32_t * pos_p);
static lv_fs_res_t fs_remove (const char *path);
static lv_fs_res_t fs_trunc (void * file_p);
static lv_fs_res_t fs_rename (const char * oldname, const char * newname);
static lv_fs_res_t fs_free (uint32_t * total_p, uint32_t * free_p);
static lv_fs_res_t fs_dir_open (void * rddir_p, const char *path);
static lv_fs_res_t fs_dir_read (void * rddir_p, char *fn);
static lv_fs_res_t fs_dir_close (void * rddir_p);
static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode);
static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p);
static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos);
static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p);
static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path);
static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p);
static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname);
static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p);
static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path);
static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn);
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p);
/**********************
* STATIC VARIABLES
@@ -81,34 +81,34 @@ void lv_port_fs_init(void)
fs_init();
/*---------------------------------------------------
* Register the file system interface in LittlevGL
* Register the file system interface in LVGL
*--------------------------------------------------*/
/* Add a simple drive to open images */
lv_fs_drv_t fs_drv; /*A driver descriptor*/
memset(&fs_drv, 0, sizeof(lv_fs_drv_t)); /*Initialization*/
lv_fs_drv_t fs_drv;
lv_fs_drv_init(&fs_drv);
/*Set up fields...*/
fs_drv.file_size = sizeof(file_t);
fs_drv.letter = 'P';
fs_drv.open = fs_open;
fs_drv.close = fs_close;
fs_drv.read = fs_read;
fs_drv.write = fs_write;
fs_drv.seek = fs_seek;
fs_drv.tell = fs_tell;
fs_drv.free = fs_free;
fs_drv.size = fs_size;
fs_drv.remove = fs_remove;
fs_drv.rename = fs_rename;
fs_drv.trunc = fs_trunc;
fs_drv.open_cb = fs_open;
fs_drv.close_cb = fs_close;
fs_drv.read_cb = fs_read;
fs_drv.write_cb = fs_write;
fs_drv.seek_cb = fs_seek;
fs_drv.tell_cb = fs_tell;
fs_drv.free_space_cb = fs_free;
fs_drv.size_cb = fs_size;
fs_drv.remove_cb = fs_remove;
fs_drv.rename_cb = fs_rename;
fs_drv.trunc_cb = fs_trunc;
fs_drv.rddir_size = sizeof(dir_t);
fs_drv.dir_close = fs_dir_close;
fs_drv.dir_open = fs_dir_open;
fs_drv.dir_read = fs_dir_read;
fs_drv.dir_close_cb = fs_dir_close;
fs_drv.dir_open_cb = fs_dir_open;
fs_drv.dir_read_cb = fs_dir_read;
lv_fs_add_drv(&fs_drv);
lv_fs_drv_register(&fs_drv);
}
/**********************
@@ -125,12 +125,13 @@ static void fs_init(void)
/**
* Open a file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt)
* @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_open (void * file_p, const char * path, lv_fs_mode_t mode)
static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -159,11 +160,12 @@ static lv_fs_res_t fs_open (void * file_p, const char * path, lv_fs_mode_t mode)
/**
* Close an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with lv_ufs_open)
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_close (void * file_p)
static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -174,6 +176,7 @@ static lv_fs_res_t fs_close (void * file_p)
/**
* Read data from an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable.
* @param buf pointer to a memory block where to store the read data
* @param btr number of Bytes To Read
@@ -181,7 +184,7 @@ static lv_fs_res_t fs_close (void * file_p)
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_read (void * file_p, void * buf, uint32_t btr, uint32_t * br)
static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -192,13 +195,14 @@ static lv_fs_res_t fs_read (void * file_p, void * buf, uint32_t btr, uint32_t *
/**
* Write into a file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param buf pointer to a buffer with the bytes to write
* @param btr Bytes To Write
* @param br the number of real written bytes (Bytes Written). NULL if unused.
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_write(void * file_p, const void * buf, uint32_t btw, uint32_t * bw)
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -209,12 +213,13 @@ static lv_fs_res_t fs_write(void * file_p, const void * buf, uint32_t btw, uint3
/**
* Set the read write pointer. Also expand the file size if necessary.
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with lv_ufs_open )
* @param pos the new position of read write pointer
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_seek (void * file_p, uint32_t pos)
static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -225,11 +230,12 @@ static lv_fs_res_t fs_seek (void * file_p, uint32_t pos)
/**
* Give the size of a file bytes
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param size pointer to a variable to store the size
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_size (void * file_p, uint32_t * size_p)
static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -239,12 +245,13 @@ static lv_fs_res_t fs_size (void * file_p, uint32_t * size_p)
}
/**
* Give the position of the read write pointer
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable.
* @param pos_p pointer to to store the result
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_tell (void * file_p, uint32_t * pos_p)
static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -255,10 +262,11 @@ static lv_fs_res_t fs_tell (void * file_p, uint32_t * pos_p)
/**
* Delete a file
* @param drv pointer to a driver where this function belongs
* @param path path of the file to delete
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_remove (const char *path)
static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -269,11 +277,12 @@ static lv_fs_res_t fs_remove (const char *path)
/**
* Truncate the file size to the current position of the read write pointer
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open )
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_trunc (void * file_p)
static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -284,11 +293,12 @@ static lv_fs_res_t fs_trunc (void * file_p)
/**
* Rename a file
* @param drv pointer to a driver where this function belongs
* @param oldname path to the file
* @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
static lv_fs_res_t fs_rename (const char * oldname, const char * newname)
static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -299,12 +309,13 @@ static lv_fs_res_t fs_rename (const char * oldname, const char * newname)
/**
* Get the free and total size of a driver in kB
* @param drv pointer to a driver where this function belongs
* @param letter the driver letter
* @param total_p pointer to store the total size [kB]
* @param free_p pointer to store the free size [kB]
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_free (uint32_t * total_p, uint32_t * free_p)
static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -315,11 +326,12 @@ static lv_fs_res_t fs_free (uint32_t * total_p, uint32_t * free_p)
/**
* Initialize a 'fs_read_dir_t' variable for directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to a 'fs_read_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_open (void * rddir_p, const char *path)
static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -331,11 +343,12 @@ static lv_fs_res_t fs_dir_open (void * rddir_p, const char *path)
/**
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_read (void * rddir_p, char *fn)
static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
@@ -346,10 +359,11 @@ static lv_fs_res_t fs_dir_read (void * rddir_p, char *fn)
/**
* Close the directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_close (void * rddir_p)
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;

View File

@@ -9,7 +9,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_port_indev_templ.h"
#include "lv_port_indev_template.h"
/*********************
* DEFINES
@@ -140,14 +140,14 @@ void lv_port_indev_init(void)
/*Register a encoder input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_KEYPAD;
indev_drv.type = LV_INDEV_TYPE_ENCODER;
indev_drv.read_cb = encoder_read;
indev_encoder = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_keypad, group);` */
* `lv_indev_set_group(indev_encoder, group);` */
/*------------------
* Button
@@ -293,7 +293,7 @@ static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LittlevGL control characters according to your key definitions*/
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;

17
library.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "lvgl",
"version": "7.3.1",
"keywords": "graphics, gui, embedded, tft, lvgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository": {
"type": "git",
"url": "https://github.com/lvgl/lvgl.git"
},
"build": {
"includeDir": "."
},
"license": "MIT",
"homepage": "https://lvgl.io",
"frameworks": "*",
"platforms": "*"
}

10
library.properties Normal file
View File

@@ -0,0 +1,10 @@
name=lvgl
version=7.3.1
author=kisvegabor
maintainer=kisvegabor,embeddedt,pete-pjb
sentence=Full-featured Graphics Library for Embedded Systems
paragraph=Powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash).
category=Display
url=https://lvgl.io
architectures=*
includes=lvgl.h

View File

@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
*
* Configuration file for v7.3.1
*/
/*
@@ -25,7 +25,7 @@
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
@@ -53,7 +53,18 @@
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 100 /*[px]*/
#define LV_DPI 130 /*[px]*/
/* The the real width of the display changes some default values:
* default object sizes, layout of examples, etc.
* According to the width of the display (hor. res. / dpi)
* the displays fall in 4 categories.
* The 4th is extra large which has no upper limit so not listed here
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#define LV_DISP_SMALL_LIMIT 30
#define LV_DISP_MEDIUM_LIMIT 50
#define LV_DISP_LARGE_LIMIT 70
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
@@ -86,6 +97,10 @@ typedef int16_t lv_coord_t;
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
/* Use the standard memcpy and memset instead of LVGL's own functions.
* The standard functions might or might not be faster depending on their implementation. */
#define LV_MEMCPY_MEMSET_STD 0
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
@@ -109,7 +124,7 @@ typedef int16_t lv_coord_t;
#define LV_INDEV_DEF_DRAG_LIMIT 10
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 20
#define LV_INDEV_DEF_DRAG_THROW 10
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
@@ -119,6 +134,13 @@ typedef int16_t lv_coord_t;
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
/* Gesture threshold in pixels */
#define LV_INDEV_DEF_GESTURE_LIMIT 50
/* Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
/*==================
* Feature usage
*==================*/
@@ -132,8 +154,33 @@ typedef void * lv_anim_user_data_t;
#endif
/* 1: Enable shadow drawing*/
/* 1: Enable shadow drawing on rectangles*/
#define LV_USE_SHADOW 1
#if LV_USE_SHADOW
/* Allow buffering some shadow calculation
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer,
* where shadow size is `shadow_width + radius`
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0
#endif
/*1: enable outline drawing on rectangles*/
#define LV_USE_OUTLINE 1
/*1: enable pattern drawing on rectangles*/
#define LV_USE_PATTERN 1
/*1: enable value string drawing on rectangles*/
#define LV_USE_VALUE_STR 1
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 1
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#define LV_USE_OPA_SCALE 1
/* 1: Use image zoom and rotation*/
#define LV_USE_IMG_TRANSFORM 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 1
@@ -142,7 +189,11 @@ typedef void * lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 1
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#define LV_USE_GPU_STM32_DMA2D 0
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#define LV_GPU_DMA2D_CMSIS_INCLUDE
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
@@ -152,7 +203,14 @@ typedef void * lv_fs_drv_user_data_t;
#endif
/*1: Add a `user_data` to drivers and objects*/
#define LV_USE_USER_DATA 1
#define LV_USE_USER_DATA 0
/*1: Show CPU usage and FPS count in the right bottom corner*/
#define LV_USE_PERF_MONITOR 0
/*1: Use the functions and types from the older API if possible */
#define LV_USE_API_EXTENSION_V6 1
#define LV_USE_API_EXTENSION_V7 1
/*========================
* Image decoder and cache
@@ -178,12 +236,19 @@ typedef void * lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#define LV_BIG_ENDIAN_SYSTEM 0
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
/* Define a custom attribute to `lv_task_handler` function */
#define LV_ATTRIBUTE_TASK_HANDLER
/* Define a custom attribute to `lv_disp_flush_ready` function */
#define LV_ATTRIBUTE_FLUSH_READY
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
@@ -193,6 +258,22 @@ typedef void * lv_img_decoder_user_data_t;
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST
/* Prefix performance critical functions to place them into a faster memory (e.g RAM)
* Uses 15-20 kB extra memory */
#define LV_ATTRIBUTE_FAST_MEM
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#define LV_ATTRIBUTE_DMA
/*===================
* HAL settings
*==================*/
@@ -201,8 +282,8 @@ typedef void * lv_img_decoder_user_data_t;
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
@@ -213,34 +294,60 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
*===============*/
/*1: Enable the log module*/
#define LV_USE_LOG 1
#define LV_USE_LOG 0
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print`*/
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
/*================
* THEME USAGE
/*=================
* Debug settings
*================*/
#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
#define LV_USE_THEME_TEMPL 0 /*Just for test*/
#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/
#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/
#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/
#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/
#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/
#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */
#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0
/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 0
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
@@ -248,16 +355,37 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#define LV_FONT_ROBOTO_12 0
#define LV_FONT_ROBOTO_16 1
#define LV_FONT_ROBOTO_22 0
#define LV_FONT_ROBOTO_28 0
/* Montserrat fonts with bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
@@ -271,12 +399,69 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
*/
#define LV_FONT_CUSTOM_DECLARE
/*Always set a default font from the built-in fonts*/
#define LV_FONT_DEFAULT &lv_font_roboto_16
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/* Enables/disables support for compressed fonts. If it's disabled, compressed
* glyphs cannot be processed by the library and won't be rendered.
*/
#define LV_USE_FONT_COMPRESSED 1
/* Enable subpixel rendering */
#define LV_USE_FONT_SUBPX 1
#if LV_USE_FONT_SUBPX
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0
#endif
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_font_user_data_t;
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
/* No theme, you can apply your styles as you need
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_EMPTY 1
/*Simple to the create your theme based on it
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_TEMPLATE 1
/* A fast and impressive theme.
* Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
* */
#define LV_USE_THEME_MATERIAL 1
/* Mono-color theme for monochrome displays.
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
* texts and borders will be black and the background will be
* white. Else the colors are inverted.
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_MONO 1
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
/*=================
* Text settings
*=================*/
@@ -291,14 +476,66 @@ typedef void * lv_font_user_data_t;
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
/* Enable Arabic/Persian processing
* In these languages characters should be replaced with
* an other form based on their position in the text */
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#else /*!LV_SPRINTF_CUSTOM*/
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
* LV_OBJ SETTINGS
*==================*/
#if LV_USE_USER_DATA
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_obj_user_data_t;
/*Provide a function to free user data*/
#define LV_USE_USER_DATA_FREE 0
#if LV_USE_USER_DATA_FREE
# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/
/* Function prototype : void user_data_free(lv_obj_t * obj); */
# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/
#endif
#endif
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
@@ -306,13 +543,13 @@ typedef void * lv_obj_user_data_t;
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
* Documentation of the object types: https://docs.lvgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
@@ -323,40 +560,42 @@ typedef void * lv_obj_user_data_t;
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
#if LV_USE_BTN != 0
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
# define LV_BTN_INK_EFFECT 1
#endif
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNM 1
#define LV_USE_BTNMATRIX 1
/*Calendar (dependencies: -)*/
#define LV_USE_CALENDAR 1
#if LV_USE_CALENDAR
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#endif
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CB 1
#define LV_USE_CHECKBOX 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256
#endif
/*Container (dependencies: -*/
#define LV_USE_CONT 1
/*Color picker (dependencies: -*/
#define LV_USE_CPICKER 1
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DDLIST 1
#if LV_USE_DDLIST != 0
#define LV_USE_DROPDOWN 1
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DDLIST_DEF_ANIM_TIME 200
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_lmeter)*/
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
@@ -370,7 +609,7 @@ typedef void * lv_obj_user_data_t;
#endif
/*Keyboard (dependencies: lv_btnm)*/
#define LV_USE_KB 1
#define LV_USE_KEYBOARD 1
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
@@ -390,6 +629,10 @@ typedef void * lv_obj_user_data_t;
/*LED (dependencies: -)*/
#define LV_USE_LED 1
#if LV_USE_LED
# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/
# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/
#endif
/*Line (dependencies: -*/
#define LV_USE_LINE 1
@@ -402,10 +645,22 @@ typedef void * lv_obj_user_data_t;
#endif
/*Line meter (dependencies: *;)*/
#define LV_USE_LMETER 1
#define LV_USE_LINEMETER 1
#if LV_USE_LINEMETER
/* Draw line more precisely at cost of performance.
* Useful if there are lot of lines any minor are visible
* 0: No extra precision
* 1: Some extra precision
* 2: Best precision
*/
# define LV_LINEMETER_PRECISE 0
#endif
/*Mask (dependencies: -)*/
#define LV_USE_OBJMASK 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#define LV_USE_MBOX 1
#define LV_USE_MSGBOX 1
/*Page (dependencies: lv_cont)*/
#define LV_USE_PAGE 1
@@ -415,11 +670,11 @@ typedef void * lv_obj_user_data_t;
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#define LV_USE_PRELOAD 1
#if LV_USE_PRELOAD != 0
# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
#define LV_USE_SPINNER 1
#if LV_USE_SPINNER != 0
# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC
#endif
/*Roller (dependencies: lv_ddlist)*/
@@ -439,13 +694,13 @@ typedef void * lv_obj_user_data_t;
#define LV_USE_SPINBOX 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SW 1
#define LV_USE_SWITCH 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TA 1
#if LV_USE_TA != 0
# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#define LV_USE_TEXTAREA 1
#if LV_USE_TEXTAREA != 0
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
@@ -481,9 +736,6 @@ typedef void * lv_obj_user_data_t;
/*--END OF LV_CONF_H--*/
/*Be sure every define has a default value*/
#include "lvgl/src/lv_conf_checker.h"
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/

117
lvgl.h
View File

@@ -2,7 +2,7 @@
* @file lvgl.h
* Include all LittleV GL related headers
*/
#ifndef LVGL_H
#define LVGL_H
@@ -10,20 +10,29 @@
extern "C" {
#endif
/***************************
* CURRENT VERSION OF LVGL
***************************/
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 3
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO ""
/*********************
* INCLUDES
*********************/
#include "src/lv_version.h"
#include "src/lv_misc/lv_log.h"
#include "src/lv_misc/lv_task.h"
#include "src/lv_misc/lv_math.h"
#include "src/lv_misc/lv_async.h"
#include "src/lv_hal/lv_hal.h"
#include "src/lv_core/lv_obj.h"
#include "src/lv_core/lv_group.h"
#include "src/lv_core/lv_indev.h"
#include "src/lv_core/lv_refr.h"
#include "src/lv_core/lv_disp.h"
@@ -32,58 +41,74 @@ extern "C" {
#include "src/lv_font/lv_font.h"
#include "src/lv_font/lv_font_fmt_txt.h"
#include "src/lv_misc/lv_printf.h"
#include "src/lv_objx/lv_btn.h"
#include "src/lv_objx/lv_imgbtn.h"
#include "src/lv_objx/lv_img.h"
#include "src/lv_objx/lv_label.h"
#include "src/lv_objx/lv_line.h"
#include "src/lv_objx/lv_page.h"
#include "src/lv_objx/lv_cont.h"
#include "src/lv_objx/lv_list.h"
#include "src/lv_objx/lv_chart.h"
#include "src/lv_objx/lv_table.h"
#include "src/lv_objx/lv_cb.h"
#include "src/lv_objx/lv_bar.h"
#include "src/lv_objx/lv_slider.h"
#include "src/lv_objx/lv_led.h"
#include "src/lv_objx/lv_btnm.h"
#include "src/lv_objx/lv_kb.h"
#include "src/lv_objx/lv_ddlist.h"
#include "src/lv_objx/lv_roller.h"
#include "src/lv_objx/lv_ta.h"
#include "src/lv_objx/lv_canvas.h"
#include "src/lv_objx/lv_win.h"
#include "src/lv_objx/lv_tabview.h"
#include "src/lv_objx/lv_tileview.h"
#include "src/lv_objx/lv_mbox.h"
#include "src/lv_objx/lv_gauge.h"
#include "src/lv_objx/lv_lmeter.h"
#include "src/lv_objx/lv_sw.h"
#include "src/lv_objx/lv_kb.h"
#include "src/lv_objx/lv_arc.h"
#include "src/lv_objx/lv_preload.h"
#include "src/lv_objx/lv_calendar.h"
#include "src/lv_objx/lv_spinbox.h"
#include "src/lv_widgets/lv_btn.h"
#include "src/lv_widgets/lv_imgbtn.h"
#include "src/lv_widgets/lv_img.h"
#include "src/lv_widgets/lv_label.h"
#include "src/lv_widgets/lv_line.h"
#include "src/lv_widgets/lv_page.h"
#include "src/lv_widgets/lv_cont.h"
#include "src/lv_widgets/lv_list.h"
#include "src/lv_widgets/lv_chart.h"
#include "src/lv_widgets/lv_table.h"
#include "src/lv_widgets/lv_checkbox.h"
#include "src/lv_widgets/lv_cpicker.h"
#include "src/lv_widgets/lv_bar.h"
#include "src/lv_widgets/lv_slider.h"
#include "src/lv_widgets/lv_led.h"
#include "src/lv_widgets/lv_btnmatrix.h"
#include "src/lv_widgets/lv_keyboard.h"
#include "src/lv_widgets/lv_dropdown.h"
#include "src/lv_widgets/lv_roller.h"
#include "src/lv_widgets/lv_textarea.h"
#include "src/lv_widgets/lv_canvas.h"
#include "src/lv_widgets/lv_win.h"
#include "src/lv_widgets/lv_tabview.h"
#include "src/lv_widgets/lv_tileview.h"
#include "src/lv_widgets/lv_msgbox.h"
#include "src/lv_widgets/lv_objmask.h"
#include "src/lv_widgets/lv_gauge.h"
#include "src/lv_widgets/lv_linemeter.h"
#include "src/lv_widgets/lv_switch.h"
#include "src/lv_widgets/lv_arc.h"
#include "src/lv_widgets/lv_spinner.h"
#include "src/lv_widgets/lv_calendar.h"
#include "src/lv_widgets/lv_spinbox.h"
#include "src/lv_draw/lv_img_cache.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
#include "src/lv_api_map.h"
/**********************
* MACROS
**********************/
/** Gives 1 if the x.y.z version is supported in the current version
* Usage:
*
* - Require v6
* #if LV_VERSION_CHECK(6,0,0)
* new_func_in_v6();
* #endif
*
*
* - Require at least v5.3
* #if LV_VERSION_CHECK(5,3,0)
* new_feature_from_v5_3();
* #endif
*
*
* - Require v5.3.2 bugfixes
* #if LV_VERSION_CHECK(5,3,2)
* bugfix_in_v5_3_2();
* #endif
*
* */
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
#ifdef __cplusplus
}
#endif

16
lvgl.mk
View File

@@ -1,8 +1,10 @@
include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk
include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk
include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk
include $(LVGL_DIR)/lvgl/src/lv_font/lv_font.mk
include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk
include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk
include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core/lv_core.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal/lv_hal.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets/lv_widgets.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font/lv_font.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw/lv_draw.mk
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu/lv_gpu.mk

View File

@@ -724,7 +724,7 @@ CITE_BIB_FILES =
# messages are off.
# The default value is: NO.
QUIET = NO
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
@@ -733,14 +733,14 @@ QUIET = NO
# Tip: Turn warnings on while writing the documentation.
# The default value is: YES.
WARNINGS = YES
WARNINGS = NO
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled.
# The default value is: YES.
WARN_IF_UNDOCUMENTED = YES
WARN_IF_UNDOCUMENTED = NO
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some parameters
@@ -748,7 +748,7 @@ WARN_IF_UNDOCUMENTED = YES
# markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
WARN_IF_DOC_ERROR = NO
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return

Binary file not shown.

Binary file not shown.

Binary file not shown.

24
scripts/built_in_font/built_in_font_gen.py Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#!/usr/bin/env python3.6
import argparse
from argparse import RawTextHelpFormatter
import os
@@ -18,12 +20,17 @@ parser.add_argument('--bpp',
parser.add_argument('-r', '--range',
nargs='+',
metavar = 'start-end',
default='0x20-0x7F',
default=['0x20-0x7F,0xB0,0x2022'],
help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324')
parser.add_argument('--symbols',
nargs='+',
metavar = 'sym',
default=[''],
help=u'Symbols to include. E.g. -s ÁÉŐ'.encode('utf-8'))
parser.add_argument('--font',
metavar = 'file',
nargs='?',
default='Roboto-Regular.woff',
default='Montserrat-Medium.ttf',
help='A TTF or WOFF file')
parser.add_argument('-o', '--output',
nargs='?',
@@ -31,6 +38,8 @@ parser.add_argument('-o', '--output',
help='Output file name. E.g. my_font_20.c')
parser.add_argument('--compressed', action='store_true',
help='Compress the bitmaps')
parser.add_argument('--subpx', action='store_true',
help='3 times wider letters for sub pixel rendering')
args = parser.parse_args()
@@ -39,9 +48,12 @@ if args.compressed == False:
else:
compr = ""
#Built in symbols
syms = "61441,61448,61451,61452,61453,61457,61459,61460,61461,61465,61468,61473,61478,61479,61480,61502,61504,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62099"
if len(args.symbols[0]) != 0:
args.symbols[0] = "--symbols " + args.symbols[0]
#Run the command
cmd = "lv_font_conv {} --bpp {} --size {} --font ./Roboto-Regular.woff -r {} --font FontAwesome.ttf -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
#Built in symbols
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"
#Run the command (Add degree and bbullet symbol)
cmd = "lv_font_conv {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output)
os.system(cmd)

View File

@@ -0,0 +1,103 @@
#!/usr/bin/env python3.6
import os
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
exit()
print("Generating 12 px")
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12.c')
print("\nGenerating 14 px")
os.system("./built_in_font_gen.py --size 14 -o lv_font_montserrat_14.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_14.c')
print("\nGenerating 16 px")
os.system("./built_in_font_gen.py --size 16 -o lv_font_montserrat_16.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_16.c')
print("\nGenerating 18 px")
os.system("./built_in_font_gen.py --size 18 -o lv_font_montserrat_18.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_18.c')
print("\nGenerating 20 px")
os.system("./built_in_font_gen.py --size 20 -o lv_font_montserrat_20.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_20.c')
print("\nGenerating 22 px")
os.system("./built_in_font_gen.py --size 22 -o lv_font_montserrat_22.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_22.c')
print("\nGenerating 24 px")
os.system("./built_in_font_gen.py --size 24 -o lv_font_montserrat_24.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_24.c')
print("\nGenerating 26 px")
os.system("./built_in_font_gen.py --size 26 -o lv_font_montserrat_26.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_26.c')
print("\nGenerating 28 px")
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28.c')
print("\nGenerating 30 px")
os.system("./built_in_font_gen.py --size 30 -o lv_font_montserrat_30.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_30.c')
print("\nGenerating 32 px")
os.system("./built_in_font_gen.py --size 32 -o lv_font_montserrat_32.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_32.c')
print("\nGenerating 34 px")
os.system("./built_in_font_gen.py --size 34 -o lv_font_montserrat_34.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_34.c')
print("\nGenerating 36 px")
os.system("./built_in_font_gen.py --size 36 -o lv_font_montserrat_36.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_36.c')
print("\nGenerating 38 px")
os.system("./built_in_font_gen.py --size 38 -o lv_font_montserrat_38.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_38.c')
print("\nGenerating 40 px")
os.system("./built_in_font_gen.py --size 40 -o lv_font_montserrat_40.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_40.c')
print("\nGenerating 42 px")
os.system("./built_in_font_gen.py --size 42 -o lv_font_montserrat_42.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_42.c')
print("\nGenerating 44 px")
os.system("./built_in_font_gen.py --size 44 -o lv_font_montserrat_44.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_44.c')
print("\nGenerating 46 px")
os.system("./built_in_font_gen.py --size 46 -o lv_font_montserrat_46.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_46.c')
print("\nGenerating 48 px")
os.system("./built_in_font_gen.py --size 48 -o lv_font_montserrat_48.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_48.c')
print("\nGenerating 12 px subpx")
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12_subpx.c --bpp 4 --subpx")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12_subpx.c')
print("\nGenerating 28 px compressed")
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.c --bpp 4 --compressed")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28_compressed.c')
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
print("Generating 16 px Hebrew, Persian")
os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_dejavu_16_persian_hebrew.c')

View File

@@ -1,13 +0,0 @@
clang-format-7 -style=file ../src/lv_core/*.c -i
clang-format-7 -style=file ../src/lv_draw/*.c -i
clang-format-7 -style=file ../src/lv_hal/*.c -i
clang-format-7 -style=file ../src/lv_misc/*.c -i
clang-format-7 -style=file ../src/lv_objx/*.c -i
clang-format-7 -style=file ../src/lv_themes/*.c -i
clang-format-7 -style=file ../src/lv_core/*.h -i
clang-format-7 -style=file ../src/lv_draw/*.h -i
clang-format-7 -style=file ../src/lv_hal/*.h -i
clang-format-7 -style=file ../src/lv_misc/*.h -i
clang-format-7 -style=file ../src/lv_objx/*.h -i
clang-format-7 -style=file ../src/lv_themes/*.h -i

50
scripts/code-format.cfg Normal file
View File

@@ -0,0 +1,50 @@
--style=kr
--indent=spaces=4
--indent-classes
--indent-switches
--indent-cases
--indent-preproc-block
--indent-preproc-define
--indent-col1-comments
--pad-oper
--unpad-paren
--align-pointer=middle
--align-reference=middle
--convert-tabs
--max-code-length=120
--break-after-logical
--break-closing-braces
--attach-closing-while
--min-conditional-indent=0
--max-continuation-indent=120
--mode=c
--lineend=linux
--recursive
--suffix=none
--preserve-date
--formatted
--exclude=lv_conf_internal.h
--exclude=../src/lv_font/lv_font_montserrat_12.c
--exclude=../src/lv_font/lv_font_montserrat_14.c
--exclude=../src/lv_font/lv_font_montserrat_16.c
--exclude=../src/lv_font/lv_font_montserrat_18.c
--exclude=../src/lv_font/lv_font_montserrat_20.c
--exclude=../src/lv_font/lv_font_montserrat_22.c
--exclude=../src/lv_font/lv_font_montserrat_24.c
--exclude=../src/lv_font/lv_font_montserrat_26.c
--exclude=../src/lv_font/lv_font_montserrat_28.c
--exclude=../src/lv_font/lv_font_montserrat_30.c
--exclude=../src/lv_font/lv_font_montserrat_32.c
--exclude=../src/lv_font/lv_font_montserrat_34.c
--exclude=../src/lv_font/lv_font_montserrat_36.c
--exclude=../src/lv_font/lv_font_montserrat_38.c
--exclude=../src/lv_font/lv_font_montserrat_40.c
--exclude=../src/lv_font/lv_font_montserrat_42.c
--exclude=../src/lv_font/lv_font_montserrat_44.c
--exclude=../src/lv_font/lv_font_montserrat_46.c
--exclude=../src/lv_font/lv_font_montserrat_48.c
--exclude=../src/lv_font/lv_font_montserrat_12_subpx.c
--exclude=../src/lv_font/lv_font_montserrat_28_compressed.c
--exclude=../src/lv_font/lv_font_simsun_16_cjk.c
--exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c

1
scripts/code-format.sh Executable file
View File

@@ -0,0 +1 @@
astyle --options=code-format.cfg "../src/*.c,*.h"

View File

@@ -1,2 +1,2 @@
cppcheck --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force
cppcheck -j8 --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force

10
scripts/infer_run.sh Executable file
View File

@@ -0,0 +1,10 @@
# https://github.com/facebook/infer
#
# Install:
# VERSION=0.17.0; \
# curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux64-v$VERSION.tar.xz" \
# | sudo tar -C /opt -xJ && \
# sudoln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer
infer run -- make -j8

35
scripts/lv_conf_checker.py Normal file → Executable file
View File

@@ -1,23 +1,46 @@
#!/usr/bin/env python3
'''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
import sys
import re
if sys.version_info < (3,6,0):
print("Python >=3.6 is required", file=sys.stderr)
exit(1)
fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_checker.h", "w")
fout = open("../src/lv_conf_internal.h", "w")
fout.write(
'''/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_checker.h
* @file lv_conf_internal.h
* Make sure all the defines of lv_conf.h have a default value
**/
#ifndef LV_CONF_CHECKER_H
#define LV_CONF_CHECKER_H
#ifndef LV_CONF_INTERNAL_H
#define LV_CONF_INTERNAL_H
/* clang-format off */
#include <stdint.h>
#if defined(LV_CONF_PATH)
#define __LV_TO_STR_AUX(x) #x
#define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
#include __LV_TO_STR(LV_CONF_PATH)
#undef __LV_TO_STR_AUX
#undef __LV_TO_STR
#elif defined(LV_CONF_INCLUDE_SIMPLE)
#include "lv_conf.h"
#else
#include "../../lv_conf.h"
#endif
'''
)
@@ -34,9 +57,11 @@ for i in fin.read().splitlines():
if '/*--END OF LV_CONF_H--*/' in i: break
r = re.search(r'^ *# *define ([^\s]+).*$', i)
if r:
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
fout.write(
f'#ifndef {r[1]}\n'
f'#ifndef {line}\n'
f'{i}\n'
'#endif\n'
)

469
scripts/release.py Executable file
View File

@@ -0,0 +1,469 @@
#!/usr/bin/env python
# Release lvgl, lv_examples, lv_drivers. docs, blog and prepare the development of the next major, minoror bugfix release
# Usage: ./release,py bugfix | minor | major
# The option means what type of versin to prepare for development after release
#
# STEPS:
# - clone all 5 repos
# - get the version numnber from lvgl.h
# - set release branch (e.g. "release/v7")
# - prepare lvgl
# - run lv_conf_internal.py
# - run code formatter
# - clear LVGL_VERSION_INFO (set to "")
# - run Doxygen
# - update the version in lvgl's library.json, library.properties, lv_conf_template.h
# - update CHANGELOG.md
# - commit changes
# - prepare lv_examples
# - upadte the required LVGL version in lv_examples.h (LV_VERSION_CHECK)
# - update the version in lv_ex_conf_template.h
# - prepare lv_drivers
# - update the version in library.json, lv_drv_conf_template.h
# - prepare docs
# - update API XML
# - clear the versiopn info (should be plain vx.y.z)
# - tag all repos with the new version
# - merge to release branches
# - blog: add release post
# - push tags and commits
# - docs: run ./updade.py release/vX
#
# If --patch
# - merge master to dev branches
# - increment patch version by 1 and append "-dev". E.g. "vX.Y.(Z+1)-dev"
# - update version numbers in lvgl and docs
# - commit and push
# - docs: run ./updade.py latest dev
#
# Else (not --patch)
# - merge master to dev
# - merge the dev to master
# - increment version number like "vX.(Y+1).0-dev"
# - apply the new version in dev branches of lvgl, lv_examples, lv_drivers, docs
# - commit and push to dev branches
# - docs: run ./updade.py latest dev
import re
import os, fnmatch
import os.path
from os import path
from datetime import date
import sys
upstream_org_url = "https://github.com/lvgl/"
workdir = "./release_tmp"
ver_major = -1
ver_minor = -1
ver_patch = -1
ver_str = ""
dev_ver_str = ""
release_br = ""
release_note = ""
prepare_type = ['major', 'minor', 'bugfix']
dev_prepare = 'minor'
def upstream(repo):
return upstream_org_url + repo + ".git"
def cmd(c, exit_on_err = True):
print("\n" + c)
r = os.system(c)
if r:
print("### Error: " + str(r))
if exit_on_err: exit(int(r))
def define_set(fn, name, value):
print("In " + fn + " set " + name + " to " + value)
new_content = ""
f = open(fn, "r")
for i in f.read().splitlines():
r = re.search(r'^ *# *define +' + name, i)
if r:
d = i.split("define")
i = d[0] + "define " + name + " " + value
new_content += i + '\n'
f.close()
f = open(fn, "w")
f.write(new_content)
f.close()
def clone_repos():
cmd("rm -fr " + workdir)
cmd("mkdir " + workdir)
os.chdir(workdir)
#For debuging just copy the repos
#cmd("cp -a ../repos/. .")
#return
cmd("git clone " + upstream("lvgl") + " lvgl; cd lvgl; git checkout master")
cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master")
cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master")
cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master")
cmd("git clone " + upstream("blog") + "; cd lv_drivers; git checkout blog")
def get_lvgl_version(br):
print("Get LVGL's version")
global ver_str, ver_major, ver_minor, ver_patch, release_br
os.chdir("./lvgl")
cmd("git checkout " + br)
f = open("./lvgl.h", "r")
lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
for i in f.read().splitlines():
r = re.search(r'^#define LVGL_VERSION_MAJOR ', i)
if r:
m = lastNum.search(i)
if m: ver_major = m.group(1)
r = re.search(r'^#define LVGL_VERSION_MINOR ', i)
if r:
m = lastNum.search(i)
if m: ver_minor = m.group(1)
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
if r:
m = lastNum.search(i)
if m: ver_patch = m.group(1)
f.close()
cmd("git checkout master")
ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch)
print("New version:" + ver_str)
release_br = "release/v" + ver_major
os.chdir("../")
def update_version():
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0])
if os.path.exists("library.json"):
print("Updating version in library.json")
cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str[1:] +"/' library.json")
if path.exists("library.properties"):
print("Updating version in library.properties")
cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_str[1:] + "/' library.properties")
def lvgl_prepare():
print("Prepare lvgl")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lvgl")
define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"')
# Run some scripts
os.chdir("./scripts")
cmd("./code-format.sh")
cmd("./lv_conf_checker.py")
cmd("doxygen")
os.chdir("../")
update_version()
#update CHANGLELOG
new_content = ""
f = open("./CHANGELOG.md", "r")
global release_note
release_note = ""
note_state = 0
for i in f.read().splitlines():
if note_state == 0:
r = re.search(r'^## ' + ver_str, i)
if r:
i = i.replace("planned on ", "")
note_state+=1
elif note_state == 1:
r = re.search(r'^## ', i)
if r:
note_state+=1
else:
release_note += i + '\n'
new_content += i + '\n'
f.close()
f = open("./CHANGELOG.md", "w")
f.write(new_content)
f.close()
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def lv_examples_prepare():
print("Prepare lv_examples")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lv_examples")
update_version()
cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + ver_major + ", " + ver_minor + ", " + ver_patch + ")/' lv_examples.h")
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def lv_drivers_prepare():
print("Prepare lv_drivers")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lv_drivers")
update_version()
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def docs_prepare():
print("Prepare docs")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./docs")
cmd("git co latest --")
cmd("rm -rf xml");
cmd("cp -r ../lvgl/docs/api_doc/xml .");
cmd("git add xml");
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py")
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def blog_add_post():
global ver_str, release_note
os.chdir("./blog/_posts")
post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n"
post += release_note
today = date.today()
d = today.strftime("%Y-%m-%d")
f = open(d + "_release_" + ver_str + ".md", "w")
f.write(post)
f.close()
cmd("git add .")
cmd("git commit -am 'Add " + ver_str + " release post'")
os.chdir("../../")
def add_tags():
global ver_str
tag_cmd = " git tag -a " + ver_str + " -m 'Release " + ver_str + "' "
cmd("cd lvgl; " + tag_cmd)
cmd("cd lv_examples; " + tag_cmd)
cmd("cd lv_drivers; " + tag_cmd)
cmd("cd docs; " + tag_cmd)
def update_release_branches():
global release_br
merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge master -X ours; git push origin " + release_br + "; git checkout master"
cmd("cd lvgl; " + merge_cmd)
cmd("cd lv_examples; " + merge_cmd)
cmd("cd lv_drivers; " + merge_cmd)
merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge latest -X ours; git push origin " + release_br + "; git checkout latest"
cmd("cd docs; " + merge_cmd)
def publish_master():
pub_cmd = "git push origin master; git push origin " + ver_str
cmd("cd lvgl; " + pub_cmd)
cmd("cd lv_examples; " + pub_cmd)
cmd("cd lv_drivers; " + pub_cmd)
pub_cmd = "git push origin latest; git push origin " + ver_str
cmd("cd docs; " + pub_cmd)
cmd("cd docs; git checkout master; ./update.py " + release_br)
pub_cmd = "git push origin master"
cmd("cd blog; " + pub_cmd)
def merge_to_dev():
merge_cmd = "git checkout dev; git merge master -X ours; git checkout master"
cmd("cd lvgl; " + merge_cmd)
merge_cmd = "git checkout dev; git merge latest -X ours; git checkout master"
cmd("cd docs; " + merge_cmd)
def merge_from_dev():
merge_cmd = "git checkout master; git merge dev;"
cmd("cd lvgl; " + merge_cmd)
merge_cmd = "git checkout latest; git merge dev;"
cmd("cd docs; " + merge_cmd)
def lvgl_update_master_version():
global ver_major, ver_minor, ver_patch, ver_str
os.chdir("./lvgl")
cmd("git checkout master")
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
define_set("./lvgl.h", "LVGL_VERSION_INFO", "dev")
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0])
cmd("git commit -am 'Update version'")
os.chdir("../")
def docs_update_latest_version():
global ver_str
os.chdir("./docs")
cmd("git checkout latest --")
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py")
cmd("git commit -am 'Update version'")
cmd("git checkout master --")
os.chdir("../")
def lvgl_update_dev_version():
global ver_major, ver_minor, ver_patch, dev_ver_str
os.chdir("./lvgl")
cmd("git checkout dev")
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"")
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ dev_ver_str +"/' " + templ[0])
cmd("git commit -am 'Update dev version'")
cmd("git checkout master")
os.chdir("../")
def docs_update_dev_version():
global dev_ver_str
os.chdir("./docs")
cmd("git checkout dev --")
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + dev_ver_str + "'/\" conf.py")
cmd("git commit -am 'Update dev version'")
cmd("git checkout master --")
os.chdir("../")
def publish_dev():
pub_cmd = "git checkout dev; git push origin dev"
cmd("cd lvgl; " + pub_cmd)
pub_cmd = "git checkout dev; git push origin dev"
cmd("cd docs; " + pub_cmd)
cmd("cd docs; git checkout master; ./update.py latest dev")
def cleanup():
os.chdir("../")
cmd("rm -fr " + workdir)
if __name__ == '__main__':
if(len(sys.argv) != 2):
print("Argument error. Usage ./release.py bugfix | minor | major")
exit(1)
dev_prepare = sys.argv[1]
if not (dev_prepare in prepare_type):
print("Invalid argument. Usage ./release.py bugfix | minor | major")
exit(1)
clone_repos()
get_lvgl_version("master")
lvgl_prepare()
lv_examples_prepare()
lv_drivers_prepare()
docs_prepare()
blog_add_post()
add_tags()
update_release_branches()
publish_master()
if dev_prepare == 'bugfix':
ver_patch = str(int(ver_patch) + 1)
ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
print("Prepare bugfix version " + ver_str)
lvgl_update_master_version()
docs_update_latest_version()
get_lvgl_version("dev")
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
merge_to_dev()
lvgl_update_dev_version()
docs_update_dev_version()
publish_dev()
else:
get_lvgl_version("dev")
if dev_prepare == 'minor':
ver_minor = str(int(ver_minor) + 1)
ver_patch = "0"
else:
ver_major = str(int(ver_major) + 1)
ver_minor = "0"
ver_patch = "0"
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
print("Prepare minor version " + ver_str)
merge_to_dev()
merge_from_dev()
lvgl_update_dev_version()
docs_update_dev_version()
publish_dev()
cleanup()

237
src/lv_api_map.h Normal file
View File

@@ -0,0 +1,237 @@
/**
* @file lv_api_map.h
*
*/
#ifndef LV_API_MAP_H
#define LV_API_MAP_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/*---------------------
* V6.0 COMPATIBILITY
*--------------------*/
#if LV_USE_API_EXTENSION_V6
static inline void lv_task_once(lv_task_t * task)
{
lv_task_set_repeat_count(task, 1);
}
#if LV_USE_CHECKBOX
#define lv_checkbox_set_static_text lv_checkbox_set_text_static
#endif
#if LV_USE_CHART
#define lv_chart_get_point_cnt lv_chart_get_point_count
#endif
#if LV_USE_DROPDOWN
static inline void lv_dropdown_set_draw_arrow(lv_obj_t * ddlist, bool en)
{
if(en) lv_dropdown_set_symbol(ddlist, LV_SYMBOL_DOWN);
else lv_dropdown_set_symbol(ddlist, NULL);
}
static inline bool lv_dropdown_get_draw_arrow(lv_obj_t * ddlist)
{
if(lv_dropdown_get_symbol(ddlist)) return true;
else return false;
}
#define lv_dropdown_set_static_options lv_dropdown_set_options_static
#endif
#if LV_USE_BAR
/**
* Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum
* position.
* @param bar pointer to a bar object
* @param en true: enable disable symmetric behavior; false: disable
* @deprecated As of v7.0, you should use `lv_bar_set_type` instead.
*/
static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
{
if(en)
lv_bar_set_type(bar, LV_BAR_TYPE_SYMMETRICAL);
else
lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL);
}
/**
* Get whether the bar is symmetric or not.
* @param bar pointer to a bar object
* @return true: symmetric is enabled; false: disable
* @deprecated As of v7.0, you should use `lv_bar_get_type` instead.
*/
static inline bool lv_bar_get_sym(lv_obj_t * bar)
{
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYMMETRICAL;
}
#endif
#if LV_USE_LABEL
#define lv_label_set_static_text lv_label_set_text_static
#endif
#if LV_USE_SLIDER
/**
* Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum
* position.
* @param slider pointer to a bar object
* @param en true: enable disable symmetric behavior; false: disable
* @deprecated As of v7.0, you should use `lv_slider_set_type` instead.
*/
static inline void lv_slider_set_sym(lv_obj_t * slider, bool en)
{
lv_bar_set_sym(slider, en);
}
/**
* Get whether the slider is symmetric or not.
* @param slider pointer to a slider object
* @return true: symmetric is enabled; false: disable
* @deprecated As of v7.0, you should use `lv_slider_get_type` instead.
*/
static inline bool lv_slider_get_sym(lv_obj_t * slider)
{
return lv_bar_get_sym(slider);
}
#endif
#if LV_USE_ROLLER
/**
* Set a fixed width for the roller.
* @param roller pointer to a roller object
* @param w width
* @deprecated As of v7.0, you should use `lv_roller_set_auto_fit` and set the width normally instead.
*/
static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
{
lv_roller_set_auto_fit(roller, false);
lv_obj_set_width(roller, w);
}
#endif
#if LV_USE_PAGE
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
#define LV_SCRLBAR_MODE_ON LV_SCROLLBAR_MODE_ON
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
#define LV_SCRLBAR_MODE_UNHIDE LV_SCROLLBAR_MODE_UNHIDE
static inline void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode)
{
lv_page_set_scrollbar_mode(page, sb_mode);
}
static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page)
{
return lv_page_get_scrollbar_mode(page);
}
static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
{
return lv_page_get_scrollable(page);
}
#endif
#endif /*LV_USE_API_EXTENSION_V6*/
/*---------------------
* V7.0 COMPATIBILITY
*--------------------*/
#if LV_USE_API_EXTENSION_V7
#if LV_USE_WIN
static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
{
return lv_win_add_btn_right(win, img_src);
}
#endif
#if LV_USE_CHART
static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
{
lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax);
}
static inline void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * series)
{
lv_chart_clear_series(chart, series);
}
#endif
static inline void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs,
lv_coord_t y_ofs)
{
lv_obj_align_mid(obj, base, align, x_ofs, y_ofs);
}
static inline void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs)
{
lv_obj_align_mid_y(obj, base, align, x_ofs);
}
static inline void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs)
{
lv_obj_align_mid_y(obj, base, align, y_ofs);
}
#endif /*LV_USE_API_EXTENSION_V6*/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_API_MAP_H*/

View File

@@ -1,703 +0,0 @@
/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_checker.h
* Make sure all the defines of lv_conf.h have a default value
**/
#ifndef LV_CONF_CHECKER_H
#define LV_CONF_CHECKER_H
/* clang-format off */
#include <stdint.h>
/*====================
Graphical settings
*====================*/
/* Maximal horizontal and vertical resolution to support by the library.*/
#ifndef LV_HOR_RES_MAX
#define LV_HOR_RES_MAX (480)
#endif
#ifndef LV_VER_RES_MAX
#define LV_VER_RES_MAX (320)
#endif
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 16: RGB565
* - 32: ARGB8888
*/
#ifndef LV_COLOR_DEPTH
#define LV_COLOR_DEPTH 16
#endif
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#ifndef LV_COLOR_16_SWAP
#define LV_COLOR_16_SWAP 0
#endif
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#ifndef LV_COLOR_SCREEN_TRANSP
#define LV_COLOR_SCREEN_TRANSP 0
#endif
/*Images pixels with this color will not be drawn (with chroma keying)*/
#ifndef LV_COLOR_TRANSP
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
#endif
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#ifndef LV_ANTIALIAS
#define LV_ANTIALIAS 1
#endif
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#ifndef LV_DISP_DEF_REFR_PERIOD
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
#endif
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#ifndef LV_DPI
#define LV_DPI 100 /*[px]*/
#endif
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
/*=========================
Memory manager settings
*=========================*/
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#ifndef LV_MEM_CUSTOM
#define LV_MEM_CUSTOM 0
#endif
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
#ifndef LV_MEM_SIZE
# define LV_MEM_SIZE (32U * 1024U)
#endif
/* Complier prefix for a big array declaration */
#ifndef LV_MEM_ATTR
# define LV_MEM_ATTR
#endif
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
#ifndef LV_MEM_ADR
# define LV_MEM_ADR 0
#endif
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
#ifndef LV_MEM_AUTO_DEFRAG
# define LV_MEM_AUTO_DEFRAG 1
#endif
#else /*LV_MEM_CUSTOM*/
#ifndef LV_MEM_CUSTOM_INCLUDE
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
#endif
#ifndef LV_MEM_CUSTOM_ALLOC
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
#endif
#ifndef LV_MEM_CUSTOM_FREE
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif
#endif /*LV_MEM_CUSTOM*/
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#ifndef LV_ENABLE_GC
#define LV_ENABLE_GC 0
#endif
#if LV_ENABLE_GC != 0
#ifndef LV_GC_INCLUDE
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
#endif
#ifndef LV_MEM_CUSTOM_REALLOC
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
#endif
#ifndef LV_MEM_CUSTOM_GET_SIZE
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#ifndef LV_INDEV_DEF_READ_PERIOD
#define LV_INDEV_DEF_READ_PERIOD 30
#endif
/* Drag threshold in pixels */
#ifndef LV_INDEV_DEF_DRAG_LIMIT
#define LV_INDEV_DEF_DRAG_LIMIT 10
#endif
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#ifndef LV_INDEV_DEF_DRAG_THROW
#define LV_INDEV_DEF_DRAG_THROW 20
#endif
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#ifndef LV_INDEV_DEF_LONG_PRESS_TIME
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
#endif
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#ifndef LV_INDEV_DEF_LONG_PRESS_REP_TIME
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
#endif
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#ifndef LV_USE_ANIMATION
#define LV_USE_ANIMATION 1
#endif
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
#endif
/* 1: Enable shadow drawing*/
#ifndef LV_USE_SHADOW
#define LV_USE_SHADOW 1
#endif
/* 1: Enable object groups (for keyboard/encoder navigation) */
#ifndef LV_USE_GROUP
#define LV_USE_GROUP 1
#endif
#if LV_USE_GROUP
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#ifndef LV_USE_GPU
#define LV_USE_GPU 1
#endif
/* 1: Enable file system (might be required for images */
#ifndef LV_USE_FILESYSTEM
#define LV_USE_FILESYSTEM 1
#endif
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
#endif
/*1: Add a `user_data` to drivers and objects*/
#ifndef LV_USE_USER_DATA
#define LV_USE_USER_DATA 1
#endif
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#ifndef LV_IMG_CF_INDEXED
#define LV_IMG_CF_INDEXED 1
#endif
/* 1: Enable alpha indexed images */
#ifndef LV_IMG_CF_ALPHA
#define LV_IMG_CF_ALPHA 1
#endif
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#ifndef LV_IMG_CACHE_DEF_SIZE
#define LV_IMG_CACHE_DEF_SIZE 1
#endif
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
/*=====================
* Compiler settings
*====================*/
/* Define a custom attribute to `lv_tick_inc` function */
#ifndef LV_ATTRIBUTE_TICK_INC
#define LV_ATTRIBUTE_TICK_INC
#endif
/* Define a custom attribute to `lv_task_handler` function */
#ifndef LV_ATTRIBUTE_TASK_HANDLER
#define LV_ATTRIBUTE_TASK_HANDLER
#endif
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#ifndef LV_ATTRIBUTE_LARGE_CONST
#define LV_ATTRIBUTE_LARGE_CONST
#endif
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#ifndef LV_TICK_CUSTOM
#define LV_TICK_CUSTOM 0
#endif
#if LV_TICK_CUSTOM == 1
#ifndef LV_TICK_CUSTOM_INCLUDE
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#endif
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#endif
#endif /*LV_TICK_CUSTOM*/
/*================
* Log settings
*===============*/
/*1: Enable the log module*/
#ifndef LV_USE_LOG
#define LV_USE_LOG 1
#endif
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*/
#ifndef LV_LOG_LEVEL
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
#endif
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print`*/
#ifndef LV_LOG_PRINTF
# define LV_LOG_PRINTF 0
#endif
#endif /*LV_USE_LOG*/
/*================
* THEME USAGE
*================*/
#ifndef LV_THEME_LIVE_UPDATE
#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
#endif
#ifndef LV_USE_THEME_TEMPL
#define LV_USE_THEME_TEMPL 0 /*Just for test*/
#endif
#ifndef LV_USE_THEME_DEFAULT
#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/
#endif
#ifndef LV_USE_THEME_ALIEN
#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/
#endif
#ifndef LV_USE_THEME_NIGHT
#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/
#endif
#ifndef LV_USE_THEME_MONO
#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/
#endif
#ifndef LV_USE_THEME_MATERIAL
#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/
#endif
#ifndef LV_USE_THEME_ZEN
#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */
#endif
#ifndef LV_USE_THEME_NEMO
#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/
#endif
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
*/
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#ifndef LV_FONT_ROBOTO_12
#define LV_FONT_ROBOTO_12 0
#endif
#ifndef LV_FONT_ROBOTO_16
#define LV_FONT_ROBOTO_16 1
#endif
#ifndef LV_FONT_ROBOTO_22
#define LV_FONT_ROBOTO_22 0
#endif
#ifndef LV_FONT_ROBOTO_28
#define LV_FONT_ROBOTO_28 0
#endif
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#ifndef LV_FONT_UNSCII_8
#define LV_FONT_UNSCII_8 0
#endif
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
#ifndef LV_FONT_CUSTOM_DECLARE
#define LV_FONT_CUSTOM_DECLARE
#endif
/*Always set a default font from the built-in fonts*/
#ifndef LV_FONT_DEFAULT
#define LV_FONT_DEFAULT &lv_font_roboto_16
#endif
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#ifndef LV_TXT_ENC
#define LV_TXT_ENC LV_TXT_ENC_UTF8
#endif
/*Can break (wrap) texts on these chars*/
#ifndef LV_TXT_BREAK_CHARS
#define LV_TXT_BREAK_CHARS " ,.;:-_"
#endif
/*===================
* LV_OBJ SETTINGS
*==================*/
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
#ifndef LV_USE_OBJ_REALIGN
#define LV_USE_OBJ_REALIGN 1
#endif
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#ifndef LV_USE_EXT_CLICK_AREA
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF
#endif
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#ifndef LV_USE_ARC
#define LV_USE_ARC 1
#endif
/*Bar (dependencies: -)*/
#ifndef LV_USE_BAR
#define LV_USE_BAR 1
#endif
/*Button (dependencies: lv_cont*/
#ifndef LV_USE_BTN
#define LV_USE_BTN 1
#endif
#if LV_USE_BTN != 0
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
#ifndef LV_BTN_INK_EFFECT
# define LV_BTN_INK_EFFECT 1
#endif
#endif
/*Button matrix (dependencies: -)*/
#ifndef LV_USE_BTNM
#define LV_USE_BTNM 1
#endif
/*Calendar (dependencies: -)*/
#ifndef LV_USE_CALENDAR
#define LV_USE_CALENDAR 1
#endif
/*Canvas (dependencies: lv_img)*/
#ifndef LV_USE_CANVAS
#define LV_USE_CANVAS 1
#endif
/*Check box (dependencies: lv_btn, lv_label)*/
#ifndef LV_USE_CB
#define LV_USE_CB 1
#endif
/*Chart (dependencies: -)*/
#ifndef LV_USE_CHART
#define LV_USE_CHART 1
#endif
#if LV_USE_CHART
#ifndef LV_CHART_AXIS_TICK_LABEL_MAX_LEN
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
#endif
#endif
/*Container (dependencies: -*/
#ifndef LV_USE_CONT
#define LV_USE_CONT 1
#endif
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#ifndef LV_USE_DDLIST
#define LV_USE_DDLIST 1
#endif
#if LV_USE_DDLIST != 0
/*Open and close default animation time [ms] (0: no animation)*/
#ifndef LV_DDLIST_DEF_ANIM_TIME
# define LV_DDLIST_DEF_ANIM_TIME 200
#endif
#endif
/*Gauge (dependencies:lv_bar, lv_lmeter)*/
#ifndef LV_USE_GAUGE
#define LV_USE_GAUGE 1
#endif
/*Image (dependencies: lv_label*/
#ifndef LV_USE_IMG
#define LV_USE_IMG 1
#endif
/*Image Button (dependencies: lv_btn*/
#ifndef LV_USE_IMGBTN
#define LV_USE_IMGBTN 1
#endif
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
#ifndef LV_IMGBTN_TILED
# define LV_IMGBTN_TILED 0
#endif
#endif
/*Keyboard (dependencies: lv_btnm)*/
#ifndef LV_USE_KB
#define LV_USE_KB 1
#endif
/*Label (dependencies: -*/
#ifndef LV_USE_LABEL
#define LV_USE_LABEL 1
#endif
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
#ifndef LV_LABEL_DEF_SCROLL_SPEED
# define LV_LABEL_DEF_SCROLL_SPEED 25
#endif
/* Waiting period at beginning/end of animation cycle */
#ifndef LV_LABEL_WAIT_CHAR_COUNT
# define LV_LABEL_WAIT_CHAR_COUNT 3
#endif
/*Enable selecting text of the label */
#ifndef LV_LABEL_TEXT_SEL
# define LV_LABEL_TEXT_SEL 0
#endif
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
#ifndef LV_LABEL_LONG_TXT_HINT
# define LV_LABEL_LONG_TXT_HINT 0
#endif
#endif
/*LED (dependencies: -)*/
#ifndef LV_USE_LED
#define LV_USE_LED 1
#endif
/*Line (dependencies: -*/
#ifndef LV_USE_LINE
#define LV_USE_LINE 1
#endif
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#ifndef LV_USE_LIST
#define LV_USE_LIST 1
#endif
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
#ifndef LV_LIST_DEF_ANIM_TIME
# define LV_LIST_DEF_ANIM_TIME 100
#endif
#endif
/*Line meter (dependencies: *;)*/
#ifndef LV_USE_LMETER
#define LV_USE_LMETER 1
#endif
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#ifndef LV_USE_MBOX
#define LV_USE_MBOX 1
#endif
/*Page (dependencies: lv_cont)*/
#ifndef LV_USE_PAGE
#define LV_USE_PAGE 1
#endif
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
#ifndef LV_PAGE_DEF_ANIM_TIME
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#ifndef LV_USE_PRELOAD
#define LV_USE_PRELOAD 1
#endif
#if LV_USE_PRELOAD != 0
#ifndef LV_PRELOAD_DEF_ARC_LENGTH
# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
#endif
#ifndef LV_PRELOAD_DEF_SPIN_TIME
# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
#endif
#ifndef LV_PRELOAD_DEF_ANIM
# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
#endif
#endif
/*Roller (dependencies: lv_ddlist)*/
#ifndef LV_USE_ROLLER
#define LV_USE_ROLLER 1
#endif
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
#ifndef LV_ROLLER_DEF_ANIM_TIME
# define LV_ROLLER_DEF_ANIM_TIME 200
#endif
/*Number of extra "pages" when the roller is infinite*/
#ifndef LV_ROLLER_INF_PAGES
# define LV_ROLLER_INF_PAGES 7
#endif
#endif
/*Slider (dependencies: lv_bar)*/
#ifndef LV_USE_SLIDER
#define LV_USE_SLIDER 1
#endif
/*Spinbox (dependencies: lv_ta)*/
#ifndef LV_USE_SPINBOX
#define LV_USE_SPINBOX 1
#endif
/*Switch (dependencies: lv_slider)*/
#ifndef LV_USE_SW
#define LV_USE_SW 1
#endif
/*Text area (dependencies: lv_label, lv_page)*/
#ifndef LV_USE_TA
#define LV_USE_TA 1
#endif
#if LV_USE_TA != 0
#ifndef LV_TA_DEF_CURSOR_BLINK_TIME
# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
#endif
#ifndef LV_TA_DEF_PWD_SHOW_TIME
# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#endif
/*Table (dependencies: lv_label)*/
#ifndef LV_USE_TABLE
#define LV_USE_TABLE 1
#endif
#if LV_USE_TABLE
#ifndef LV_TABLE_COL_MAX
# define LV_TABLE_COL_MAX 12
#endif
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#ifndef LV_USE_TABVIEW
#define LV_USE_TABVIEW 1
#endif
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
#ifndef LV_TABVIEW_DEF_ANIM_TIME
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
#endif
/*Tileview (dependencies: lv_page) */
#ifndef LV_USE_TILEVIEW
#define LV_USE_TILEVIEW 1
#endif
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
#ifndef LV_TILEVIEW_DEF_ANIM_TIME
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#ifndef LV_USE_WIN
#define LV_USE_WIN 1
#endif
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#endif /*LV_CONF_CHECKER_H*/

1126
src/lv_conf_internal.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ CSRCS += lv_obj.c
CSRCS += lv_refr.c
CSRCS += lv_style.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_core
VPATH += :$(LVGL_DIR)/lvgl/src/lv_core
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_core"
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core"

View File

@@ -8,6 +8,7 @@
*********************/
#include "lv_disp.h"
#include "../lv_misc/lv_math.h"
#include "../lv_core/lv_refr.h"
/*********************
* DEFINES
@@ -21,6 +22,12 @@
* STATIC PROTOTYPES
**********************/
#if LV_USE_ANIMATION
static void scr_load_anim_start(lv_anim_t * a);
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
static void scr_anim_ready(lv_anim_t * a);
#endif
/**********************
* STATIC VARIABLES
**********************/
@@ -43,13 +50,30 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_scr_act: no display registered to get its top layer");
LV_LOG_WARN("no display registered to get its active screen");
return NULL;
}
return disp->act_scr;
}
/**
* Return with a pointer to the previous screen. Only used during screen transitions.
* @param disp pointer to display which previous screen should be get. (NULL to use the default
* screen)
* @return pointer to the previous screen object or NULL if not used now
*/
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("no display registered to get its previous screen");
return NULL;
}
return disp->prev_scr;
}
/**
* Make a screen active
* @param scr pointer to a screen
@@ -57,7 +81,7 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp)
void lv_disp_load_scr(lv_obj_t * scr)
{
lv_disp_t * d = lv_obj_get_disp(scr);
if(!d) return; /*Shouldn't happen, just to be sure*/
d->act_scr = scr;
lv_obj_invalidate(scr);
@@ -89,13 +113,14 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_layer_sys: no display registered to get its top layer");
LV_LOG_WARN("lv_layer_sys: no display registered to get its sys. layer");
return NULL;
}
return disp->sys_layer;
}
/**
* Assign a screen to a display.
* @param disp pointer to a display where to assign the screen
@@ -112,26 +137,179 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
if(old_disp == disp) return;
lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
_lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
}
/**
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* Set the background color of a display
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
* @param color color of the background
*/
lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp)
void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
return NULL;
LV_LOG_WARN("no display registered");
return;
}
return disp->refr_task;
disp->bg_color = color;
lv_area_t a;
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
_lv_inv_area(disp, &a);
}
/**
* Set the background image of a display
* @param disp pointer to a display
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
*/
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("no display registered");
return;
}
disp->bg_img = img_src;
lv_area_t a;
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
_lv_inv_area(disp, &a);
}
/**
* Opacity of the background
* @param disp pointer to a display
* @param opa opacity (0..255)
*/
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("no display registered");
return;
}
disp->bg_opa = opa;
lv_area_t a;
lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1);
_lv_inv_area(disp, &a);
}
#if LV_USE_ANIMATION
/**
* Switch screen with animation
* @param scr pointer to the new screen to load
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
* @param time time of the animation
* @param delay delay before the transition
* @param auto_del true: automatically delete the old screen
*/
void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)
{
lv_disp_t * d = lv_obj_get_disp(new_scr);
if(d->prev_scr && d->del_prev) {
lv_obj_del(d->prev_scr);
d->prev_scr = NULL;
}
d->del_prev = auto_del;
/*Be sure there is no other animation on the screens*/
lv_anim_del(new_scr, NULL);
lv_anim_del(lv_scr_act(), NULL);
/*Be sure both screens are in a normal position*/
lv_obj_set_pos(new_scr, 0, 0);
lv_obj_set_pos(lv_scr_act(), 0, 0);
lv_style_remove_prop(lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
lv_style_remove_prop(lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
lv_anim_t a_new;
lv_anim_init(&a_new);
lv_anim_set_var(&a_new, new_scr);
lv_anim_set_start_cb(&a_new, scr_load_anim_start);
lv_anim_set_ready_cb(&a_new, scr_anim_ready);
lv_anim_set_time(&a_new, time);
lv_anim_set_delay(&a_new, delay);
lv_anim_t a_old;
lv_anim_init(&a_old);
lv_anim_set_var(&a_old, d->act_scr);
lv_anim_set_time(&a_old, time);
lv_anim_set_delay(&a_old, delay);
switch(anim_type) {
case LV_SCR_LOAD_ANIM_NONE:
/* Create a dummy animation to apply the delay*/
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_new, 0, 0);
break;
case LV_SCR_LOAD_ANIM_OVER_LEFT:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_TOP:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
break;
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
break;
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_TOP:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
break;
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
break;
case LV_SCR_LOAD_ANIM_FADE_ON:
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
break;
}
lv_anim_start(&a_new);
lv_anim_start(&a_old);
}
#endif
/**
* Get elapsed time since last user activity on a display (e.g. click)
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
@@ -151,7 +329,8 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp)
uint32_t t = UINT32_MAX;
d = lv_disp_get_next(NULL);
while(d) {
t = LV_MATH_MIN(t, lv_tick_elaps(d->last_activity_time));
uint32_t elaps = lv_tick_elaps(d->last_activity_time);
t = LV_MATH_MIN(t, elaps);
d = lv_disp_get_next(d);
}
@@ -173,6 +352,49 @@ void lv_disp_trig_activity(lv_disp_t * disp)
disp->last_activity_time = lv_tick_get();
}
/**
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
*/
lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
return NULL;
}
return disp->refr_task;
}
/**********************
* STATIC FUNCTIONS
**********************/
#if LV_USE_ANIMATION
static void scr_load_anim_start(lv_anim_t * a)
{
lv_disp_t * d = lv_obj_get_disp(a->var);
d->prev_scr = lv_scr_act();
lv_disp_load_scr(a->var);
}
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v)
{
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
}
static void scr_anim_ready(lv_anim_t * a)
{
lv_disp_t * d = lv_obj_get_disp(a->var);
if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr);
d->prev_scr = NULL;
lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
}
#endif

View File

@@ -24,6 +24,19 @@ extern "C" {
* TYPEDEFS
**********************/
typedef enum {
LV_SCR_LOAD_ANIM_NONE,
LV_SCR_LOAD_ANIM_OVER_LEFT,
LV_SCR_LOAD_ANIM_OVER_RIGHT,
LV_SCR_LOAD_ANIM_OVER_TOP,
LV_SCR_LOAD_ANIM_OVER_BOTTOM,
LV_SCR_LOAD_ANIM_MOVE_LEFT,
LV_SCR_LOAD_ANIM_MOVE_RIGHT,
LV_SCR_LOAD_ANIM_MOVE_TOP,
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
LV_SCR_LOAD_ANIM_FADE_ON,
} lv_scr_load_anim_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@@ -36,6 +49,14 @@ extern "C" {
*/
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp);
/**
* Return with a pointer to the previous screen. Only used during screen transitions.
* @param disp pointer to display which previous screen should be get. (NULL to use the default
* screen)
* @return pointer to the previous screen object or NULL if not used now
*/
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp);
/**
* Make a screen active
* @param scr pointer to a screen
@@ -64,14 +85,41 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
*/
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr);
/**
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
*/
lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp);
/**
* Set the background color of a display
* @param disp pointer to a display
* @param color color of the background
*/
void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color);
/**
* Set the background image of a display
* @param disp pointer to a display
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
*/
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
/**
* Opacity of the background
* @param disp pointer to a display
* @param opa opacity (0..255)
*/
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
#if LV_USE_ANIMATION
/**
* Switch screen with animation
* @param scr pointer to the new screen to load
* @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
* @param time time of the animation
* @param delay delay before the transition
* @param auto_del true: automatically delete the old screen
*/
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
#endif
/**
* Get elapsed time since last user activity on a display (e.g. click)
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
@@ -85,6 +133,14 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
*/
void lv_disp_trig_activity(lv_disp_t * disp);
/**
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
*/
lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp);
/*------------------------------------------------
* To improve backward compatibility
* Recommended only if you have one display
@@ -109,7 +165,7 @@ static inline lv_obj_t * lv_layer_top(void)
}
/**
* Get the active screen of the deafult display
* Get the active screen of the default display
* @return pointer to the sys layer
*/
static inline lv_obj_t * lv_layer_sys(void)
@@ -122,6 +178,7 @@ static inline void lv_scr_load(lv_obj_t * scr)
lv_disp_load_scr(scr);
}
/**********************
* MACROS
**********************/
@@ -145,6 +202,20 @@ static inline void lv_scr_load(lv_obj_t * scr)
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
#endif
/**
* Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP)
* 1 dip is 1 px on a 160 DPI screen
* 1 dip is 2 px on a 320 DPI screen
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
*/
#define LV_DPX(n) LV_MATH_MAX((( lv_disp_get_dpi(NULL) * (n) + 80) / 160), 1) /*+80 for rounding*/
static inline lv_coord_t lv_dpx(lv_coord_t n)
{
return LV_DPX(n);
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -8,12 +8,13 @@
*********************/
#include "lv_group.h"
#if LV_USE_GROUP != 0
#include "../lv_themes/lv_theme.h"
#include <stddef.h>
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
@@ -27,9 +28,6 @@
/**********************
* STATIC PROTOTYPES
**********************/
static void style_mod_def(lv_group_t * group, lv_style_t * style);
static void style_mod_edit_def(lv_group_t * group, lv_style_t * style);
static void refresh_theme(lv_group_t * g, lv_theme_t * th);
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
void * (*move)(const lv_ll_t *, const void *));
static void lv_group_refocus(lv_group_t * g);
@@ -50,9 +48,9 @@ static void obj_to_foreground(lv_obj_t * obj);
/**
* Init. the group module
*/
void lv_group_init(void)
void _lv_group_init(void)
{
lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t));
_lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t));
}
/**
@@ -61,10 +59,10 @@ void lv_group_init(void)
*/
lv_group_t * lv_group_create(void)
{
lv_group_t * group = lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll));
lv_mem_assert(group);
lv_group_t * group = _lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll));
LV_ASSERT_MEM(group);
if(group == NULL) return NULL;
lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
_lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
group->obj_focus = NULL;
group->frozen = 0;
@@ -75,12 +73,9 @@ lv_group_t * lv_group_create(void)
group->wrap = 1;
#if LV_USE_USER_DATA
memset(&group->user_data, 0, sizeof(lv_group_user_data_t));
_lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t));
#endif
/*Initialize style modification callbacks from current theme*/
refresh_theme(group, lv_theme_get_current());
return group;
}
@@ -98,13 +93,12 @@ void lv_group_del(lv_group_t * group)
/*Remove the objects from the group*/
lv_obj_t ** obj;
LV_LL_READ(group->obj_ll, obj)
{
_LV_LL_READ(group->obj_ll, obj) {
(*obj)->group_p = NULL;
}
lv_ll_clear(&(group->obj_ll));
lv_ll_rem(&LV_GC_ROOT(_lv_group_ll), group);
_lv_ll_clear(&(group->obj_ll));
_lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group);
lv_mem_free(group);
}
@@ -116,11 +110,9 @@ void lv_group_del(lv_group_t * group)
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
{
if(group == NULL) return;
/*Do not add the object twice*/
lv_obj_t ** obj_i;
LV_LL_READ(group->obj_ll, obj_i)
{
_LV_LL_READ(group->obj_ll, obj_i) {
if((*obj_i) == obj) {
LV_LOG_INFO("lv_group_add_obj: the object is already added to this group");
return;
@@ -137,14 +129,14 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
}
obj->group_p = group;
lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll);
lv_mem_assert(next);
lv_obj_t ** next = _lv_ll_ins_tail(&group->obj_ll);
LV_ASSERT_MEM(next);
if(next == NULL) return;
*next = obj;
/* If the head and the tail is equal then there is only one object in the linked list.
* In this case automatically activate it*/
if(lv_ll_get_head(&group->obj_ll) == next) {
if(_lv_ll_get_head(&group->obj_ll) == next) {
lv_group_refocus(group);
}
}
@@ -161,8 +153,10 @@ void lv_group_remove_obj(lv_obj_t * obj)
/*Focus on the next object*/
if(*g->obj_focus == obj) {
if(g->frozen) g->frozen = 0;
/*If this is the only object in the group then focus to nothing.*/
if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
}
/*If there more objects in the group then focus to the next/prev object*/
@@ -180,10 +174,9 @@ void lv_group_remove_obj(lv_obj_t * obj)
/*Search the object and remove it from its group */
lv_obj_t ** i;
LV_LL_READ(g->obj_ll, i)
{
_LV_LL_READ(g->obj_ll, i) {
if(*i == obj) {
lv_ll_rem(&g->obj_ll, i);
_lv_ll_remove(&g->obj_ll, i);
lv_mem_free(i);
obj->group_p = NULL;
break;
@@ -206,12 +199,11 @@ void lv_group_remove_all_objs(lv_group_t * group)
/*Remove the objects from the group*/
lv_obj_t ** obj;
LV_LL_READ(group->obj_ll, obj)
{
_LV_LL_READ(group->obj_ll, obj) {
(*obj)->group_p = NULL;
}
lv_ll_clear(&(group->obj_ll));
_lv_ll_clear(&(group->obj_ll));
}
/**
@@ -226,12 +218,13 @@ void lv_group_focus_obj(lv_obj_t * obj)
if(g->frozen != 0) return;
if(obj == *g->obj_focus) return;
/*On defocus edit mode must be leaved*/
lv_group_set_editing(g, false);
lv_obj_t ** i;
LV_LL_READ(g->obj_ll, i)
{
_LV_LL_READ(g->obj_ll, i) {
if(*i == obj) {
if(g->obj_focus != NULL) {
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
@@ -249,7 +242,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
if(res != LV_RES_OK) return;
lv_obj_invalidate(*g->obj_focus);
/*If the object or its parent has `top == true` bring it to the foregorund*/
/*If the object or its parent has `top == true` bring it to the foreground*/
obj_to_foreground(*g->obj_focus);
}
break;
@@ -263,7 +256,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
*/
void lv_group_focus_next(lv_group_t * group)
{
focus_next_core(group, lv_ll_get_head, lv_ll_get_next);
focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next);
}
/**
@@ -272,7 +265,7 @@ void lv_group_focus_next(lv_group_t * group)
*/
void lv_group_focus_prev(lv_group_t * group)
{
focus_next_core(group, lv_ll_get_tail, lv_ll_get_prev);
focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev);
}
/**
@@ -310,28 +303,6 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
return res;
}
/**
* Set a function for a group which will modify the object's style if it is in focus
* @param group pointer to a group
* @param style_mod_cb the style modifier function pointer
*/
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb)
{
group->style_mod_cb = style_mod_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
/**
* Set a function for a group which will modify the object's style if it is in focus in edit mode
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
*/
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb)
{
group->style_mod_edit_cb = style_mod_edit_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
/**
* Set a function for a group which will be called when a new object is focused
* @param group pointer to a group
@@ -349,6 +320,7 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
*/
void lv_group_set_editing(lv_group_t * group, bool edit)
{
if(group == NULL) return;
uint8_t en_val = edit ? 1 : 0;
if(en_val == group->editing) return; /*Do not set the same mode again*/
@@ -390,25 +362,6 @@ void lv_group_set_wrap(lv_group_t * group, bool en)
group->wrap = en ? 1 : 0;
}
/**
* Modify a style with the set 'style_mod' function. The input style remains unchanged.
* @param group pointer to group
* @param style pointer to a style to modify
* @return a copy of the input style but modified with the 'style_mod' function
*/
lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
{
/*Load the current style. It will be modified by the callback*/
lv_style_copy(&group->style_tmp, style);
if(group->editing) {
if(group->style_mod_edit_cb) group->style_mod_edit_cb(group, &group->style_tmp);
} else {
if(group->style_mod_cb) group->style_mod_cb(group, &group->style_tmp);
}
return &group->style_tmp;
}
/**
* Get the focused object or NULL if there isn't one
* @param group pointer to a group
@@ -434,28 +387,6 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group)
}
#endif
/**
* Get a the style modifier function of a group
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod_cb;
}
/**
* Get a the style modifier function of a group in edit mode
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod_edit_cb;
}
/**
* Get the focus callback function of a group
* @param group pointer to a group
@@ -463,7 +394,7 @@ lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
*/
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
{
if(!group) return false;
if(!group) return NULL;
return group->focus_cb;
}
@@ -500,27 +431,6 @@ bool lv_group_get_wrap(lv_group_t * group)
return group->wrap ? true : false;
}
/**
* Notify the group that current theme changed and style modification callbacks need to be
* refreshed.
* @param group pointer to group. If NULL then all groups are notified.
*/
void lv_group_report_style_mod(lv_group_t * group)
{
lv_theme_t * th = lv_theme_get_current();
if(group != NULL) {
refresh_theme(group, th);
return;
}
lv_group_t * i;
LV_LL_READ(LV_GC_ROOT(_lv_group_ll), i)
{
refresh_theme(i, th);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
@@ -539,89 +449,6 @@ static void lv_group_refocus(lv_group_t * g)
g->wrap = temp_wrap;
}
/**
* Default style modifier function
* @param group pointer to the caller group
* @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN.
*/
static void style_mod_def(lv_group_t * group, lv_style_t * style)
{
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_ORANGE;
/*If not transparent or has border then emphasis the border*/
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_ORANGE, LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_ORANGE, LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_ORANGE, LV_OPA_60);
style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70);
/*Add some recolor to the images*/
if(style->image.intense < LV_OPA_MIN) {
style->image.color = LV_COLOR_ORANGE;
style->image.intense = LV_OPA_40;
}
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
style->body.border.width = 2;
#endif
}
/**
* Default style modifier function
* @param group pointer to the caller group
* @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN.
*/
static void style_mod_edit_def(lv_group_t * group, lv_style_t * style)
{
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_GREEN;
/*If not empty or has border then emphasis the border*/
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
/*Add some recolor to the images*/
if(style->image.intense < LV_OPA_MIN) {
style->image.color = LV_COLOR_GREEN;
style->image.intense = LV_OPA_40;
}
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
style->body.border.width = 3;
#endif
}
static void refresh_theme(lv_group_t * g, lv_theme_t * th)
{
g->style_mod_cb = style_mod_def;
g->style_mod_edit_cb = style_mod_edit_def;
if(th) {
if(th->group.style_mod_xcb) g->style_mod_cb = th->group.style_mod_xcb;
if(th->group.style_mod_edit_xcb) g->style_mod_edit_cb = th->group.style_mod_edit_xcb;
}
}
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
void * (*move)(const lv_ll_t *, const void *))
{
@@ -639,7 +466,8 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
obj_next = begin(&group->obj_ll);
can_move = false;
can_begin = false;
} else {
}
else {
/*Currently focused object is the last/first in the group, keep it that way*/
return;
}
@@ -680,7 +508,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return;
/*If the object or its parent has `top == true` bring it to the foregorund*/
/*If the object or its parent has `top == true` bring it to the foreground*/
obj_to_foreground(*group->obj_focus);
lv_obj_invalidate(*group->obj_focus);

View File

@@ -13,11 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "lv_obj.h"
@@ -56,15 +51,11 @@ typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
* Groups can be used to logically hold objects so that they can be individually focused.
* They are NOT for laying out objects on a screen (try `lv_cont` for that).
*/
typedef struct _lv_group_t
{
typedef struct _lv_group_t {
lv_ll_t obj_ll; /**< Linked list to store the objects in the group */
lv_obj_t ** obj_focus; /**< The object in focus*/
lv_group_style_mod_cb_t style_mod_cb; /**< A function to modifies the style of the focused object*/
lv_group_style_mod_cb_t style_mod_edit_cb; /**< A function which modifies the style of the edited object*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /**< Stores the modified style of the focused object */
#if LV_USE_USER_DATA
lv_group_user_data_t user_data;
#endif
@@ -90,7 +81,7 @@ typedef uint8_t lv_group_refocus_policy_t;
* Init. the group module
* @remarks Internal function, do not call directly.
*/
void lv_group_init(void);
void _lv_group_init(void);
/**
* Create a new object group
@@ -156,20 +147,6 @@ void lv_group_focus_freeze(lv_group_t * group, bool en);
*/
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
/**
* Set a function for a group which will modify the object's style if it is in focus
* @param group pointer to a group
* @param style_mod_cb the style modifier function pointer
*/
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb);
/**
* Set a function for a group which will modify the object's style if it is in focus in edit mode
* @param group pointer to a group
* @param style_mod_edit_cb the style modifier function pointer
*/
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb);
/**
* Set a function for a group which will be called when a new object is focused
* @param group pointer to a group
@@ -178,7 +155,7 @@ void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
/**
* Set whether the next or previous item in a group is focused if the currently focussed obj is
* Set whether the next or previous item in a group is focused if the currently focused obj is
* deleted.
* @param group pointer to a group
* @param new refocus policy enum
@@ -206,14 +183,6 @@ void lv_group_set_click_focus(lv_group_t * group, bool en);
*/
void lv_group_set_wrap(lv_group_t * group, bool en);
/**
* Modify a style with the set 'style_mod' function. The input style remains unchanged.
* @param group pointer to group
* @param style pointer to a style to modify
* @return a copy of the input style but modified with the 'style_mod' function
*/
lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style);
/**
* Get the focused object or NULL if there isn't one
* @param group pointer to a group
@@ -231,20 +200,6 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group);
#endif
/**
* Get a the style modifier function of a group
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group);
/**
* Get a the style modifier function of a group in edit mode
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group);
/**
* Get the focus callback function of a group
* @param group pointer to a group
@@ -273,13 +228,6 @@ bool lv_group_get_click_focus(const lv_group_t * group);
*/
bool lv_group_get_wrap(lv_group_t * group);
/**
* Notify the group that current theme changed and style modification callbacks need to be
* refreshed.
* @param group pointer to group. If NULL then all groups are notified.
*/
void lv_group_report_style_mod(lv_group_t * group);
/**********************
* MACROS
**********************/

File diff suppressed because it is too large Load Diff

View File

@@ -32,13 +32,13 @@ extern "C" {
/**
* Initialize the display input device subsystem
*/
void lv_indev_init(void);
void _lv_indev_init(void);
/**
* Called periodically to read the input devices
* @param task pointer to the task itself
*/
void lv_indev_read_task(lv_task_t * task);
void _lv_indev_read_task(lv_task_t * task);
/**
* Get the currently processed input device. Can be used in action functions too.
@@ -57,8 +57,9 @@ lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev);
/**
* Reset one or all input devices
* @param indev pointer to an input device to reset or NULL to reset all of them
* @param obj pointer to an object which triggers the reset.
*/
void lv_indev_reset(lv_indev_t * indev);
void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj);
/**
* Reset the long press state of an input device
@@ -95,7 +96,7 @@ void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
* @param indev pointer to an input device
* @param group point to a group
*/
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points);
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]);
/**
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
@@ -104,6 +105,13 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points);
*/
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
/**
* Get the current gesture direct
* @param indev pointer to an input device
* @return current gesture direct
*/
lv_gesture_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev);
/**
* Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
* @param indev pointer to an input device
@@ -127,12 +135,36 @@ bool lv_indev_is_dragging(const lv_indev_t * indev);
*/
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
/**
* Manually finish dragging.
* `LV_SIGNAL_DRAG_END` and `LV_EVENT_DRAG_END` will be sent.
* @param indev pointer to an input device
* @return `LV_RES_INV` if the object being dragged was deleted. Else `LV_RES_OK`.
*/
lv_res_t lv_indev_finish_drag(lv_indev_t * indev);
/**
* Do nothing until the next release
* @param indev pointer to an input device
*/
void lv_indev_wait_release(lv_indev_t * indev);
/**
* Gets a pointer to the currently active object in indev proc functions.
* NULL if no object is currently being handled or if groups aren't used.
* @return pointer to currently active object
*/
lv_obj_t * lv_indev_get_obj_act(void);
/**
* Search the most top, clickable object by a point
* @param obj pointer to a start object, typically the screen
* @param point pointer to a point for searching the most top child
* @return pointer to the found object or NULL if there was no suitable object
*/
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
/**
* Get a pointer to the indev read task to
* modify its parameters with `lv_task_...` functions.
@@ -141,13 +173,6 @@ void lv_indev_wait_release(lv_indev_t * indev);
*/
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev);
/**
* Gets a pointer to the currently active object in indev proc functions.
* NULL if no object is currently being handled or if groups aren't used.
* @return pointer to currently active object
*/
lv_obj_t * lv_indev_get_obj_act(void);
/**********************
* MACROS
**********************/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,302 @@
/**
* @file lv_obj_style_dec.h
*
*/
#ifndef LV_OBJ_STYLE_DEC_H
#define LV_OBJ_STYLE_DEC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* DEFINES
*********************/
/**
* Macro to declare the most important style set/get API functions.
*
* Get the value of a style property from an object in the object's current state
* -----------------------------------------------------------------------------
* - Get the value of a style property from an object in the object's current state.
* - Transition animation is taken into account.
* - If the property is not set in the object's styles check the parent(s) if the property can be inherited
* - If still not found return a default value.
* - For example:
* `lv_style_int_t w = lv_obj_get_style_border_width(btn1, LV_BTN_PART_MAIN);`
*
* Set a local style property for an object in a given state
* ---------------------------------------------------------
* - For example:
* `lv_obj_set_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
*
* Get a local style property's value of an object in a given state
* ----------------------------------------------------------------
* - Return the best matching property in the given state.
* - E.g. if `state` parameter is LV_STATE_PRESSED | LV_STATE_CHECKED` but the property defined only in
* `LV_STATE_PRESSED` and `LV_STATE_DEFAULT` the best matching state is `LV_STATE_PRESSED`
* (because it has higher precedence) and it will be returned.
* - If the property is not found even in `LV_STATE_DEFAULT` `-1` is returned.
* - For example:
* `//Type of result should be lv_style_int_t/lv_opa_t/lv_color_t/const void * according to the type of the property`
* `lv_style_int_t result;`
* `lv_obj_get_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, &result);`
* `if(weight > 0) ...the property is found and loaded into result...`
*
* Get the value from a style in a given state
* -------------------------------------------
* - The same rules applies to the return value then for "lv_obj_get_style_local_...()" above
* - For example
* `int16_t weight = lv_style_get_border_width(&style1, LV_STATE_PRESSED, &result);`
* `if(weight > 0) ...the property is found and loaded into result...`
* Set a value in a style in a given state
* ---------------------------------------
* - For example
* `lv_style_set_border_width(&style1, LV_STATE_PRESSED, 2);`
*/
#define _OBJ_GET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
{ \
return (value_type) _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
}
#define _OBJ_GET_STYLE_nonscalar(prop_name, func_name, value_type, style_type) \
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
{ \
return _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
}
#define _OBJ_SET_STYLE_LOCAL_scalar(prop_name, func_name, value_type, style_type) \
static inline void lv_obj_set_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
{ \
_lv_obj_set_style_local##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_LOCAL_nonscalar(prop_name, func_name, value_type, style_type) \
static inline void lv_obj_set_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
{ \
_lv_obj_set_style_local##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_nonscalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type, scalar) \
_OBJ_GET_STYLE_##scalar(prop_name, func_name, value_type, style_type) \
_OBJ_SET_STYLE_LOCAL_##scalar(prop_name, func_name, value_type, style_type) \
_OBJ_SET_STYLE_##scalar(prop_name, func_name, value_type, style_type)
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_WIDTH, transform_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_HEIGHT, transform_height, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_ANGLE, transform_angle, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSFORM_ZOOM, transform_zoom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_TOP, margin_top, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_BOTTOM, margin_bottom, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_LEFT, margin_left, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(MARGIN_RIGHT, margin_right, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFS_X, shadow_ofs_x, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFS_Y, shadow_ofs_y, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_DECOR, text_decor, lv_text_decor_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t *, _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_DELAY, transition_delay, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_1, transition_prop_1, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_2, transition_prop_2, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_3, transition_prop_3, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_4, transition_prop_4, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_5, transition_prop_5, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_6, transition_prop_6, lv_style_int_t, _int, scalar)
#if LV_USE_ANIMATION
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_anim_path_t *, _ptr, scalar)
#else
/*For compatibility*/
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, const void *, _ptr, scalar)
#endif
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color, nonscalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color, nonscalar)
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
static inline void lv_obj_set_style_local_pad_all(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_hor(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_ver(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
}
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
}
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
}
static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_OBJ_H*/

View File

@@ -13,11 +13,18 @@
#include "../lv_hal/lv_hal_disp.h"
#include "../lv_misc/lv_task.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_gc.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_font/lv_font_fmt_txt.h"
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#if LV_USE_PERF_MONITOR
#include "../lv_widgets/lv_label.h"
#endif
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
@@ -59,7 +66,7 @@ static lv_disp_t * disp_refr; /*Display being refreshed*/
/**
* Initialize the screen refresh subsystem
*/
void lv_refr_init(void)
void _lv_refr_init(void)
{
/*Nothing to do*/
}
@@ -73,13 +80,18 @@ void lv_refr_init(void)
*/
void lv_refr_now(lv_disp_t * disp)
{
#if LV_USE_ANIMATION
lv_anim_refr_now();
#endif
if(disp) {
lv_disp_refr_task(disp->refr_task);
} else {
_lv_disp_refr_task(disp->refr_task);
}
else {
lv_disp_t * d;
d = lv_disp_get_next(NULL);
while(d) {
lv_disp_refr_task(d->refr_task);
_lv_disp_refr_task(d->refr_task);
d = lv_disp_get_next(d);
}
}
@@ -91,7 +103,7 @@ void lv_refr_now(lv_disp_t * disp)
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
* only one display)
*/
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) return;
@@ -111,26 +123,28 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
lv_area_t com_area;
bool suc;
suc = lv_area_intersect(&com_area, area_p, &scr_area);
suc = _lv_area_intersect(&com_area, area_p, &scr_area);
/*The area is truncated to the screen*/
if(suc != false) {
if(disp->driver.rounder_cb) disp->driver.rounder_cb(&disp_refr->driver, &com_area);
if(disp->driver.rounder_cb) disp->driver.rounder_cb(&disp->driver, &com_area);
/*Save only if this area is not in one of the saved areas*/
uint16_t i;
for(i = 0; i < disp->inv_p; i++) {
if(lv_area_is_in(&com_area, &disp->inv_areas[i]) != false) return;
if(_lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return;
}
/*Save the area*/
if(disp->inv_p < LV_INV_BUF_SIZE) {
lv_area_copy(&disp->inv_areas[disp->inv_p], &com_area);
} else { /*If no place for the area add the screen*/
}
else { /*If no place for the area add the screen*/
disp->inv_p = 0;
lv_area_copy(&disp->inv_areas[disp->inv_p], &scr_area);
}
disp->inv_p++;
lv_task_set_prio(disp->refr_task, LV_REFR_TASK_PRIO);
}
}
@@ -138,18 +152,18 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
* Get the display which is being refreshed
* @return the display being refreshed
*/
lv_disp_t * lv_refr_get_disp_refreshing(void)
lv_disp_t * _lv_refr_get_disp_refreshing(void)
{
return disp_refr;
}
/**
* Set the display which is being refreshed.
* It shouldn1t be used directly by the user.
* It shouldn't be used directly by the user.
* It can be used to trick the drawing functions about there is an active display.
* @param the display being refreshed
*/
void lv_refr_set_disp_refreshing(lv_disp_t * disp)
void _lv_refr_set_disp_refreshing(lv_disp_t * disp)
{
disp_refr = disp;
}
@@ -158,66 +172,140 @@ void lv_refr_set_disp_refreshing(lv_disp_t * disp)
* Called periodically to handle the refreshing
* @param task pointer to the task itself
*/
void lv_disp_refr_task(lv_task_t * task)
void _lv_disp_refr_task(lv_task_t * task)
{
LV_LOG_TRACE("lv_refr_task: started");
uint32_t start = lv_tick_get();
uint32_t elaps = 0;
disp_refr = task->user_data;
#if LV_USE_PERF_MONITOR == 0
/* Ensure the task does not run again automatically.
* This is done before refreshing in case refreshing invalidates something else.
*/
lv_task_set_prio(task, LV_TASK_PRIO_OFF);
#endif
/*Do nothing if there is no active screen*/
if(disp_refr->act_scr == NULL) {
disp_refr->inv_p = 0;
return;
}
lv_refr_join_area();
lv_refr_areas();
/*If refresh happened ...*/
if(disp_refr->inv_p != 0) {
/*In true double buffered mode copy the refreshed areas to the new VDB to keep it up to
* date*/
/* In true double buffered mode copy the refreshed areas to the new VDB to keep it up to date.
* With set_px_cb we don't know anything about the buffer (even it's size) so skip copying.*/
if(lv_disp_is_true_double_buf(disp_refr)) {
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
if(disp_refr->driver.set_px_cb) {
LV_LOG_WARN("Can't handle 2 screen sized buffers with set_px_cb. Display is not refreshed.");
}
else {
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
/*Flush the content of the VDB*/
lv_refr_vdb_flush();
/*Flush the content of the VDB*/
lv_refr_vdb_flush();
/* With true double buffering the flushing should be only the address change of the
* current frame buffer. Wait until the address change is ready and copy the changed
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
while(vdb->flushing)
;
/* With true double buffering the flushing should be only the address change of the
* current frame buffer. Wait until the address change is ready and copy the changed
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
while(vdb->flushing);
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
lv_color_t * copy_buf = NULL;
#if LV_USE_GPU_STM32_DMA2D
LV_UNUSED(copy_buf);
#else
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
#endif
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
uint16_t a;
for(a = 0; a < disp_refr->inv_p; a++) {
if(disp_refr->inv_area_joined[a] == 0) {
lv_coord_t y;
uint32_t start_offs =
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
start_offs += hres * sizeof(lv_color_t);
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
uint16_t a;
for(a = 0; a < disp_refr->inv_p; a++) {
if(disp_refr->inv_area_joined[a] == 0) {
uint32_t start_offs =
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
#if LV_USE_GPU_STM32_DMA2D
lv_gpu_stm32_dma2d_copy((lv_color_t *)(buf_act + start_offs), disp_refr->driver.hor_res,
(lv_color_t *)(buf_ina + start_offs), disp_refr->driver.hor_res,
lv_area_get_width(&disp_refr->inv_areas[a]),
lv_area_get_height(&disp_refr->inv_areas[a]));
#else
lv_coord_t y;
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
/* The frame buffer is probably in an external RAM where sequential access is much faster.
* So first copy a line into a buffer and write it back the ext. RAM */
_lv_memcpy(copy_buf, buf_ina + start_offs, line_length);
_lv_memcpy(buf_act + start_offs, copy_buf, line_length);
start_offs += hres * sizeof(lv_color_t);
}
#endif
}
}
if(copy_buf) _lv_mem_buf_release(copy_buf);
}
} /*End of true double buffer handling*/
/*Clean up*/
memset(disp_refr->inv_areas, 0, sizeof(disp_refr->inv_areas));
memset(disp_refr->inv_area_joined, 0, sizeof(disp_refr->inv_area_joined));
_lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
_lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
disp_refr->inv_p = 0;
elaps = lv_tick_elaps(start);
/*Call monitor cb if present*/
if(disp_refr->driver.monitor_cb) {
disp_refr->driver.monitor_cb(&disp_refr->driver, lv_tick_elaps(start), px_num);
disp_refr->driver.monitor_cb(&disp_refr->driver, elaps, px_num);
}
}
lv_draw_free_buf();
_lv_mem_buf_free_all();
_lv_font_clean_up_fmt_txt();
#if LV_USE_PERF_MONITOR && LV_USE_LABEL
static lv_obj_t * perf_label = NULL;
if(perf_label == NULL) {
perf_label = lv_label_create(lv_layer_sys(), NULL);
lv_label_set_align(perf_label, LV_LABEL_ALIGN_RIGHT);
lv_obj_set_style_local_bg_opa(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_obj_set_style_local_bg_color(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_obj_set_style_local_text_color(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_pad_top(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_pad_bottom(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_pad_left(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_pad_right(perf_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_label_set_text(perf_label, "?");
lv_obj_align(perf_label, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
}
static uint32_t perf_last_time = 0;
static uint32_t elaps_max = 1;
if(lv_tick_elaps(perf_last_time) < 300) {
elaps_max = LV_MATH_MAX(elaps, elaps_max);
}
else {
perf_last_time = lv_tick_get();
uint32_t fps = 1000 / (elaps_max == 0 ? 1 : elaps_max);
elaps_max = 1;
uint32_t fps_limit = 1000 / disp_refr->refr_task->period;
if(fps > fps_limit) fps = fps_limit;
uint32_t cpu = 100 - lv_task_get_idle();
lv_label_set_text_fmt(perf_label, "%d FPS\n%d%% CPU", fps, cpu);
lv_obj_align(perf_label, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
}
#endif
LV_LOG_TRACE("lv_refr_task: ready");
}
@@ -245,11 +333,11 @@ static void lv_refr_join_area(void)
}
/*Check if the areas are on each other*/
if(lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
if(_lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
continue;
}
lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
_lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
/*Join two area only if the joined area size is smaller*/
if(lv_area_get_size(&joined_area) < (lv_area_get_size(&disp_refr->inv_areas[join_in]) +
@@ -269,12 +357,28 @@ static void lv_refr_join_area(void)
static void lv_refr_areas(void)
{
px_num = 0;
uint32_t i;
if(disp_refr->inv_p == 0) return;
/*Find the last area which will be drawn*/
int32_t i;
int32_t last_i = 0;
for(i = disp_refr->inv_p - 1; i >= 0; i--) {
if(disp_refr->inv_area_joined[i] == 0) {
last_i = i;
break;
}
}
disp_refr->driver.buffer->last_area = 0;
disp_refr->driver.buffer->last_part = 0;
for(i = 0; i < disp_refr->inv_p; i++) {
/*Refresh the unjoined areas*/
if(disp_refr->inv_area_joined[i] == 0) {
if(i == last_i) disp_refr->driver.buffer->last_area = 1;
disp_refr->driver.buffer->last_part = 0;
lv_refr_area(&disp_refr->inv_areas[i]);
if(disp_refr->driver.monitor_cb) px_num += lv_area_get_size(&disp_refr->inv_areas[i]);
@@ -296,6 +400,7 @@ static void lv_refr_area(const lv_area_t * area_p)
vdb->area.x2 = lv_disp_get_hor_res(disp_refr) - 1;
vdb->area.y1 = 0;
vdb->area.y2 = lv_disp_get_ver_res(disp_refr) - 1;
disp_refr->driver.buffer->last_part = 1;
lv_refr_area_part(area_p);
}
/*The buffer is smaller: refresh the area in parts*/
@@ -305,7 +410,7 @@ static void lv_refr_area(const lv_area_t * area_p)
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 =
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? y2 = lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
int32_t max_row = (uint32_t)vdb->size / w;
@@ -318,23 +423,24 @@ static void lv_refr_area(const lv_area_t * area_p)
tmp.x2 = 0;
tmp.y1 = 0;
lv_coord_t y_tmp = max_row - 1;
lv_coord_t h_tmp = max_row;
do {
tmp.y2 = y_tmp;
tmp.y2 = h_tmp - 1;
disp_refr->driver.rounder_cb(&disp_refr->driver, &tmp);
/*If this height fits into `max_row` then fine*/
if(lv_area_get_height(&tmp) <= max_row) break;
/*Decrement the height of the area until it fits into `max_row` after rounding*/
y_tmp--;
} while(y_tmp != 0);
h_tmp--;
} while(h_tmp > 0);
if(y_tmp == 0) {
if(h_tmp <= 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to "
"small VDB)");
return;
} else {
}
else {
max_row = tmp.y2 + 1;
}
}
@@ -350,6 +456,7 @@ static void lv_refr_area(const lv_area_t * area_p)
vdb->area.y2 = row + max_row - 1;
if(vdb->area.y2 > y2) vdb->area.y2 = y2;
row_last = vdb->area.y2;
if(y2 == row_last) disp_refr->driver.buffer->last_part = 1;
lv_refr_area_part(area_p);
}
@@ -361,7 +468,7 @@ static void lv_refr_area(const lv_area_t * area_p)
vdb->area.y1 = row;
vdb->area.y2 = y2;
/*Refresh this part too*/
disp_refr->driver.buffer->last_part = 1;
lv_refr_area_part(area_p);
}
}
@@ -373,28 +480,74 @@ static void lv_refr_area(const lv_area_t * area_p)
*/
static void lv_refr_area_part(const lv_area_t * area_p)
{
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
/*In non double buffered mode, before rendering the next part wait until the previous image is
* flushed*/
if(lv_disp_is_double_buf(disp_refr) == false) {
while(vdb->flushing)
;
while(vdb->flushing) {
if(disp_refr->driver.wait_cb) disp_refr->driver.wait_cb(&disp_refr->driver);
}
}
lv_obj_t * top_p;
lv_obj_t * top_act_scr = NULL;
lv_obj_t * top_prev_scr = NULL;
/*Get the new mask from the original area and the act. VDB
It will be a part of 'area_p'*/
lv_area_t start_mask;
lv_area_intersect(&start_mask, area_p, &vdb->area);
_lv_area_intersect(&start_mask, area_p, &vdb->area);
/*Get the most top object which is not covered by others*/
top_p = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
top_act_scr = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
if(disp_refr->prev_scr) {
top_prev_scr = lv_refr_get_top_obj(&start_mask, disp_refr->prev_scr);
}
/*Draw a display background if there is no top object*/
if(top_act_scr == NULL && top_prev_scr == NULL) {
if(disp_refr->bg_img) {
lv_draw_img_dsc_t dsc;
lv_draw_img_dsc_init(&dsc);
dsc.opa = disp_refr->bg_opa;
lv_img_header_t header;
lv_res_t res;
res = lv_img_decoder_get_info(disp_refr->bg_img, &header);
if(res == LV_RES_OK) {
lv_area_t a;
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
lv_draw_img(&a, &start_mask, disp_refr->bg_img, &dsc);
}
else {
LV_LOG_WARN("Can't draw the background image")
}
}
else {
lv_draw_rect_dsc_t dsc;
lv_draw_rect_dsc_init(&dsc);
dsc.bg_color = disp_refr->bg_color;
dsc.bg_opa = disp_refr->bg_opa;
lv_draw_rect(&start_mask, &start_mask, &dsc);
}
}
/*Refresh the previous screen if any*/
if(disp_refr->prev_scr) {
/*Get the most top object which is not covered by others*/
if(top_prev_scr == NULL) {
top_prev_scr = disp_refr->prev_scr;
}
/*Do the refreshing from the top object*/
lv_refr_obj_and_children(top_prev_scr, &start_mask);
}
if(top_act_scr == NULL) {
top_act_scr = disp_refr->act_scr;
}
/*Do the refreshing from the top object*/
lv_refr_obj_and_children(top_p, &start_mask);
lv_refr_obj_and_children(top_act_scr, &start_mask);
/*Also refresh top and sys layer unconditionally*/
lv_refr_obj_and_children(lv_disp_get_layer_top(disp_refr), &start_mask);
@@ -418,10 +571,13 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
lv_obj_t * found_p = NULL;
/*If this object is fully cover the draw area check the children too */
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
if(_lv_area_is_in(area_p, &obj->coords, 0) && obj->hidden == 0) {
lv_design_res_t design_res = obj->design_cb ? obj->design_cb(obj, area_p,
LV_DESIGN_COVER_CHK) : LV_DESIGN_RES_NOT_COVER;
if(design_res == LV_DESIGN_RES_MASKED) return NULL;
lv_obj_t * i;
LV_LL_READ(obj->child_ll, i)
{
_LV_LL_READ(obj->child_ll, i) {
found_p = lv_refr_get_top_obj(area_p, i);
/*If a children is ok then break*/
@@ -430,11 +586,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
}
}
/*If no better children check this object*/
/*If no better children use this object*/
if(found_p == NULL) {
const lv_style_t * style = lv_obj_get_style(obj);
if(style->body.opa == LV_OPA_COVER && obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK) != false &&
lv_obj_get_opa_scale(obj) == LV_OPA_COVER) {
if(design_res == LV_DESIGN_RES_COVER) {
found_p = obj;
}
}
@@ -454,6 +608,7 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
* but in special cases (e.g. if the screen has alpha) it won't.
* In this case use the screen directly */
if(top_p == NULL) top_p = lv_disp_get_scr_act(disp_refr);
if(top_p == NULL) return; /*Shouldn't happen*/
/*Refresh the top object and its children*/
lv_refr_obj(top_p, mask_p);
@@ -467,16 +622,16 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
/*Do until not reach the screen*/
while(par != NULL) {
/*object before border_p has to be redrawn*/
lv_obj_t * i = lv_ll_get_prev(&(par->child_ll), border_p);
lv_obj_t * i = _lv_ll_get_prev(&(par->child_ll), border_p);
while(i != NULL) {
/*Refresh the objects*/
lv_refr_obj(i, mask_p);
i = lv_ll_get_prev(&(par->child_ll), i);
i = _lv_ll_get_prev(&(par->child_ll), i);
}
/*Call the post draw design function of the parents of the to object*/
par->design_cb(par, mask_p, LV_DESIGN_DRAW_POST);
if(par->design_cb) par->design_cb(par, mask_p, LV_DESIGN_DRAW_POST);
/*The new border will be there last parents,
*so the 'younger' brothers of parent will be refreshed*/
@@ -508,29 +663,39 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
obj_area.y1 -= ext_size;
obj_area.x2 += ext_size;
obj_area.y2 += ext_size;
union_ok = lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
union_ok = _lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
/*Draw the parent and its children only if they ore on 'mask_parent'*/
if(union_ok != false) {
/* Redraw the object */
obj->design_cb(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
if(obj->design_cb) obj->design_cb(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
#if MASK_AREA_DEBUG
static lv_color_t debug_color = LV_COLOR_RED;
lv_draw_fill(&obj_ext_mask, &obj_ext_mask, debug_color, LV_OPA_50);
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_color.full = debug_color.full;
draw_dsc.bg_opa = LV_OPA_20;
draw_dsc.border_width = 2;
draw_dsc.border_opa = LV_OPA_50;
draw_dsc.border_color.full = (debug_color.full + 0x13) * 9;
lv_draw_rect(&obj_ext_mask, &obj_ext_mask, &draw_dsc);
debug_color.full *= 17;
debug_color.full += 0xA1;
#if LV_COLOR_DEPTH == 32
debug_color.ch.alpha = 0xff;
#endif
#endif
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
lv_obj_get_coords(obj, &obj_area);
union_ok = lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
union_ok = _lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
if(union_ok != false) {
lv_area_t mask_child; /*Mask from obj and its child*/
lv_obj_t * child_p;
lv_area_t child_area;
LV_LL_READ_BACK(obj->child_ll, child_p)
{
_LV_LL_READ_BACK(obj->child_ll, child_p) {
lv_obj_get_coords(child_p, &child_area);
ext_size = child_p->ext_draw_pad;
child_area.x1 -= ext_size;
@@ -539,7 +704,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
child_area.y2 += ext_size;
/* Get the union (common parts) of original mask (from obj)
* and its child */
union_ok = lv_area_intersect(&mask_child, &obj_mask, &child_area);
union_ok = _lv_area_intersect(&mask_child, &obj_mask, &child_area);
/*If the parent and the child has common area then refresh the child */
if(union_ok) {
@@ -550,7 +715,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
}
/* If all the children are redrawn make 'post draw' design */
obj->design_cb(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
if(obj->design_cb) obj->design_cb(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
}
}
@@ -564,14 +729,18 @@ static void lv_refr_vdb_flush(void)
/*In double buffered mode wait until the other buffer is flushed before flushing the current
* one*/
if(lv_disp_is_double_buf(disp_refr)) {
while(vdb->flushing)
;
while(vdb->flushing) {
if(disp_refr->driver.wait_cb) disp_refr->driver.wait_cb(&disp_refr->driver);
}
}
vdb->flushing = 1;
if(disp_refr->driver.buffer->last_area && disp_refr->driver.buffer->last_part) vdb->flushing_last = 1;
else vdb->flushing_last = 0;
/*Flush the rendered content to the display*/
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
if(vdb->buf1 && vdb->buf2) {

View File

@@ -20,6 +20,8 @@ extern "C" {
* DEFINES
*********************/
#define LV_REFR_TASK_PRIO LV_TASK_PRIO_MID
/**********************
* TYPEDEFS
**********************/
@@ -43,7 +45,7 @@ extern "C" {
/**
* Initialize the screen refresh subsystem
*/
void lv_refr_init(void);
void _lv_refr_init(void);
/**
* Redraw the invalidated areas now.
@@ -60,27 +62,27 @@ void lv_refr_now(lv_disp_t * disp);
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
* only one display)
*/
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
/**
* Get the display which is being refreshed
* @return the display being refreshed
*/
lv_disp_t * lv_refr_get_disp_refreshing(void);
lv_disp_t * _lv_refr_get_disp_refreshing(void);
/**
* Set the display which is being refreshed.
* It shouldn1t be used directly by the user.
* It shouldn't be used directly by the user.
* It can be used to trick the drawing functions about there is an active display.
* @param the display being refreshed
*/
void lv_refr_set_disp_refreshing(lv_disp_t * disp);
void _lv_refr_set_disp_refreshing(lv_disp_t * disp);
/**
* Called periodically to handle the refreshing
* @param task pointer to the task itself
*/
void lv_disp_refr_task(lv_task_t * task);
void _lv_disp_refr_task(lv_task_t * task);
/**********************
* STATIC FUNCTIONS

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,32 @@ extern "C" {
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_blend.h"
/*********************
* DEFINES
*********************/
#define LV_RADIUS_CIRCLE (LV_COORD_MAX) /**< A very big radius to always draw as circle*/
#define LV_RADIUS_CIRCLE (0x7FFF) /**< A very big radius to always draw as circle*/
LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
#define LV_DEBUG_STYLE_SENTINEL_VALUE 0x2288AAEE
#define LV_DEBUG_STYLE_LIST_SENTINEL_VALUE 0x9977CCBB
#define LV_STYLE_PROP_INIT(name, group, id, attr) name = (((group << 4) + id) | ((attr) << 8))
#define LV_STYLE_ID_MASK 0x00FF
#define LV_STYLE_ATTR_NONE 0
#define LV_STYLE_ATTR_INHERIT (1 << 7)
#define _LV_STYLE_CLOSEING_PROP 0xFF
#define LV_STYLE_TRANS_NUM_MAX 6
#define LV_STYLE_PROP_ALL 0xFF
/**********************
* TYPEDEFS
@@ -30,117 +51,255 @@ extern "C" {
/*Border types (Use 'OR'ed values)*/
enum {
LV_BORDER_NONE = 0x00,
LV_BORDER_BOTTOM = 0x01,
LV_BORDER_TOP = 0x02,
LV_BORDER_LEFT = 0x04,
LV_BORDER_RIGHT = 0x08,
LV_BORDER_FULL = 0x0F,
LV_BORDER_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
LV_BORDER_SIDE_NONE = 0x00,
LV_BORDER_SIDE_BOTTOM = 0x01,
LV_BORDER_SIDE_TOP = 0x02,
LV_BORDER_SIDE_LEFT = 0x04,
LV_BORDER_SIDE_RIGHT = 0x08,
LV_BORDER_SIDE_FULL = 0x0F,
LV_BORDER_SIDE_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
_LV_BORDER_SIDE_LAST
};
typedef uint8_t lv_border_part_t;
typedef uint8_t lv_border_side_t;
/*Shadow types*/
enum {
LV_SHADOW_BOTTOM = 0, /**< Only draw bottom shadow */
LV_SHADOW_FULL, /**< Draw shadow on all sides */
LV_GRAD_DIR_NONE,
LV_GRAD_DIR_VER,
LV_GRAD_DIR_HOR,
_LV_GRAD_DIR_LAST
};
typedef uint8_t lv_shadow_type_t;
/**
* Objects in LittlevGL can be assigned a style - which holds information about
* how the object should be drawn.
*
* This allows for easy customization without having to modify the object's design
* function.
*/
typedef struct
{
uint8_t glass : 1; /**< 1: Do not inherit this style*/
typedef uint8_t lv_grad_dir_t;
/** Object background. */
struct
{
lv_color_t main_color; /**< Object's main background color. */
lv_color_t grad_color; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
lv_coord_t radius; /**< Object's corner radius. You can use #LV_RADIUS_CIRCLE if you want to draw a circle. */
lv_opa_t opa; /**< Object's opacity (0-255). */
/*Text decorations (Use 'OR'ed values)*/
enum {
LV_TEXT_DECOR_NONE = 0x00,
LV_TEXT_DECOR_UNDERLINE = 0x01,
LV_TEXT_DECOR_STRIKETHROUGH = 0x02,
_LV_TEXT_DECOR_LAST
};
struct
{
lv_color_t color; /**< Border color */
lv_coord_t width; /**< Border width */
lv_border_part_t part; /**< Which borders to draw */
lv_opa_t opa; /**< Border opacity. */
} border;
typedef uint8_t lv_text_decor_t;
struct
{
lv_color_t color;
lv_coord_t width;
lv_shadow_type_t type; /**< Which parts of the shadow to draw */
} shadow;
typedef uint8_t lv_style_attr_t;
struct
{
lv_coord_t top;
lv_coord_t bottom;
lv_coord_t left;
lv_coord_t right;
lv_coord_t inner;
} padding;
} body;
#define LV_STYLE_ATTR_GET_INHERIT(f) ((f)&0x80)
#define LV_STYLE_ATTR_GET_STATE(f) ((f)&0x7F)
/** Style for text drawn by this object. */
struct
{
lv_color_t color; /**< Text color */
lv_color_t sel_color; /**< Text selection background color. */
const lv_font_t * font;
lv_coord_t letter_space; /**< Space between letters */
lv_coord_t line_space; /**< Space between lines (vertical) */
lv_opa_t opa; /**< Text opacity */
} text;
#define LV_STYLE_ID_VALUE 0x0 /*max 9 pcs*/
#define LV_STYLE_ID_COLOR 0x9 /*max 3 pcs*/
#define LV_STYLE_ID_OPA 0xC /*max 2 pcs*/
#define LV_STYLE_ID_PTR 0xE /*max 2 pcs*/
/**< Style of images. */
struct
{
lv_color_t color; /**< Color to recolor the image with */
lv_opa_t intense; /**< Opacity of recoloring (0 means no recoloring) */
lv_opa_t opa; /**< Opacity of whole image */
} image;
enum {
/*Skip 0th property*/
LV_STYLE_PROP_INIT(LV_STYLE_RADIUS, 0x0, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_CLIP_CORNER, 0x0, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SIZE, 0x0, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ANGLE, 0x0, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
/**< Style of lines (not borders). */
struct
{
lv_color_t color;
lv_coord_t width;
lv_opa_t opa;
uint8_t rounded : 1; /**< 1: rounded line endings*/
} line;
LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PAD_BOTTOM, 0x1, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PAD_LEFT, 0x1, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PAD_RIGHT, 0x1, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PAD_INNER, 0x1, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_MARGIN_TOP, 0x1, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_MARGIN_BOTTOM, 0x1, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_MARGIN_LEFT, 0x1, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_MARGIN_RIGHT, 0x1, LV_STYLE_ID_VALUE + 8, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_BLEND_MODE, 0x2, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_MAIN_STOP, 0x2, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_GRAD_STOP, 0x2, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_GRAD_DIR, 0x2, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_COLOR, 0x2, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_GRAD_COLOR, 0x2, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BG_OPA, 0x2, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_WIDTH, 0x3, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_SIDE, 0x3, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_BLEND_MODE, 0x3, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_POST, 0x3, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_COLOR, 0x3, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_OPA, 0x3, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_WIDTH, 0x4, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_PAD, 0x4, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_BLEND_MODE, 0x4, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_COLOR, 0x4, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_WIDTH, 0x5, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_Y, 0x5, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_SPREAD, 0x5, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_BLEND_MODE, 0x5, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_COLOR, 0x5, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OPA, 0x5, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_BLEND_MODE, 0x6, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_REPEAT, 0x6, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR, 0x6, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_OPA, 0x6, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR_OPA, 0x6, LV_STYLE_ID_OPA + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_IMAGE, 0x6, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LETTER_SPACE, 0x7, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LINE_SPACE, 0x7, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_BLEND_MODE, 0x7, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_X, 0x7, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_Y, 0x7, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_ALIGN, 0x7, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_COLOR, 0x7, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OPA, 0x7, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_DECOR, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_FONT, 0x8, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_WIDTH, 0x9, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_BLEND_MODE, 0x9, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_DASH_WIDTH, 0x9, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_DASH_GAP, 0x9, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_ROUNDED, 0x9, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_COLOR, 0x9, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_LINE_OPA, 0x9, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_IMAGE_BLEND_MODE, 0xA, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_IMAGE_RECOLOR, 0xA, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_IMAGE_OPA, 0xA, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_IMAGE_RECOLOR_OPA, 0xA, LV_STYLE_ID_OPA + 1, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_TIME, 0xB, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_DELAY, 0xB, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_1, 0xB, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_2, 0xB, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_3, 0xB, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_4, 0xB, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_5, 0xB, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
};
typedef uint16_t lv_style_property_t;
#define LV_STYLE_STATE_POS 8
#define LV_STYLE_STATE_MASK 0x7F00
#define LV_STYLE_INHERIT_MASK 0x8000
typedef uint16_t lv_style_state_t;
typedef struct {
uint8_t * map;
#if LV_USE_ASSERT_STYLE
uint32_t sentinel;
#endif
} lv_style_t;
#if LV_USE_ANIMATION
/** Data structure for style animations. */
typedef struct
{
lv_style_t style_start; /*Save not only pointers because can be same as 'style_anim' then it
will be modified too*/
lv_style_t style_end;
lv_style_t * style_anim;
lv_anim_ready_cb_t ready_cb;
} lv_style_anim_dsc_t;
typedef int16_t lv_style_int_t;
typedef struct {
lv_style_t ** style_list;
#if LV_USE_ASSERT_STYLE
uint32_t sentinel;
#endif
uint8_t style_cnt;
uint8_t has_local : 1;
uint8_t has_trans : 1;
uint8_t skip_trans : 1; /*1: Temporally skip the transition style if any*/
uint8_t ignore_trans : 1; /*1: Mark that this style list shouldn't receive transitions at all*/
} lv_style_list_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Init the basic styles
* Initialize a style
* @param style pointer to a style to initialize
*/
void lv_style_init(void);
void lv_style_init(lv_style_t * style);
/**
* Copy a style with all its properties
* @param style_dest pointer to the destination style. (Should be initialized with `lv_style_init()`)
* @param style_src pointer to the source (to copy )style
*/
void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src);
/**
* Initialize a style list
* @param list a style list to initialize
*/
void lv_style_list_init(lv_style_list_t * list);
/**
* Copy a style list with all its styles and local style properties
* @param list_dest pointer to the destination style list. (should be initialized with `lv_style_list_init()`)
* @param list_src pointer to the source (to copy) style list.
*/
void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * list_src);
/**
* Add a style to a style list.
* Only the the style pointer will be saved so the shouldn't be a local variable.
* (It should be static, global or dynamically allocated)
* @param list pointer to a style list
* @param style pointer to a style to add
*/
void _lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style);
/**
* Remove a style from a style list
* @param style_list pointer to a style list
* @param style pointer to a style to remove
*/
void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style);
/**
* Remove all styles added from style list, clear the local style, transition style and free all allocated memories.
* Leave `ignore_trans` flag as it is.
* @param list pointer to a style list.
*/
void _lv_style_list_reset(lv_style_list_t * style_list);
static inline lv_style_t * lv_style_list_get_style(lv_style_list_t * list, uint8_t id)
{
if(list->has_trans && list->skip_trans) id++;
if(list->style_cnt == 0 || id >= list->style_cnt) return NULL;
return list->style_list[id];
}
/**
* Clear all properties from a style and all allocated memories.
* @param style pointer to a style
*/
void lv_style_reset(lv_style_t * style);
/**
* Get the size of the properties in a style in bytes
* @param style pointer to a style
* @return size of the properties in bytes
*/
uint16_t _lv_style_get_mem_size(const lv_style_t * style);
/**
* Copy a style to an other
@@ -150,158 +309,298 @@ void lv_style_init(void);
void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
/**
* Mix two styles according to a given ratio
* @param start start style
* @param end end style
* @param res store the result style here
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
* Remove a property from a style
* @param style pointer to a style
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @return true: the property was found and removed; false: the property wasn't found
*/
void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t * res, uint16_t ratio);
#if LV_USE_ANIMATION
bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop);
/**
* Initialize an animation variable.
* E.g.:
* lv_anim_t a;
* lv_style_anim__init(&a);
* lv_style_anim_set_...(&a);
* lv_style_anim_create(&a);
* @param a pointer to an `lv_anim_t` variable to initialize
* Set an integer typed property in a style.
* @param style pointer to a style where the property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note shouldn't be used directly. Use the specific property set functions instead.
* For example: `lv_style_set_border_width()`
* @note for performance reasons it's not checked if the property really has integer type
*/
void lv_style_anim_init(lv_anim_t * a);
void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value);
/**
*
* @param a pointer to an initialized `lv_anim_t` variable
* @param to_anim pointer to the style to animate
* @param start pointer to a style to animate from (start value)
* @param end pointer to a style to animate to (end value)
* Set a color typed property in a style.
* @param style pointer to a style where the property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note shouldn't be used directly. Use the specific property set functions instead.
* For example: `lv_style_set_border_color()`
* @note for performance reasons it's not checked if the property really has color type
*/
void lv_style_anim_set_styles(lv_anim_t * a, lv_style_t * to_anim, const lv_style_t * start, const lv_style_t * end);
void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color);
/**
* Set the duration and delay of an animation
* @param a pointer to an initialized `lv_anim_t` variable
* @param duration duration of the animation in milliseconds
* @param delay delay before the animation in milliseconds
* Set an opacity typed property in a style.
* @param style pointer to a style where the property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note shouldn't be used directly. Use the specific property set functions instead.
* For example: `lv_style_set_border_opa()`
* @note for performance reasons it's not checked if the property really has opacity type
*/
static inline void lv_style_anim_set_time(lv_anim_t * a, uint16_t duration, uint16_t delay)
{
lv_anim_set_time(a, duration, delay);
}
void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa);
/**
* Set a function call when the animation is ready
* @param a pointer to an initialized `lv_anim_t` variable
* @param ready_cb a function call when the animation is ready
* Set a pointer typed property in a style.
* @param style pointer to a style where the property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_POINTER | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note shouldn't be used directly. Use the specific property set functions instead.
* For example: `lv_style_set_border_width()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void lv_style_anim_set_ready_cb(lv_anim_t * a, lv_anim_ready_cb_t ready_cb)
{
lv_style_anim_dsc_t * dsc = (lv_style_anim_dsc_t *)a->var;
dsc->ready_cb = ready_cb;
}
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
/**
* Make the animation to play back to when the forward direction is ready
* @param a pointer to an initialized `lv_anim_t` variable
* @param wait_time time in milliseconds to wait before starting the back direction
* Get an integer typed property from a style.
* @param style pointer to a style from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result value
* @return -1: the property wasn't found in the style.
* The matching state bits of the desired state (in `prop`) and the best matching property's state
* Higher value means match in higher precedence state.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_style_get_border_width()`
* @note for performance reasons it's not checked if the property really has integer type
*/
static inline void lv_style_anim_set_playback(lv_anim_t * a, uint16_t wait_time)
{
lv_anim_set_playback(a, wait_time);
}
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, void * res);
/**
* Disable playback. (Disabled after `lv_anim_init()`)
* @param a pointer to an initialized `lv_anim_t` variable
* Get a color typed property from a style.
* @param style pointer to a style from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result value
* @return -1: the property wasn't found in the style.
* The matching state bits of the desired state (in `prop`) and the best matching property's state
* Higher value means match in higher precedence state.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_style_get_border_color()`
* @note for performance reasons it's not checked if the property really has color type
*/
static inline void lv_style_anim_clear_playback(lv_anim_t * a)
{
lv_anim_clear_playback(a);
}
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, void * res);
/**
* Make the animation to start again when ready.
* @param a pointer to an initialized `lv_anim_t` variable
* @param wait_time time in milliseconds to wait before starting the animation again
* Get an opacity typed property from a style.
* @param style pointer to a style from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result value
* @return -1: the property wasn't found in the style.
* The matching state bits of the desired state (in `prop`) and the best matching property's state
* Higher value means match in higher precedence state.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has opacity type
*/
static inline void lv_style_anim_set_repeat(lv_anim_t * a, uint16_t wait_time)
{
lv_anim_set_repeat(a, wait_time);
}
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, void * res);
/**
* Disable repeat. (Disabled after `lv_anim_init()`)
* @param a pointer to an initialized `lv_anim_t` variable
* Get a pointer typed property from a style.
* @param style pointer to a style from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result value
* @return -1: the property wasn't found in the style.
* The matching state bits of the desired state (in `prop`) and the best matching property's state
* Higher value means match in higher precedence state.
* @note shouldn't be used directly. Use the specific property get functions instead.
* For example: `lv_style_get_text_font()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void lv_style_anim_clear_repeat(lv_anim_t * a)
{
lv_anim_clear_repeat(a);
}
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * res);
/**
* Set a user specific data for the animation
* @param a pointer to an initialized `lv_anim_t` variable
* @param user_data the user data
* Get the local style of a style list
* @param list pointer to a style list where the local property should be set
* @return pointer to the local style if exists else `NULL`.
*/
static inline void lv_style_anim_set_user_data(lv_anim_t * a, lv_anim_user_data_t user_data)
{
lv_anim_set_user_data(a, user_data);
}
lv_style_t * lv_style_list_get_local_style(lv_style_list_t * list);
/**
* Get the user data
* @param a pointer to an initialized `lv_anim_t` variable
* @return the user data
* Get the transition style of a style list
* @param list pointer to a style list where the local property should be set
* @return pointer to the transition style if exists else `NULL`.
*/
static inline lv_anim_user_data_t lv_style_anim_get_user_data(lv_anim_t * a)
{
return lv_anim_get_user_data(a);
}
lv_style_t * _lv_style_list_get_transition_style(lv_style_list_t * list);
/**
* Get pointer to the user data
* @param a pointer to an initialized `lv_anim_t` variable
* @return pointer to the user data
* Allocate the transition style in a style list. If already exists simply return it.
* @param list pointer to a style list
* @return the transition style of a style list
*/
static inline lv_anim_user_data_t * lv_style_anim_get_user_data_ptr(lv_anim_t * a)
{
return lv_anim_get_user_data_ptr(a);
}
lv_style_t * _lv_style_list_add_trans_style(lv_style_list_t * list);
/**
* Create an animation
* @param a an initialized 'anim_t' variable. Not required after call.
* Set a local integer typed property in a style list.
* @param list pointer to a style list where the local property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note for performance reasons it's not checked if the property really has integer type
*/
static inline void lv_style_anim_create(lv_anim_t * a)
{
lv_anim_create(a);
}
void _lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value);
#endif
/**
* Set a local color typed property in a style list.
* @param list pointer to a style list where the local property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note for performance reasons it's not checked if the property really has color type
*/
void _lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value);
/**
* Set a local opacity typed property in a style list.
* @param list pointer to a style list where the local property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note for performance reasons it's not checked if the property really has opacity type
*/
void _lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value);
/**
* Set a local pointer typed property in a style list.
* @param list pointer to a style list where the local property should be set
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param value the value to set
* @note for performance reasons it's not checked if the property really has pointer type
*/
void _lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value);
/**
* Get an integer typed property from a style list.
* It will return the property which match best with given state.
* @param list pointer to a style list from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result
* @return LV_RES_OK: there was a matching property in the list
* LV_RES_INV: there was NO matching property in the list
* @note for performance reasons it's not checked if the property really has integer type
*/
lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res);
/**
* Get a color typed property from a style list.
* It will return the property which match best with given state.
* @param list pointer to a style list from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result
* @return LV_RES_OK: there was a matching property in the list
* LV_RES_INV: there was NO matching property in the list
* @note for performance reasons it's not checked if the property really has color type
*/
lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res);
/**
* Get an opacity typed property from a style list.
* It will return the property which match best with given state.
* @param list pointer to a style list from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result
* @return LV_RES_OK: there was a matching property in the list
* LV_RES_INV: there was NO matching property in the list
* @note for performance reasons it's not checked if the property really has opacity type
*/
lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res);
/**
* Get a pointer typed property from a style list.
* It will return the property which match best with given state.
* @param list pointer to a style list from where the property should be get
* @param prop a style property ORed with a state.
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @param res pointer to a buffer to store the result
* @return LV_RES_OK: there was a matching property in the list
* LV_RES_INV: there was NO matching property in the list
* @note for performance reasons it's not checked if the property really has pointer type
*/
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
/**
* Check whether a style is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style(const lv_style_t * style);
/**
* Check whether a style list is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style_list(const lv_style_list_t * list);
/*************************
* GLOBAL VARIABLES
*************************/
extern lv_style_t lv_style_scr;
extern lv_style_t lv_style_transp;
extern lv_style_t lv_style_transp_fit;
extern lv_style_t lv_style_transp_tight;
extern lv_style_t lv_style_plain;
extern lv_style_t lv_style_plain_color;
extern lv_style_t lv_style_pretty;
extern lv_style_t lv_style_pretty_color;
extern lv_style_t lv_style_btn_rel;
extern lv_style_t lv_style_btn_pr;
extern lv_style_t lv_style_btn_tgl_rel;
extern lv_style_t lv_style_btn_tgl_pr;
extern lv_style_t lv_style_btn_ina;
/**********************
* MACROS
**********************/
/**
* Create and initialize a `static` style
* Example:
* LV_STYLE_CREATE(my_style, &style_to_copy);
* is equivalent to
* static lv_style_t my_style;
* lv_style_init(&my_style);
* lv_style_copy(&my_style, &style_to_copy);
*/
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy_p);
#if LV_USE_DEBUG
# ifndef LV_DEBUG_IS_STYLE
# define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
# endif
# ifndef LV_DEBUG_IS_STYLE_LIST
# define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
# endif
# if LV_USE_ASSERT_STYLE
# ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
# else
# define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
# endif
#else
# define LV_ASSERT_STYLE(p) true
# define LV_ASSERT_STYLE_LIST(p) true
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -1,186 +0,0 @@
/**
* @file lv_draw.c
*
*/
/*********************
* INCLUDES
*********************/
#include <stdio.h>
#include <stdbool.h>
#include "lv_draw.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_mem.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
static void * draw_buf = NULL;
static uint32_t draw_buf_size = 0;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Give a buffer with the given to use during drawing.
* Be careful to not use the buffer while other processes are using it.
* @param size the required size
*/
void * lv_draw_get_buf(uint32_t size)
{
if(size <= draw_buf_size) return draw_buf;
LV_LOG_TRACE("lv_draw_get_buf: allocate");
draw_buf_size = size;
if(draw_buf == NULL) {
draw_buf = lv_mem_alloc(size);
lv_mem_assert(draw_buf);
return draw_buf;
}
draw_buf = lv_mem_realloc(draw_buf, size);
lv_mem_assert(draw_buf);
return draw_buf;
}
/**
* Free the draw buffer
*/
void lv_draw_free_buf(void)
{
if(draw_buf) {
lv_mem_free(draw_buf);
draw_buf = NULL;
draw_buf_size = 0;
}
}
#if LV_ANTIALIAS
/**
* Get the opacity of a pixel based it's position in a line segment
* @param seg segment length
* @param px_id position of of a pixel which opacity should be get [0..seg-1]
* @param base_opa the base opacity
* @return the opacity of the given pixel
*/
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa)
{
/* How to calculate the opacity of pixels on the edges which makes the anti-aliasing?
* For example we have a line like this (y = -0.5 * x):
*
* | _ _
* * * |
*
* Anti-aliased pixels come to the '*' characters
* Calculate what percentage of the pixels should be covered if real line (not rasterized) would
* be drawn:
* 1. A real line should start on (0;0) and end on (2;1)
* 2. So the line intersection coordinates on the first pixel: (0;0) (1;0.5) -> 25% covered
* pixel in average
* 3. For the second pixel: (1;0.5) (2;1) -> 75% covered pixel in average
* 4. The equation: (px_id * 2 + 1) / (segment_width * 2)
* segment_width: the line segment which is being anti-aliased (was 2 in the
* example) px_id: pixel ID from 0 to (segment_width - 1) result: [0..1] coverage of the pixel
*/
/*Accelerate the common segment sizes to avoid division*/
static const lv_opa_t seg1[1] = {128};
static const lv_opa_t seg2[2] = {64, 192};
static const lv_opa_t seg3[3] = {42, 128, 212};
static const lv_opa_t seg4[4] = {32, 96, 159, 223};
static const lv_opa_t seg5[5] = {26, 76, 128, 178, 230};
static const lv_opa_t seg6[6] = {21, 64, 106, 148, 191, 234};
static const lv_opa_t seg7[7] = {18, 55, 91, 128, 164, 200, 237};
static const lv_opa_t seg8[8] = {16, 48, 80, 112, 143, 175, 207, 239};
static const lv_opa_t * seg_map[] = {seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8};
if(seg == 0)
return LV_OPA_TRANSP;
else if(seg < 8)
return (uint32_t)((uint32_t)seg_map[seg - 1][px_id] * base_opa) >> 8;
else {
return ((px_id * 2 + 1) * base_opa) / (2 * seg);
}
}
/**
* Add a vertical anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate
* @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area
* @param color color of pixels
* @param opa maximum opacity
*/
void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
lv_opa_t opa)
{
bool aa_inv = false;
if(length < 0) {
aa_inv = true;
length = -length;
}
lv_coord_t i;
for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa;
lv_draw_px(x, y + i, mask, color, px_opa);
}
}
/**
* Add a horizontal anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate
* @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area
* @param color color of pixels
* @param opa maximum opacity
*/
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
lv_opa_t opa)
{
bool aa_inv = false;
if(length < 0) {
aa_inv = true;
length = -length;
}
lv_coord_t i;
for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa;
lv_draw_px(x + i, y, mask, color, px_opa);
}
}
#endif
/**********************
* STATIC FUNCTIONS
**********************/

View File

@@ -13,16 +13,21 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "../lv_conf_internal.h"
#include "../lv_core/lv_style.h"
#include "../lv_misc/lv_txt.h"
#include "lv_img_decoder.h"
#include "lv_draw_rect.h"
#include "lv_draw_label.h"
#include "lv_draw_img.h"
#include "lv_draw_line.h"
#include "lv_draw_triangle.h"
#include "lv_draw_arc.h"
#include "lv_draw_blend.h"
#include "lv_draw_mask.h"
/*********************
* DEFINES
*********************/
@@ -35,54 +40,6 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
/**
* Give a buffer with the given to use during drawing.
* Be careful to not use the buffer while other processes are using it.
* @param size the required size
*/
void * lv_draw_get_buf(uint32_t size);
/**
* Free the draw buffer
*/
void lv_draw_free_buf(void);
#if LV_ANTIALIAS
/**
* Get the opacity of a pixel based it's position in a line segment
* @param seg segment length
* @param px_id position of of a pixel which opacity should be get [0..seg-1]
* @param base_opa the base opacity
* @return the opacity of the given pixel
*/
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa);
/**
* Add a vertical anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate
* @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area
* @param color color of pixels
* @param opa maximum opacity
*/
void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
lv_opa_t opa);
/**
* Add a horizontal anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate
* @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area
* @param color color of pixels
* @param opa maximum opacity
*/
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
lv_opa_t opa);
#endif
/**********************
* GLOBAL VARIABLES
**********************/
@@ -94,13 +51,6 @@ void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_
/**********************
* POST INCLUDES
*********************/
#include "lv_draw_basic.h"
#include "lv_draw_rect.h"
#include "lv_draw_label.h"
#include "lv_draw_img.h"
#include "lv_draw_line.h"
#include "lv_draw_triangle.h"
#include "lv_draw_arc.h"
#ifdef __cplusplus
} /* extern "C" */

View File

@@ -1,5 +1,5 @@
CSRCS += lv_draw_basic.c
CSRCS += lv_draw.c
CSRCS += lv_draw_mask.c
CSRCS += lv_draw_blend.c
CSRCS += lv_draw_rect.c
CSRCS += lv_draw_label.c
CSRCS += lv_draw_line.c
@@ -8,8 +8,9 @@ CSRCS += lv_draw_arc.c
CSRCS += lv_draw_triangle.c
CSRCS += lv_img_decoder.c
CSRCS += lv_img_cache.c
CSRCS += lv_img_buf.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_draw
VPATH += :$(LVGL_DIR)/lvgl/src/lv_draw
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw
CFLAGS += "-I$(LVGL_DIR)lvgl/src/lv_draw"
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw"

View File

@@ -7,26 +7,43 @@
* INCLUDES
*********************/
#include "lv_draw_arc.h"
#include "lv_draw_rect.h"
#include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater then this the arc will drawn in quarters. A quarter is drawn only if there is arc in it */
#define SPLIT_ANGLE_GAP_LIMIT 60 /*With small gaps in the arc don't bother with splitting because there is nothing to skip.*/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_coord_t center_x;
lv_coord_t center_y;
lv_coord_t radius;
uint16_t start_angle;
uint16_t end_angle;
uint16_t start_quarter;
uint16_t end_quarter;
lv_coord_t width;
lv_draw_rect_dsc_t * draw_dsc;
const lv_area_t * draw_area;
const lv_area_t * clip_area;
} quarter_draw_dsc_t;
/**********************
* STATIC PROTOTYPES
**********************/
static uint16_t fast_atan2(int x, int y);
static void ver_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color,
lv_opa_t opa);
static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color,
lv_opa_t opa);
static bool deg_test_norm(uint16_t deg, uint16_t start, uint16_t end);
static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end);
static void draw_quarter_0(quarter_draw_dsc_t * q);
static void draw_quarter_1(quarter_draw_dsc_t * q);
static void draw_quarter_2(quarter_draw_dsc_t * q);
static void draw_quarter_3(quarter_draw_dsc_t * q);
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area);
/**********************
* STATIC VARIABLES
@@ -48,226 +65,371 @@ static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end);
* @param mask the arc will be drawn only in this mask
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
* @param end_angle the end angle of the arc
* @param style style of the arc (`body.thickness`, `body.main_color`, `body.opa` is used)
* @param opa_scale scale down all opacities by the factor
* @param clip_area the arc will be drawn only in this area
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask,
uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale)
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc)
{
lv_coord_t thickness = style->line.width;
if(thickness > radius) thickness = radius;
if(dsc->opa <= LV_OPA_MIN) return;
if(dsc->width == 0) return;
if(start_angle == end_angle) return;
lv_coord_t r_out = radius;
lv_coord_t r_in = r_out - thickness;
int16_t deg_base;
int16_t deg;
lv_coord_t x_start[4];
lv_coord_t x_end[4];
lv_style_int_t width = dsc->width;
if(width > radius) width = radius;
lv_color_t color = style->line.color;
lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;
lv_draw_rect_dsc_t cir_dsc;
lv_draw_rect_dsc_init(&cir_dsc);
cir_dsc.radius = LV_RADIUS_CIRCLE;
cir_dsc.bg_opa = LV_OPA_TRANSP;
cir_dsc.border_opa = dsc->opa;
cir_dsc.border_color = dsc->color;
cir_dsc.border_width = width;
cir_dsc.border_blend_mode = dsc->blend_mode;
bool (*deg_test)(uint16_t, uint16_t, uint16_t);
if(start_angle <= end_angle)
deg_test = deg_test_norm;
else
deg_test = deg_test_inv;
lv_area_t area;
area.x1 = center_x - radius;
area.y1 = center_y - radius;
area.x2 = center_x + radius - 1; /*-1 because the center already belongs to the left/bottom part*/
area.y2 = center_y + radius - 1;
if(deg_test(270, start_angle, end_angle))
hor_line(center_x - r_out + 1, center_y, mask, thickness - 1, color, opa); // Left Middle
if(deg_test(90, start_angle, end_angle))
hor_line(center_x + r_in, center_y, mask, thickness - 1, color, opa); // Right Middle
if(deg_test(180, start_angle, end_angle))
ver_line(center_x, center_y - r_out + 1, mask, thickness - 1, color, opa); // Top Middle
if(deg_test(0, start_angle, end_angle))
ver_line(center_x, center_y + r_in, mask, thickness - 1, color, opa); // Bottom middle
/*Draw a full ring*/
if(start_angle + 360 == end_angle || start_angle == end_angle + 360) {
lv_draw_rect(&area, clip_area, &cir_dsc);
return;
}
uint32_t r_out_sqr = r_out * r_out;
uint32_t r_in_sqr = r_in * r_in;
int16_t xi;
int16_t yi;
for(yi = -r_out; yi < 0; yi++) {
x_start[0] = LV_COORD_MIN;
x_start[1] = LV_COORD_MIN;
x_start[2] = LV_COORD_MIN;
x_start[3] = LV_COORD_MIN;
x_end[0] = LV_COORD_MIN;
x_end[1] = LV_COORD_MIN;
x_end[2] = LV_COORD_MIN;
x_end[3] = LV_COORD_MIN;
for(xi = -r_out; xi < 0; xi++) {
if(start_angle >= 360) start_angle -= 360;
if(end_angle >= 360) end_angle -= 360;
uint32_t r_act_sqr = xi * xi + yi * yi;
if(r_act_sqr > r_out_sqr) continue;
lv_draw_mask_angle_param_t mask_angle_param;
lv_draw_mask_angle_init(&mask_angle_param, center_x, center_y, start_angle, end_angle);
deg_base = fast_atan2(xi, yi) - 180;
int16_t mask_angle_id = lv_draw_mask_add(&mask_angle_param, NULL);
deg = 180 + deg_base;
if(deg_test(deg, start_angle, end_angle)) {
if(x_start[0] == LV_COORD_MIN) x_start[0] = xi;
} else if(x_start[0] != LV_COORD_MIN && x_end[0] == LV_COORD_MIN) {
x_end[0] = xi - 1;
}
int32_t angle_gap;
if(end_angle > start_angle) {
angle_gap = 360 - (end_angle - start_angle);
}
else {
angle_gap = start_angle - end_angle;
}
if(angle_gap > SPLIT_ANGLE_GAP_LIMIT && radius > SPLIT_RADIUS_LIMIT) {
/*Handle each quarter individually and skip which is empty*/
quarter_draw_dsc_t q_dsc;
q_dsc.center_x = center_x;
q_dsc.center_y = center_y;
q_dsc.radius = radius;
q_dsc.start_angle = start_angle;
q_dsc.end_angle = end_angle;
q_dsc.start_quarter = (start_angle / 90) & 0x3;
q_dsc.end_quarter = (end_angle / 90) & 0x3;
q_dsc.width = width;
q_dsc.draw_dsc = &cir_dsc;
q_dsc.draw_area = &area;
q_dsc.clip_area = clip_area;
deg = 360 - deg_base;
if(deg_test(deg, start_angle, end_angle)) {
if(x_start[1] == LV_COORD_MIN) x_start[1] = xi;
} else if(x_start[1] != LV_COORD_MIN && x_end[1] == LV_COORD_MIN) {
x_end[1] = xi - 1;
}
draw_quarter_0(&q_dsc);
draw_quarter_1(&q_dsc);
draw_quarter_2(&q_dsc);
draw_quarter_3(&q_dsc);
}
else {
lv_draw_rect(&area, clip_area, &cir_dsc);
}
lv_draw_mask_remove_id(mask_angle_id);
deg = 180 - deg_base;
if(deg_test(deg, start_angle, end_angle)) {
if(x_start[2] == LV_COORD_MIN) x_start[2] = xi;
} else if(x_start[2] != LV_COORD_MIN && x_end[2] == LV_COORD_MIN) {
x_end[2] = xi - 1;
}
if(dsc->round_start || dsc->round_end) {
cir_dsc.bg_color = dsc->color;
cir_dsc.bg_opa = dsc->opa;
cir_dsc.bg_blend_mode = dsc->blend_mode;
cir_dsc.border_width = 0;
deg = deg_base;
if(deg_test(deg, start_angle, end_angle)) {
if(x_start[3] == LV_COORD_MIN) x_start[3] = xi;
} else if(x_start[3] != LV_COORD_MIN && x_end[3] == LV_COORD_MIN) {
x_end[3] = xi - 1;
}
lv_area_t round_area;
if(dsc->round_start) {
get_rounded_area(start_angle, radius, width, &round_area);
round_area.x1 += center_x;
round_area.x2 += center_x;
round_area.y1 += center_y;
round_area.y2 += center_y;
if(r_act_sqr < r_in_sqr)
break; /*No need to continue the iteration in x once we found the inner edge of the
arc*/
lv_draw_rect(&round_area, clip_area, &cir_dsc);
}
if(x_start[0] != LV_COORD_MIN) {
if(x_end[0] == LV_COORD_MIN) x_end[0] = xi - 1;
hor_line(center_x + x_start[0], center_y + yi, mask, x_end[0] - x_start[0], color, opa);
if(dsc->round_end) {
get_rounded_area(end_angle, radius, width, &round_area);
round_area.x1 += center_x;
round_area.x2 += center_x;
round_area.y1 += center_y;
round_area.y2 += center_y;
lv_draw_rect(&round_area, clip_area, &cir_dsc);
}
if(x_start[1] != LV_COORD_MIN) {
if(x_end[1] == LV_COORD_MIN) x_end[1] = xi - 1;
hor_line(center_x + x_start[1], center_y - yi, mask, x_end[1] - x_start[1], color, opa);
}
if(x_start[2] != LV_COORD_MIN) {
if(x_end[2] == LV_COORD_MIN) x_end[2] = xi - 1;
hor_line(center_x - x_end[2], center_y + yi, mask, LV_MATH_ABS(x_end[2] - x_start[2]), color, opa);
}
if(x_start[3] != LV_COORD_MIN) {
if(x_end[3] == LV_COORD_MIN) x_end[3] = xi - 1;
hor_line(center_x - x_end[3], center_y - yi, mask, LV_MATH_ABS(x_end[3] - x_start[3]), color, opa);
}
#if LV_ANTIALIAS
/*TODO*/
#endif
}
}
static uint16_t fast_atan2(int x, int y)
{
// Fast XY vector to integer degree algorithm - Jan 2011 www.RomanBlack.com
// Converts any XY values including 0 to a degree value that should be
// within +/- 1 degree of the accurate value without needing
// large slow trig functions like ArcTan() or ArcCos().
// NOTE! at least one of the X or Y values must be non-zero!
// This is the full version, for all 4 quadrants and will generate
// the angle in integer degrees from 0-360.
// Any values of X and Y are usable including negative values provided
// they are between -1456 and 1456 so the 16bit multiply does not overflow.
unsigned char negflag;
unsigned char tempdegree;
unsigned char comp;
unsigned int degree; // this will hold the result
// signed int x; // these hold the XY vector at the start
// signed int y; // (and they will be destroyed)
unsigned int ux;
unsigned int uy;
// Save the sign flags then remove signs and get XY as unsigned ints
negflag = 0;
if(x < 0) {
negflag += 0x01; // x flag bit
x = (0 - x); // is now +
}
ux = x; // copy to unsigned var before multiply
if(y < 0) {
negflag += 0x02; // y flag bit
y = (0 - y); // is now +
}
uy = y; // copy to unsigned var before multiply
// 1. Calc the scaled "degrees"
if(ux > uy) {
degree = (uy * 45) / ux; // degree result will be 0-45 range
negflag += 0x10; // octant flag bit
} else {
degree = (ux * 45) / uy; // degree result will be 0-45 range
}
// 2. Compensate for the 4 degree error curve
comp = 0;
tempdegree = degree; // use an unsigned char for speed!
if(tempdegree > 22) { // if top half of range
if(tempdegree <= 44) comp++;
if(tempdegree <= 41) comp++;
if(tempdegree <= 37) comp++;
if(tempdegree <= 32) comp++; // max is 4 degrees compensated
} else { // else is lower half of range
if(tempdegree >= 2) comp++;
if(tempdegree >= 6) comp++;
if(tempdegree >= 10) comp++;
if(tempdegree >= 15) comp++; // max is 4 degrees compensated
}
degree += comp; // degree is now accurate to +/- 1 degree!
// Invert degree if it was X>Y octant, makes 0-45 into 90-45
if(negflag & 0x10) degree = (90 - degree);
// 3. Degree is now 0-90 range for this quadrant,
// need to invert it for whichever quadrant it was in
if(negflag & 0x02) { // if -Y
if(negflag & 0x01) // if -Y -X
degree = (180 + degree);
else // else is -Y +X
degree = (180 - degree);
} else { // else is +Y
if(negflag & 0x01) // if +Y -X
degree = (360 - degree);
}
return degree;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void ver_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa)
{
lv_area_t area;
lv_area_set(&area, x, y, x, y + len);
lv_draw_fill(&area, mask, color, opa);
static void draw_quarter_0(quarter_draw_dsc_t * q)
{
lv_area_t quarter_area;
if(q->start_quarter == 0 && q->end_quarter == 0 && q->start_angle < q->end_angle) {
/*Small arc here*/
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
else if(q->start_quarter == 0 || q->end_quarter == 0) {
/*Start and/or end arcs here*/
if(q->start_quarter == 0) {
quarter_area.x1 = q->center_x;
quarter_area.y2 = q->center_y + q->radius;
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
if(q->end_quarter == 0) {
quarter_area.x2 = q->center_x + q->radius;
quarter_area.y1 = q->center_y;
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
else if((q->start_quarter == q->end_quarter && q->start_quarter != 0 && q->end_angle < q->start_angle) ||
(q->start_quarter == 2 && q->end_quarter == 1) ||
(q->start_quarter == 3 && q->end_quarter == 2) ||
(q->start_quarter == 3 && q->end_quarter == 1)) {
/*Arc crosses here*/
quarter_area.x1 = q->center_x;
quarter_area.y1 = q->center_y;
quarter_area.x2 = q->center_x + q->radius;
quarter_area.y2 = q->center_y + q->radius;
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa)
static void draw_quarter_1(quarter_draw_dsc_t * q)
{
lv_area_t area;
lv_area_set(&area, x, y, x + len, y);
lv_area_t quarter_area;
lv_draw_fill(&area, mask, color, opa);
if(q->start_quarter == 1 && q->end_quarter == 1 && q->start_angle < q->end_angle) {
/*Small arc here*/
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
else if(q->start_quarter == 1 || q->end_quarter == 1) {
/*Start and/or end arcs here*/
if(q->start_quarter == 1) {
quarter_area.x1 = q->center_x - q->radius;
quarter_area.y1 = q->center_y;
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
if(q->end_quarter == 1) {
quarter_area.x2 = q->center_x - 1;
quarter_area.y2 = q->center_y + q->radius;
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
else if((q->start_quarter == q->end_quarter && q->start_quarter != 1 && q->end_angle < q->start_angle) ||
(q->start_quarter == 0 && q->end_quarter == 2) ||
(q->start_quarter == 0 && q->end_quarter == 3) ||
(q->start_quarter == 3 && q->end_quarter == 2)) {
/*Arc crosses here*/
quarter_area.x1 = q->center_x - q->radius;
quarter_area.y1 = q->center_y;
quarter_area.x2 = q->center_x - 1;
quarter_area.y2 = q->center_y + q->radius;
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
static bool deg_test_norm(uint16_t deg, uint16_t start, uint16_t end)
static void draw_quarter_2(quarter_draw_dsc_t * q)
{
if(deg >= start && deg <= end)
return true;
else
return false;
lv_area_t quarter_area;
if(q->start_quarter == 2 && q->end_quarter == 2 && q->start_angle < q->end_angle) {
/*Small arc here*/
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
else if(q->start_quarter == 2 || q->end_quarter == 2) {
/*Start and/or end arcs here*/
if(q->start_quarter == 2) {
quarter_area.x2 = q->center_x - 1;
quarter_area.y1 = q->center_y - q->radius;
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
if(q->end_quarter == 2) {
quarter_area.x1 = q->center_x - q->radius;
quarter_area.y2 = q->center_y - 1;
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
else if((q->start_quarter == q->end_quarter && q->start_quarter != 2 && q->end_angle < q->start_angle) ||
(q->start_quarter == 0 && q->end_quarter == 3) ||
(q->start_quarter == 1 && q->end_quarter == 3) ||
(q->start_quarter == 1 && q->end_quarter == 0)) {
/*Arc crosses here*/
quarter_area.x1 = q->center_x - q->radius;
quarter_area.y1 = q->center_y - q->radius;
quarter_area.x2 = q->center_x - 1;
quarter_area.y2 = q->center_y - 1;
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end)
static void draw_quarter_3(quarter_draw_dsc_t * q)
{
if(deg >= start || deg <= end) {
return true;
} else
return false;
lv_area_t quarter_area;
if(q->start_quarter == 3 && q->end_quarter == 3 && q->start_angle < q->end_angle) {
/*Small arc here*/
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
else if(q->start_quarter == 3 || q->end_quarter == 3) {
/*Start and/or end arcs here*/
if(q->start_quarter == 3) {
quarter_area.x2 = q->center_x + q->radius;
quarter_area.y2 = q->center_y - 1;
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
if(q->end_quarter == 3) {
quarter_area.x1 = q->center_x;
quarter_area.y1 = q->center_y - q->radius;
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
else if((q->start_quarter == q->end_quarter && q->start_quarter != 3 && q->end_angle < q->start_angle) ||
(q->start_quarter == 2 && q->end_quarter == 0) ||
(q->start_quarter == 1 && q->end_quarter == 0) ||
(q->start_quarter == 2 && q->end_quarter == 1)) {
/*Arc crosses here*/
quarter_area.x1 = q->center_x;
quarter_area.y1 = q->center_y - q->radius;
quarter_area.x2 = q->center_x + q->radius;
quarter_area.y2 = q->center_y - 1;
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
}
}
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area)
{
const uint8_t ps = 8;
const uint8_t pa = 127;
int32_t thick_half = tickness / 2;
uint8_t thick_corr = (tickness & 0x01) ? 0 : 1;
int32_t rx_corr;
int32_t ry_corr;
if(angle > 90 && angle < 270) rx_corr = 0;
else rx_corr = 0;
if(angle > 0 && angle < 180) ry_corr = 0;
else ry_corr = 0;
int32_t cir_x;
int32_t cir_y;
cir_x = ((radius - rx_corr - thick_half) * _lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
cir_y = ((radius - ry_corr - thick_half) * _lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
/* Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
if(cir_x > 0) {
cir_x = (cir_x - pa) >> ps;
res_area->x1 = cir_x - thick_half + thick_corr;
res_area->x2 = cir_x + thick_half;
}
else {
cir_x = (cir_x + pa) >> ps;
res_area->x1 = cir_x - thick_half;
res_area->x2 = cir_x + thick_half - thick_corr;
}
if(cir_y > 0) {
cir_y = (cir_y - pa) >> ps;
res_area->y1 = cir_y - thick_half + thick_corr;
res_area->y2 = cir_y + thick_half;
}
else {
cir_y = (cir_y + pa) >> ps;
res_area->y1 = cir_y - thick_half;
res_area->y2 = cir_y + thick_half - thick_corr;
}
}

View File

@@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "lv_draw_line.h"
/*********************
* DEFINES
@@ -35,11 +35,11 @@ extern "C" {
* @param mask the arc will be drawn only in this mask
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
* @param end_angle the end angle of the arc
* @param style style of the arc (`body.thickness`, `body.main_color`, `body.opa` is used)
* @param opa_scale scale down all opacities by the factor
* @param clip_area the arc will be drawn only in this area
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask,
uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale);
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc);
/**********************
* MACROS

View File

@@ -1,714 +0,0 @@
/**
* @file lv_draw_basic.c
*
*/
#include "lv_draw_basic.h"
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "../lv_core/lv_refr.h"
#include "../lv_hal/lv_hal.h"
#include "../lv_font/lv_font.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_log.h"
#include <stddef.h>
#include "lv_draw.h"
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/
#define VFILL_HW_ACC_SIZE_LIMIT 50
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_t * fill_area, lv_color_t color,
lv_opa_t opa);
static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Put a pixel in the Virtual Display Buffer
* @param x pixel x coordinate
* @param y pixel y coordinate
* @param mask_p fill only on this mask (truncated to VDB area)
* @param color pixel color
* @param opa opacity of the area (0..255)
*/
void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
{
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
/*Pixel out of the mask*/
if(x < mask_p->x1 || x > mask_p->x2 || y < mask_p->y1 || y > mask_p->y2) {
return;
}
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
uint32_t vdb_width = lv_area_get_width(&vdb->area);
/*Make the coordinates relative to VDB*/
x -= vdb->area.x1;
y -= vdb->area.y1;
if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
} else {
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
lv_color_t * vdb_px_p = vdb->buf_act;
vdb_px_p += y * vdb_width + x;
if(scr_transp == false) {
if(opa == LV_OPA_COVER) {
*vdb_px_p = color;
} else {
*vdb_px_p = lv_color_mix(color, *vdb_px_p, opa);
}
} else {
#if LV_COLOR_DEPTH == 32
*vdb_px_p = color_mix_2_alpha(*vdb_px_p, (*vdb_px_p).ch.alpha, color, opa);
#endif
}
}
}
/**
* Fill an area in the Virtual Display Buffer
* @param cords_p coordinates of the area to fill
* @param mask_p fill only o this mask (truncated to VDB area)
* @param color fill color
* @param opa opacity of the area (0..255)
*/
void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
{
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
lv_area_t res_a;
bool union_ok;
/*Get the union of cord and mask*/
/* The mask is already truncated to the vdb size
* in 'lv_refr_area_with_vdb' function */
union_ok = lv_area_intersect(&res_a, cords_p, mask_p);
/*If there are common part of the three area then draw to the vdb*/
if(union_ok == false) {
return;
}
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
lv_area_t vdb_rel_a; /*Stores relative coordinates on vdb*/
vdb_rel_a.x1 = res_a.x1 - vdb->area.x1;
vdb_rel_a.y1 = res_a.y1 - vdb->area.y1;
vdb_rel_a.x2 = res_a.x2 - vdb->area.x1;
vdb_rel_a.y2 = res_a.y2 - vdb->area.y1;
lv_color_t * vdb_buf_tmp = vdb->buf_act;
uint32_t vdb_width = lv_area_get_width(&vdb->area);
/*Move the vdb_tmp to the first row*/
vdb_buf_tmp += vdb_width * vdb_rel_a.y1;
#if LV_USE_GPU
static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES_MAX]; /*Used by 'lv_disp_mem_blend'*/
static lv_coord_t last_width = -1;
lv_coord_t w = lv_area_get_width(&vdb_rel_a);
/*Don't use hw. acc. for every small fill (because of the init overhead)*/
if(w < VFILL_HW_ACC_SIZE_LIMIT) {
sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa);
}
/*Not opaque fill*/
else if(opa == LV_OPA_COVER) {
/*Use hw fill if present*/
if(disp->driver.gpu_fill_cb) {
disp->driver.gpu_fill_cb(&disp->driver, vdb->buf_act, vdb_width, &vdb_rel_a, color);
}
/*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT && disp->driver.gpu_blend_cb) {
/*Fill a one line sized buffer with a color and blend this later*/
if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i;
for(i = 0; i < w; i++) {
color_array_tmp[i].full = color.full;
}
last_width = w;
}
/*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.gpu_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
}
/*Else use sw fill if no better option*/
else {
sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa);
}
}
/*Fill with opacity*/
else {
/*Use hw blend if present*/
if(disp->driver.gpu_blend_cb) {
if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i;
for(i = 0; i < w; i++) {
color_array_tmp[i].full = color.full;
}
last_width = w;
}
lv_coord_t row;
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
disp->driver.gpu_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width;
}
}
/*Use sw fill with opa if no better option*/
else {
sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa);
}
}
#else
sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa);
#endif
}
/**
* Draw a letter in the Virtual Display Buffer
* @param pos_p left-top coordinate of the latter
* @param mask_p the letter will be drawn only on this area (truncated to VDB area)
* @param font_p pointer to font
* @param letter a letter to draw
* @param color color of letter
* @param opa opacity of letter (0..255)
*/
void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa)
{
/*clang-format off*/
const uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
const uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
const uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255};
/*clang-format on*/
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
if(font_p == NULL) {
LV_LOG_WARN("Font: character's bitmap not found");
return;
}
lv_font_glyph_dsc_t g;
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
if(g_ret == false) return;
lv_coord_t pos_x = pos_p->x + g.ofs_x;
lv_coord_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
const uint8_t * bpp_opa_table;
uint8_t bitmask_init;
uint8_t bitmask;
switch(g.bpp) {
case 1:
bpp_opa_table = bpp1_opa_table;
bitmask_init = 0x80;
break;
case 2:
bpp_opa_table = bpp2_opa_table;
bitmask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
bitmask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
bitmask_init = 0xFF;
break; /*No opa table, pixel value will be used directly*/
default: return; /*Invalid bpp. Can't render the letter*/
}
const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter);
if(map_p == NULL) return;
/*If the letter is completely out of mask don't draw it */
if(pos_x + g.box_w < mask_p->x1 || pos_x > mask_p->x2 || pos_y + g.box_h < mask_p->y1 || pos_y > mask_p->y2) return;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
lv_coord_t vdb_width = lv_area_get_width(&vdb->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
lv_coord_t col, row;
uint8_t width_byte_scr = g.box_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
if(g.box_w & 0x7) width_byte_scr++;
uint16_t width_bit = g.box_w * g.bpp; /*Letter width in bits*/
/* Calculate the col/row start/end on the map*/
lv_coord_t col_start = pos_x >= mask_p->x1 ? 0 : mask_p->x1 - pos_x;
lv_coord_t col_end = pos_x + g.box_w <= mask_p->x2 ? g.box_w : mask_p->x2 - pos_x + 1;
lv_coord_t row_start = pos_y >= mask_p->y1 ? 0 : mask_p->y1 - pos_y;
lv_coord_t row_end = pos_y + g.box_h <= mask_p->y2 ? g.box_h : mask_p->y2 - pos_y + 1;
/*Set a pointer on VDB to the first pixel of the letter*/
vdb_buf_tmp += ((pos_y - vdb->area.y1) * vdb_width) + pos_x - vdb->area.x1;
/*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp += (row_start * vdb_width) + col_start;
/*Move on the map too*/
uint32_t bit_ofs = (row_start * width_bit) + (col_start * g.bpp);
map_p += bit_ofs >> 3;
uint8_t letter_px;
lv_opa_t px_opa;
uint16_t col_bit;
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
for(row = row_start; row < row_end; row++) {
bitmask = bitmask_init >> col_bit;
for(col = col_start; col < col_end; col++) {
letter_px = (*map_p & bitmask) >> (8 - col_bit - g.bpp);
if(letter_px != 0) {
if(opa == LV_OPA_COVER) {
px_opa = g.bpp == 8 ? letter_px : bpp_opa_table[letter_px];
} else {
px_opa = g.bpp == 8 ? (uint16_t)((uint16_t)letter_px * opa) >> 8
: (uint16_t)((uint16_t)bpp_opa_table[letter_px] * opa) >> 8;
}
if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width,
(col + pos_x) - vdb->area.x1, (row + pos_y) - vdb->area.y1, color, px_opa);
} else if(vdb_buf_tmp->full != color.full) {
if(px_opa > LV_OPA_MAX)
*vdb_buf_tmp = color;
else if(px_opa > LV_OPA_MIN) {
if(scr_transp == false) {
*vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, px_opa);
} else {
#if LV_COLOR_DEPTH == 32
*vdb_buf_tmp = color_mix_2_alpha(*vdb_buf_tmp, (*vdb_buf_tmp).ch.alpha, color, px_opa);
#endif
}
}
}
}
vdb_buf_tmp++;
if(col_bit < 8 - g.bpp) {
col_bit += g.bpp;
bitmask = bitmask >> g.bpp;
} else {
col_bit = 0;
bitmask = bitmask_init;
map_p++;
}
}
col_bit += ((g.box_w - col_end) + col_start) * g.bpp;
map_p += (col_bit >> 3);
col_bit = col_bit & 0x7;
vdb_buf_tmp += vdb_width - (col_end - col_start); /*Next row in VDB*/
}
}
/**
* Draw a color map to the display (image)
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area (truncated to VDB area)
* @param map_p pointer to a lv_color_t array
* @param opa opacity of the map
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint8_t * map_p, lv_opa_t opa,
bool chroma_key, bool alpha_byte, lv_color_t recolor, lv_opa_t recolor_opa)
{
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
lv_area_t masked_a;
bool union_ok;
/*Get the union of map size and mask*/
/* The mask is already truncated to the vdb size
* in 'lv_refr_area_with_vdb' function */
union_ok = lv_area_intersect(&masked_a, cords_p, mask_p);
/*If there are common part of the three area then draw to the vdb*/
if(union_ok == false) return;
/*The pixel size in byte is different if an alpha byte is added too*/
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
/*If the map starts OUT of the masked area then calc. the first pixel*/
lv_coord_t map_width = lv_area_get_width(cords_p);
if(cords_p->y1 < masked_a.y1) {
map_p += (uint32_t)map_width * ((masked_a.y1 - cords_p->y1)) * px_size_byte;
}
if(cords_p->x1 < masked_a.x1) {
map_p += (masked_a.x1 - cords_p->x1) * px_size_byte;
}
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
/*Stores coordinates relative to the current VDB*/
masked_a.x1 = masked_a.x1 - vdb->area.x1;
masked_a.y1 = masked_a.y1 - vdb->area.y1;
masked_a.x2 = masked_a.x2 - vdb->area.x1;
masked_a.y2 = masked_a.y2 - vdb->area.y1;
lv_coord_t vdb_width = lv_area_get_width(&vdb->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
vdb_buf_tmp += (uint32_t)vdb_width * masked_a.y1; /*Move to the first row*/
vdb_buf_tmp += (uint32_t)masked_a.x1; /*Move to the first col*/
lv_coord_t row;
lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
/*The simplest case just copy the pixels into the VDB*/
if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) {
/*Use the custom VDB write function is exists*/
if(disp->driver.set_px_cb) {
lv_coord_t col;
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = 0; col < map_useful_w; col++) {
lv_color_t px_color = *((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]);
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, row,
px_color, opa);
}
map_p += map_width * px_size_byte; /*Next row on the map*/
}
}
/*Normal native VDB*/
else {
for(row = masked_a.y1; row <= masked_a.y2; row++) {
#if LV_USE_GPU
if(disp->driver.gpu_blend_cb == false) {
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
} else {
disp->driver.gpu_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
}
#else
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
#endif
map_p += map_width * px_size_byte; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
}
}
/*In the other cases every pixel need to be checked one-by-one*/
else {
lv_coord_t col;
lv_color_t last_img_px = LV_COLOR_BLACK;
lv_color_t recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa);
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = 0; col < map_useful_w; col++) {
lv_opa_t opa_result = opa;
uint8_t * px_color_p = (uint8_t *)&map_p[(uint32_t)col * px_size_byte];
lv_color_t px_color;
/*Calculate with the pixel level alpha*/
if(alpha_byte) {
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
px_color.full = px_color_p[0];
#elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause
* crash*/
px_color.full = px_color_p[0] + (px_color_p[1] << 8);
#elif LV_COLOR_DEPTH == 32
px_color = *((lv_color_t *)px_color_p);
#endif
lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1);
if(px_opa == LV_OPA_TRANSP)
continue;
else if(px_opa != LV_OPA_COVER)
opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8;
} else {
px_color = *((lv_color_t *)px_color_p);
}
/*Handle chroma key*/
if(chroma_key && px_color.full == disp->driver.color_chroma_key.full) continue;
/*Re-color the pixel if required*/
if(recolor_opa != LV_OPA_TRANSP) {
if(last_img_px.full != px_color.full) { /*Minor acceleration: calculate only for
new colors (save the last)*/
last_img_px = px_color;
recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa);
}
/*Handle custom VDB write is present*/
if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1,
row, recolored_px, opa_result);
}
/*Normal native VDB write*/
else {
if(opa_result == LV_OPA_COVER)
vdb_buf_tmp[col].full = recolored_px.full;
else
vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result);
}
} else {
/*Handle custom VDB write is present*/
if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1,
row, px_color, opa_result);
}
/*Normal native VDB write*/
else {
if(opa_result == LV_OPA_COVER)
vdb_buf_tmp[col] = px_color;
else {
if(scr_transp == false) {
vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
} else {
#if LV_COLOR_DEPTH == 32
vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha,
px_color, opa_result);
#endif
}
}
}
}
}
map_p += map_width * px_size_byte; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
}
}
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Blend pixels to destination memory using opacity
* @param dest a memory address. Copy 'src' here.
* @param src pointer to pixel map. Copy it to 'dest'.
* @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/
static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
if(opa == LV_OPA_COVER) {
memcpy(dest, src, length * sizeof(lv_color_t));
} else {
uint32_t col;
for(col = 0; col < length; col++) {
dest[col] = lv_color_mix(src[col], dest[col], opa);
}
}
}
/**
* Fill an area with a color
* @param mem a memory address. Considered to a rectangular window according to 'mem_area'
* @param mem_width width of the 'mem' buffer
* @param fill_area coordinates of an area to fill. Relative to 'mem_area'.
* @param color fill color
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/
static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_t * fill_area, lv_color_t color,
lv_opa_t opa)
{
/*Set all row in vdb to the given color*/
lv_coord_t row;
lv_coord_t col;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.set_px_cb) {
for(col = fill_area->x1; col <= fill_area->x2; col++) {
for(row = fill_area->y1; row <= fill_area->y2; row++) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)mem, mem_width, col, row, color, opa);
}
}
} else {
mem += fill_area->y1 * mem_width; /*Go to the first row*/
/*Run simpler function without opacity*/
if(opa == LV_OPA_COVER) {
/*Fill the first row with 'color'*/
for(col = fill_area->x1; col <= fill_area->x2; col++) {
mem[col] = color;
}
/*Copy the first row to all other rows*/
lv_color_t * mem_first = &mem[fill_area->x1];
lv_coord_t copy_size = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t);
mem += mem_width;
for(row = fill_area->y1 + 1; row <= fill_area->y2; row++) {
memcpy(&mem[fill_area->x1], mem_first, copy_size);
mem += mem_width;
}
}
/*Calculate with alpha too*/
else {
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
lv_color_t bg_tmp = LV_COLOR_BLACK;
lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa);
for(row = fill_area->y1; row <= fill_area->y2; row++) {
for(col = fill_area->x1; col <= fill_area->x2; col++) {
if(scr_transp == false) {
/*If the bg color changed recalculate the result color*/
if(mem[col].full != bg_tmp.full) {
bg_tmp = mem[col];
opa_tmp = lv_color_mix(color, bg_tmp, opa);
}
mem[col] = opa_tmp;
} else {
#if LV_COLOR_DEPTH == 32
mem[col] = color_mix_2_alpha(mem[col], mem[col].ch.alpha, color, opa);
#endif
}
}
mem += mem_width;
}
}
}
}
/**
* Mix two colors. Both color can have alpha value. It requires ARGB888 colors.
* @param bg_color background color
* @param bg_opa alpha of the background color
* @param fg_color foreground color
* @param fg_opa alpha of the foreground color
* @return the mixed color. the alpha channel (color.alpha) contains the result alpha
*/
static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa)
{
#if LV_COLOR_SCREEN_TRANSP
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/
if(fg_opa > LV_OPA_MAX || bg_opa <= LV_OPA_MIN) {
fg_color.ch.alpha = fg_opa;
return fg_color;
}
/*Transparent foreground: use the Background*/
else if(fg_opa <= LV_OPA_MIN) {
return bg_color;
}
/*Opaque background: use simple mix*/
else if(bg_opa >= LV_OPA_MAX) {
return lv_color_mix(fg_color, bg_color, fg_opa);
}
/*Both colors have alpha. Expensive calculation need to be applied*/
else {
/*Save the parameters and the result. If they will be asked again don't compute again*/
static lv_opa_t fg_opa_save = 0;
static lv_opa_t bg_opa_save = 0;
static lv_color_t fg_color_save = {{0}};
static lv_color_t bg_color_save = {{0}};
static lv_color_t c = {{0}};
if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full ||
bg_color.full != bg_color_save.full) {
fg_opa_save = fg_opa;
bg_opa_save = bg_opa;
fg_color_save.full = fg_color.full;
bg_color_save.full = bg_color.full;
/*Info:
* https://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator*/
lv_opa_t alpha_res = 255 - ((uint16_t)((uint16_t)(255 - fg_opa) * (255 - bg_opa)) >> 8);
if(alpha_res == 0) {
while(1)
;
}
lv_opa_t ratio = (uint16_t)((uint16_t)fg_opa * 255) / alpha_res;
c = lv_color_mix(fg_color, bg_color, ratio);
c.ch.alpha = alpha_res;
}
return c;
}
#else
(void)bg_color; /*Unused*/
(void)fg_color; /*Unused*/
(void)bg_opa; /*Unused*/
(void)fg_opa; /*Unused*/
return LV_COLOR_BLACK;
#endif /*LV_COLOR_SCREEN_TRANSP*/
}

View File

@@ -1,82 +0,0 @@
/**
* @file lv_draw_basic.h
*
*/
#ifndef LV_DRAW_BASIC_H
#define LV_DRAW_BASIC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "../lv_font/lv_font.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa);
/**
* Fill an area in the Virtual Display Buffer
* @param cords_p coordinates of the area to fill
* @param mask_p fill only o this mask
* @param color fill color
* @param opa opacity of the area (0..255)
*/
void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa);
/**
* Draw a letter in the Virtual Display Buffer
* @param pos_p left-top coordinate of the latter
* @param mask_p the letter will be drawn only on this area
* @param font_p pointer to font
* @param letter a letter to draw
* @param color color of letter
* @param opa opacity of letter (0..255)
*/
void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa);
/**
* Draw a color map to the display (image)
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area (truncated to VDB area)
* @param map_p pointer to a lv_color_t array
* @param opa opacity of the map
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint8_t * map_p, lv_opa_t opa,
bool chroma_key, bool alpha_byte, lv_color_t recolor, lv_opa_t recolor_opa);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_DRAW_BASIC_H*/

1008
src/lv_draw/lv_draw_blend.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
/**
* @file lv_draw_blend.h
*
*/
#ifndef LV_DRAW_BLEND_H
#define LV_DRAW_BLEND_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
#include "lv_draw_mask.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
enum {
LV_BLEND_MODE_NORMAL,
#if LV_USE_BLEND_MODES
LV_BLEND_MODE_ADDITIVE,
LV_BLEND_MODE_SUBTRACTIVE,
#endif
};
typedef uint8_t lv_blend_mode_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
//! @cond Doxygen_Suppress
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color,
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
const lv_color_t * map_buf,
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
//! @endcond
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_DRAW_BLEND_H*/

View File

@@ -8,7 +8,13 @@
*********************/
#include "lv_draw_img.h"
#include "lv_img_cache.h"
#include "../lv_hal/lv_hal_disp.h"
#include "../lv_misc/lv_log.h"
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_math.h"
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
/*********************
* DEFINES
@@ -21,8 +27,16 @@
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
const lv_style_t * style, lv_opa_t opa_scale);
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
const void * src,
const lv_draw_img_dsc_t * draw_dsc);
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
const uint8_t * map_p,
const lv_draw_img_dsc_t * draw_dsc,
bool chroma_key, bool alpha_byte);
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
/**********************
* STATIC VARIABLES
@@ -36,315 +50,83 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
* GLOBAL FUNCTIONS
**********************/
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
{
_lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
dsc->recolor = LV_COLOR_BLACK;
dsc->opa = LV_OPA_COVER;
dsc->zoom = LV_IMG_ZOOM_NONE;
dsc->antialias = LV_ANTIALIAS;
}
/**
* Draw an image
* @param coords the coordinates of the image
* @param mask the image will be drawn only in this area
* @param src pointer to a lv_color_t array which contains the pixels of the image
* @param style style of the image
* @param opa_scale scale down all opacities by the factor
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
*/
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_style_t * style,
lv_opa_t opa_scale)
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc)
{
if(src == NULL) {
LV_LOG_WARN("Image draw: src is NULL");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, "No\ndata", LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
show_error(coords, mask, "No\ndata");
return;
}
if(dsc->opa <= LV_OPA_MIN) return;
lv_res_t res;
res = lv_img_draw_core(coords, mask, src, style, opa_scale);
res = lv_img_draw_core(coords, mask, src, dsc);
if(res == LV_RES_INV) {
LV_LOG_WARN("Image draw error");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, "No\ndata", LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
show_error(coords, mask, "No\ndata");
return;
}
}
/**
* Get the color of an image's pixel
* @param dsc an image descriptor
* @param x x coordinate of the point to get
* @param y x coordinate of the point to get
* @param style style of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` `style->image.color` shows
* the color. Can be `NULL` but for `ALPHA` images black will be returned. In other cases it is not
* used.
* @return color of the point
*/
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, const lv_style_t * style)
{
lv_color_t p_color = LV_COLOR_BLACK;
if(x >= dsc->header.w) {
x = dsc->header.w - 1;
LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)");
} else if(x < 0) {
x = 0;
LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)");
}
if(y >= dsc->header.h) {
y = dsc->header.h - 1;
LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)");
} else if(y < 0) {
y = 0;
LV_LOG_WARN("lv_canvas_get_px: y is < 0 (out of canvas)");
}
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED ||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&p_color, &buf_u8[px], sizeof(lv_color_t));
#if LV_COLOR_SIZE == 32
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a deafult alpha value*/
#endif
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
buf_u8 += 4 * 2;
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
p_color.full = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
buf_u8 += 4 * 4;
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
p_color.full = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_4BIT) {
buf_u8 += 4 * 16;
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
p_color.full = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
buf_u8 += 4 * 256;
uint32_t px = dsc->header.w * y + x;
p_color.full = buf_u8[px];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT || dsc->header.cf == LV_IMG_CF_ALPHA_2BIT ||
dsc->header.cf == LV_IMG_CF_ALPHA_4BIT || dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
if(style)
p_color = style->image.color;
else
p_color = LV_COLOR_BLACK;
}
return p_color;
}
/**
* Get the alpha value of an image's pixel
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @return alpha value of the point
*/
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
{
if(x >= dsc->header.w) {
x = dsc->header.w - 1;
LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)");
} else if(x < 0) {
x = 0;
LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)");
}
if(y >= dsc->header.h) {
y = dsc->header.h - 1;
LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)");
} else if(y < 0) {
y = 0;
LV_LOG_WARN("lv_canvas_get_px: y is < 0 (out of canvas)");
}
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint32_t px = dsc->header.w * y * LV_IMG_PX_SIZE_ALPHA_BYTE + x * LV_IMG_PX_SIZE_ALPHA_BYTE;
return buf_u8[px + LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT) {
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
uint8_t px_opa = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
return px_opa ? LV_OPA_TRANSP : LV_OPA_COVER;
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
const uint8_t opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
uint8_t px_opa = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
return opa_table[px_opa];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
const uint8_t opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255};
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
uint8_t px_opa = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
return opa_table[px_opa];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
uint32_t px = dsc->header.w * y + x;
return buf_u8[px];
}
return LV_OPA_COVER;
}
/**
* Set the color of a pixel of an image. The alpha channel won't be affected.
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param c color of the point
*/
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c)
{
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&buf_u8[px], &c, px_size);
} else if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
buf_u8 += sizeof(lv_color32_t) * 2; /*Skip the palette*/
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x1) << (7 - bit));
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
buf_u8 += sizeof(lv_color32_t) * 4; /*Skip the palette*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x3) << (6 - bit));
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_4BIT) {
buf_u8 += sizeof(lv_color32_t) * 16; /*Skip the palette*/
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0xF) << (4 - bit));
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
buf_u8 += sizeof(lv_color32_t) * 256; /*Skip the palette*/
uint32_t px = dsc->header.w * y + x;
buf_u8[px] = c.full;
}
}
/**
* Set the alpha value of a pixel of an image. The color won't be affected
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param opa the desired opacity
*/
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa)
{
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
buf_u8[px + px_size - 1] = opa;
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT) {
opa = opa >> 7; /*opa -> [0,1]*/
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x1) << (7 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
opa = opa >> 6; /*opa -> [0,3]*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x3) << (6 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
opa = opa >> 4; /*opa -> [0,15]*/
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0xF) << (4 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
uint32_t px = dsc->header.w * y + x;
buf_u8[px] = opa;
}
}
/**
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
* @param dsc pointer to an image descriptor
* @param id the palette color to set:
* - for `LV_IMG_CF_INDEXED1`: 0..1
* - for `LV_IMG_CF_INDEXED2`: 0..3
* - for `LV_IMG_CF_INDEXED4`: 0..15
* - for `LV_IMG_CF_INDEXED8`: 0..255
* @param c the color to set
*/
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
{
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
return;
}
lv_color32_t c32;
c32.full = lv_color_to32(c);
uint8_t * buf = (uint8_t *)dsc->data;
memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32));
}
/**
* Get the pixel size of a color format in bits
* @param cf a color format (`LV_IMG_CF_...`)
* @return the pixel size in bits
*/
uint8_t lv_img_color_format_get_px_size(lv_img_cf_t cf)
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf)
{
uint8_t px_size = 0;
switch(cf) {
case LV_IMG_CF_UNKNOWN:
case LV_IMG_CF_RAW: px_size = 0; break;
case LV_IMG_CF_RAW:
px_size = 0;
break;
case LV_IMG_CF_TRUE_COLOR:
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED: px_size = LV_COLOR_SIZE; break;
case LV_IMG_CF_TRUE_COLOR_ALPHA: px_size = LV_IMG_PX_SIZE_ALPHA_BYTE << 3; break;
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
px_size = LV_COLOR_SIZE;
break;
case LV_IMG_CF_TRUE_COLOR_ALPHA:
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE << 3;
break;
case LV_IMG_CF_INDEXED_1BIT:
case LV_IMG_CF_ALPHA_1BIT: px_size = 1; break;
case LV_IMG_CF_ALPHA_1BIT:
px_size = 1;
break;
case LV_IMG_CF_INDEXED_2BIT:
case LV_IMG_CF_ALPHA_2BIT: px_size = 2; break;
case LV_IMG_CF_ALPHA_2BIT:
px_size = 2;
break;
case LV_IMG_CF_INDEXED_4BIT:
case LV_IMG_CF_ALPHA_4BIT: px_size = 4; break;
case LV_IMG_CF_ALPHA_4BIT:
px_size = 4;
break;
case LV_IMG_CF_INDEXED_8BIT:
case LV_IMG_CF_ALPHA_8BIT: px_size = 8; break;
default: px_size = 0; break;
case LV_IMG_CF_ALPHA_8BIT:
px_size = 8;
break;
default:
px_size = 0;
break;
}
return px_size;
@@ -355,7 +137,7 @@ uint8_t lv_img_color_format_get_px_size(lv_img_cf_t cf)
* @param cf a color format (`LV_IMG_CF_...`)
* @return true: chroma keyed; false: not chroma keyed
*/
bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf)
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf)
{
bool is_chroma_keyed = false;
@@ -365,8 +147,13 @@ bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf)
case LV_IMG_CF_INDEXED_1BIT:
case LV_IMG_CF_INDEXED_2BIT:
case LV_IMG_CF_INDEXED_4BIT:
case LV_IMG_CF_INDEXED_8BIT: is_chroma_keyed = true; break;
default: is_chroma_keyed = false; break;
case LV_IMG_CF_INDEXED_8BIT:
is_chroma_keyed = true;
break;
default:
is_chroma_keyed = false;
break;
}
return is_chroma_keyed;
@@ -377,18 +164,26 @@ bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf)
* @param cf a color format (`LV_IMG_CF_...`)
* @return true: has alpha channel; false: doesn't have alpha channel
*/
bool lv_img_color_format_has_alpha(lv_img_cf_t cf)
bool lv_img_cf_has_alpha(lv_img_cf_t cf)
{
bool has_alpha = false;
switch(cf) {
case LV_IMG_CF_TRUE_COLOR_ALPHA:
case LV_IMG_CF_RAW_ALPHA:
case LV_IMG_CF_INDEXED_1BIT:
case LV_IMG_CF_INDEXED_2BIT:
case LV_IMG_CF_INDEXED_4BIT:
case LV_IMG_CF_INDEXED_8BIT:
case LV_IMG_CF_ALPHA_1BIT:
case LV_IMG_CF_ALPHA_2BIT:
case LV_IMG_CF_ALPHA_4BIT:
case LV_IMG_CF_ALPHA_8BIT: has_alpha = true; break;
default: has_alpha = false; break;
case LV_IMG_CF_ALPHA_8BIT:
has_alpha = true;
break;
default:
has_alpha = false;
break;
}
return has_alpha;
@@ -412,9 +207,11 @@ lv_img_src_t lv_img_src_get_type(const void * src)
/*The first byte shows the type of the image source*/
if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) {
img_src_type = LV_IMG_SRC_FILE; /*If it's an ASCII character then it's file name*/
} else if(u8_p[0] >= 0x80) {
}
else if(u8_p[0] >= 0x80) {
img_src_type = LV_IMG_SRC_SYMBOL; /*Symbols begins after 0x7F*/
} else {
}
else {
img_src_type = LV_IMG_SRC_VARIABLE; /*`lv_img_dsc_t` is design to the first byte < 0x20*/
}
@@ -429,66 +226,404 @@ lv_img_src_t lv_img_src_get_type(const void * src)
* STATIC FUNCTIONS
**********************/
static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
const lv_style_t * style, lv_opa_t opa_scale)
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
const void * src,
const lv_draw_img_dsc_t * draw_dsc)
{
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
lv_area_t mask_com; /*Common area of mask and coords*/
bool union_ok;
union_ok = lv_area_intersect(&mask_com, mask, coords);
if(union_ok == false) {
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
successfully.*/
}
lv_opa_t opa =
opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8;
lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style);
lv_img_cache_entry_t * cdsc = _lv_img_cache_open(src, draw_dsc->recolor);
if(cdsc == NULL) return LV_RES_INV;
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf);
bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf);
bool chroma_keyed = lv_img_cf_is_chroma_keyed(cdsc->dec_dsc.header.cf);
bool alpha_byte = lv_img_cf_has_alpha(cdsc->dec_dsc.header.cf);
if(cdsc->dec_dsc.error_msg != NULL) {
LV_LOG_WARN("Image draw error");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1,
-1, NULL);
show_error(coords, clip_area, cdsc->dec_dsc.error_msg);
}
/* The decoder open could open the image and gave the entire uncompressed image.
/* The decoder could open the image and gave the entire uncompressed image.
* Just draw it!*/
else if(cdsc->dec_dsc.img_data) {
lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color,
style->image.intense);
lv_area_t map_area_rot;
lv_area_copy(&map_area_rot, coords);
if(draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) {
int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords);
_lv_img_buf_get_transformed_area(&map_area_rot, w, h, draw_dsc->angle, draw_dsc->zoom, &draw_dsc->pivot);
map_area_rot.x1 += coords->x1;
map_area_rot.y1 += coords->y1;
map_area_rot.x2 += coords->x1;
map_area_rot.y2 += coords->y1;
}
lv_area_t mask_com; /*Common area of mask and coords*/
bool union_ok;
union_ok = _lv_area_intersect(&mask_com, clip_area, &map_area_rot);
if(union_ok == false) {
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
successfully.*/
}
lv_draw_map(coords, &mask_com, cdsc->dec_dsc.img_data, draw_dsc, chroma_keyed, alpha_byte);
}
/* The whole uncompressed image is not available. Try to read it line-by-line*/
else {
lv_coord_t width = lv_area_get_width(&mask_com);
lv_area_t mask_com; /*Common area of mask and coords*/
bool union_ok;
union_ok = _lv_area_intersect(&mask_com, clip_area, coords);
if(union_ok == false) {
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
successfully.*/
}
uint8_t * buf = lv_draw_get_buf(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1)); /*+1 because of the possible alpha byte*/
int32_t width = lv_area_get_width(&mask_com);
uint8_t * buf = _lv_mem_buf_get(lv_area_get_width(&mask_com) *
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
lv_area_t line;
lv_area_copy(&line, &mask_com);
lv_area_set_height(&line, 1);
lv_coord_t x = mask_com.x1 - coords->x1;
lv_coord_t y = mask_com.y1 - coords->y1;
lv_coord_t row;
int32_t x = mask_com.x1 - coords->x1;
int32_t y = mask_com.y1 - coords->y1;
int32_t row;
lv_res_t read_res;
for(row = mask_com.y1; row <= mask_com.y2; row++) {
lv_area_t mask_line;
union_ok = _lv_area_intersect(&mask_line, clip_area, &line);
if(union_ok == false) continue;
read_res = lv_img_decoder_read_line(&cdsc->dec_dsc, x, y, width, buf);
if(read_res != LV_RES_OK) {
lv_img_decoder_close(&cdsc->dec_dsc);
LV_LOG_WARN("Image draw can't read the line");
_lv_mem_buf_release(buf);
return LV_RES_INV;
}
lv_draw_map(&line, mask, buf, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
lv_draw_map(&line, &mask_line, buf, draw_dsc, chroma_keyed, alpha_byte);
line.y1++;
line.y2++;
y++;
}
_lv_mem_buf_release(buf);
}
return LV_RES_OK;
}
/**
* Draw a color map to the display (image)
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area (truncated to VDB area)
* @param map_p pointer to a lv_color_t array
* @param draw_dsc pointer to an initialized `lv_draw_img_dsc_t` variable
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel
*/
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
const uint8_t * map_p,
const lv_draw_img_dsc_t * draw_dsc,
bool chroma_key, bool alpha_byte)
{
/* Use the clip area as draw area*/
lv_area_t draw_area;
lv_area_copy(&draw_area, clip_area);
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
const lv_area_t * disp_area = &vdb->area;
/* Now `draw_area` has absolute coordinates.
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
draw_area.x1 -= disp_area->x1;
draw_area.y1 -= disp_area->y1;
draw_area.x2 -= disp_area->x1;
draw_area.y2 -= disp_area->y1;
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
/*The simplest case just copy the pixels into the VDB*/
if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE &&
chroma_key == false && alpha_byte == false && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
draw_dsc->blend_mode);
}
/*In the other cases every pixel need to be checked one-by-one*/
else {
/*The pixel size in byte is different if an alpha byte is added too*/
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
/*Go to the first displayed pixel of the map*/
int32_t map_w = lv_area_get_width(map_area);
const uint8_t * map_buf_tmp = map_p;
map_buf_tmp += map_w * (draw_area.y1 - (map_area->y1 - disp_area->y1)) * px_size_byte;
map_buf_tmp += (draw_area.x1 - (map_area->x1 - disp_area->x1)) * px_size_byte;
lv_color_t c;
lv_color_t chroma_keyed_color = LV_COLOR_TRANSP;
uint32_t px_i = 0;
const uint8_t * map_px;
lv_area_t blend_area;
blend_area.x1 = draw_area.x1 + disp_area->x1;
blend_area.x2 = blend_area.x1 + lv_area_get_width(&draw_area) - 1;
blend_area.y1 = disp_area->y1 + draw_area.y1;
blend_area.y2 = blend_area.y1;
lv_coord_t draw_area_h = lv_area_get_height(&draw_area);
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
#if LV_USE_IMG_TRANSFORM
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false;
#else
bool transform = false;
#endif
/*Simple ARGB image. Handle it as special case because it's very common*/
if(other_mask_cnt == 0 && !transform && !chroma_key && draw_dsc->recolor_opa == LV_OPA_TRANSP && alpha_byte) {
#if LV_USE_GPU_STM32_DMA2D && LV_COLOR_DEPTH == 32
/*Blend ARGB images directly*/
if(lv_area_get_size(&draw_area) > 240) {
int32_t disp_w = lv_area_get_width(disp_area);
lv_color_t * disp_buf = vdb->buf_act;
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1;
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w,
draw_area_h);
return;
}
#endif
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
int32_t x;
int32_t y;
for(y = 0; y < draw_area_h; y++) {
map_px = map_buf_tmp;
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa) {
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
map2[px_i].full = map_px[0];
#elif LV_COLOR_DEPTH == 16
map2[px_i].full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
map2[px_i].full = *((uint32_t *)map_px);
#endif
}
#if LV_COLOR_DEPTH == 32
map2[px_i].ch.alpha = 0xFF;
#endif
}
map_buf_tmp += map_w * px_size_byte;
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
blend_area.y2 ++;
}
else {
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
blend_area.y1 = blend_area.y2 + 1;
blend_area.y2 = blend_area.y1;
px_i = 0;
}
}
/*Flush the last part*/
if(blend_area.y1 != blend_area.y2) {
blend_area.y2--;
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
}
_lv_mem_buf_release(mask_buf);
_lv_mem_buf_release(map2);
}
/*Most complicated case: transform or other mask or chroma keyed*/
else {
/*Build the image and a mask line-by-line*/
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
#if LV_USE_IMG_TRANSFORM
lv_img_transform_dsc_t trans_dsc;
_lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
if(transform) {
lv_img_cf_t cf = LV_IMG_CF_TRUE_COLOR;
if(alpha_byte) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
else if(chroma_key) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
trans_dsc.cfg.angle = draw_dsc->angle;
trans_dsc.cfg.zoom = draw_dsc->zoom;
trans_dsc.cfg.src = map_p;
trans_dsc.cfg.src_w = map_w;
trans_dsc.cfg.src_h = lv_area_get_height(map_area);;
trans_dsc.cfg.cf = cf;
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
trans_dsc.cfg.color = draw_dsc->recolor;
trans_dsc.cfg.antialias = draw_dsc->antialias;
_lv_img_buf_transform_init(&trans_dsc);
}
#endif
uint16_t recolor_premult[3] = {0};
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
if(draw_dsc->recolor_opa != 0) {
lv_color_premult(draw_dsc->recolor, draw_dsc->recolor_opa, recolor_premult);
}
lv_draw_mask_res_t mask_res;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
/*Prepare the `mask_buf`if there are other masks*/
if(other_mask_cnt) {
_lv_memset_ff(mask_buf, mask_buf_size);
}
int32_t x;
int32_t y;
#if LV_USE_IMG_TRANSFORM
int32_t rot_y = disp_area->y1 + draw_area.y1 - map_area->y1;
#endif
for(y = 0; y < draw_area_h; y++) {
map_px = map_buf_tmp;
uint32_t px_i_start = px_i;
#if LV_USE_IMG_TRANSFORM
int32_t rot_x = disp_area->x1 + draw_area.x1 - map_area->x1;
#endif
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
#if LV_USE_IMG_TRANSFORM
if(transform) {
/*Transform*/
bool ret;
ret = _lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y);
if(ret == false) {
mask_buf[px_i] = LV_OPA_TRANSP;
continue;
}
else {
mask_buf[px_i] = trans_dsc.res.opa;
c.full = trans_dsc.res.color.full;
}
}
/*No transform*/
else
#endif
{
if(alpha_byte) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa == 0) {
#if LV_COLOR_DEPTH == 32
map2[px_i].full = 0;
#endif
continue;
}
}
else {
mask_buf[px_i] = 0xFF;
}
#if LV_COLOR_DEPTH == 1
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
c.full = *((uint32_t *)map_px);
c.ch.alpha = 0xFF;
#endif
if(chroma_key) {
if(c.full == chroma_keyed_color.full) {
mask_buf[px_i] = LV_OPA_TRANSP;
#if LV_COLOR_DEPTH == 32
map2[px_i].full = 0;
#endif
continue;
}
}
}
if(draw_dsc->recolor_opa != 0) {
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
}
map2[px_i].full = c.full;
}
/*Apply the masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res_sub;
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1,
lv_area_get_width(&draw_area));
if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) {
_lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
}
map_buf_tmp += map_w * px_size_byte;
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
blend_area.y2 ++;
}
else {
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
blend_area.y1 = blend_area.y2 + 1;
blend_area.y2 = blend_area.y1;
px_i = 0;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
/*Prepare the `mask_buf`if there are other masks*/
if(other_mask_cnt) {
_lv_memset_ff(mask_buf, mask_buf_size);
}
}
}
/*Flush the last part*/
if(blend_area.y1 != blend_area.y2) {
blend_area.y2--;
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
}
_lv_mem_buf_release(mask_buf);
_lv_mem_buf_release(map2);
}
}
}
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg)
{
lv_draw_rect_dsc_t rect_dsc;
lv_draw_rect_dsc_init(&rect_dsc);
rect_dsc.bg_color = LV_COLOR_WHITE;
lv_draw_rect(coords, clip_area, &rect_dsc);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_draw_label(coords, clip_area, &label_dsc, msg, NULL);
}

View File

@@ -13,31 +13,49 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "lv_img_decoder.h"
#include "lv_img_buf.h"
/*********************
* DEFINES
*********************/
/**********************
* MACROS
**********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_opa_t opa;
uint16_t angle;
lv_point_t pivot;
uint16_t zoom;
lv_opa_t recolor_opa;
lv_color_t recolor;
lv_blend_mode_t blend_mode;
uint8_t antialias : 1;
} lv_draw_img_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
/**
* Draw an image
* @param coords the coordinates of the image
* @param mask the image will be drawn only in this area
* @param src pointer to a lv_color_t array which contains the pixels of the image
* @param style style of the image
* @param opa_scale scale down all opacities by the factor
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
*/
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_style_t * style,
lv_opa_t opa_scale);
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc);
/**
* Get the type of an image source
@@ -49,80 +67,27 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void *
*/
lv_img_src_t lv_img_src_get_type(const void * src);
/**
* Get the color of an image's pixel
* @param dsc an image descriptor
* @param x x coordinate of the point to get
* @param y x coordinate of the point to get
* @param style style of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` `style->image.color` shows
* the color. Can be `NULL` but for `ALPHA` images black will be returned. In other cases it is not
* used.
* @return color of the point
*/
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, const lv_style_t * style);
/**
* Get the alpha value of an image's pixel
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @return alpha value of the point
*/
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
/**
* Set the color of a pixel of an image. The alpha channel won't be affected.
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param c color of the point
*/
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
/**
* Set the alpha value of a pixel of an image. The color won't be affected
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param opa the desired opacity
*/
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
/**
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
* @param dsc pointer to an image descriptor
* @param id the palette color to set:
* - for `LV_IMG_CF_INDEXED1`: 0..1
* - for `LV_IMG_CF_INDEXED2`: 0..3
* - for `LV_IMG_CF_INDEXED4`: 0..15
* - for `LV_IMG_CF_INDEXED8`: 0..255
* @param c the color to set
*/
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
/**
* Get the pixel size of a color format in bits
* @param cf a color format (`LV_IMG_CF_...`)
* @return the pixel size in bits
*/
uint8_t lv_img_color_format_get_px_size(lv_img_cf_t cf);
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
/**
* Check if a color format is chroma keyed or not
* @param cf a color format (`LV_IMG_CF_...`)
* @return true: chroma keyed; false: not chroma keyed
*/
bool lv_img_color_format_is_chroma_keyed(lv_img_cf_t cf);
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
/**
* Check if a color format has alpha channel or not
* @param cf a color format (`LV_IMG_CF_...`)
* @return true: has alpha channel; false: doesn't have alpha channel
*/
bool lv_img_color_format_has_alpha(lv_img_cf_t cf);
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */

View File

@@ -8,6 +8,10 @@
*********************/
#include "lv_draw_label.h"
#include "../lv_misc/lv_math.h"
#include "../lv_hal/lv_hal_disp.h"
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_bidi.h"
#include "../lv_misc/lv_debug.h"
/*********************
* DEFINES
@@ -28,12 +32,56 @@ typedef uint8_t cmd_state_t;
/**********************
* STATIC PROTOTYPES
**********************/
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
const lv_font_t * font_p,
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
const lv_area_t * clip_area,
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
static uint8_t hex_char_to_num(char hex);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* GLOBAL VARIABLES
**********************/
const uint8_t _lv_bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
const uint8_t _lv_bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
const uint8_t _lv_bpp3_opa_table[8] = {0, 36, 73, 109, /*Opacity mapping with bpp = 3*/
146, 182, 219, 255
};
const uint8_t _lv_bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119,
136, 153, 170, 187,
204, 221, 238, 255
};
const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
};
/**********************
* MACROS
**********************/
@@ -42,56 +90,77 @@ static uint8_t hex_char_to_num(char hex);
* GLOBAL FUNCTIONS
**********************/
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
{
_lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK;
dsc->font = LV_THEME_DEFAULT_FONT_NORMAL;
dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL;
dsc->sel_color = LV_COLOR_BLUE;
dsc->bidi_dir = LV_BIDI_DIR_LTR;
}
/**
* Write a text
* @param coords coordinates of the label
* @param mask the label will be drawn only in this area
* @param style pointer to a style
* @param opa_scale scale down all opacities by the factor
* @param txt 0 terminated text to write
* @param flag settings for the text from 'txt_flag_t' enum
* @param offset text offset in x and y direction (NULL if unused)
* @param sel_start start index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
* @param dsc pointer to draw descriptor
* @param txt `\0` terminated text to write
* @param hint pointer to a `lv_draw_label_hint_t` variable.
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
*/
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint)
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
const lv_draw_label_dsc_t * dsc,
const char * txt,
lv_draw_label_hint_t * hint)
{
const lv_font_t * font = style->text.font;
lv_coord_t w;
if((flag & LV_TXT_FLAG_EXPAND) == 0) {
if(dsc->opa <= LV_OPA_MIN) return;
const lv_font_t * font = dsc->font;
int32_t w;
/*No need to waste processor time if string is empty*/
if(txt[0] == '\0') return;
lv_area_t clipped_area;
bool clip_ok = _lv_area_intersect(&clipped_area, coords, mask);
if(!clip_ok) return;
if((dsc->flag & LV_TXT_FLAG_EXPAND) == 0) {
/*Normally use the label's width as width*/
w = lv_area_get_width(coords);
} else {
}
else {
/*If EXAPND is enabled then not limit the text's width to the object's width*/
lv_point_t p;
lv_txt_get_size(&p, txt, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX,
flag);
_lv_txt_get_size(&p, txt, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
dsc->flag);
w = p.x;
}
lv_coord_t line_height = lv_font_get_line_height(font) + style->text.line_space;
int32_t line_height_font = lv_font_get_line_height(font);
int32_t line_height = line_height_font + dsc->line_space;
/*Init variables for the first line*/
lv_coord_t line_width = 0;
int32_t line_width = 0;
lv_point_t pos;
pos.x = coords->x1;
pos.y = coords->y1;
lv_coord_t x_ofs = 0;
lv_coord_t y_ofs = 0;
if(offset != NULL) {
x_ofs = offset->x;
y_ofs = offset->y;
pos.y += y_ofs;
}
int32_t x_ofs = 0;
int32_t y_ofs = 0;
x_ofs = dsc->ofs_x;
y_ofs = dsc->ofs_y;
pos.y += y_ofs;
uint32_t line_start = 0;
int32_t last_line_start = -1;
/*Check the hint to use the cached info*/
if(hint && y_ofs == 0) {
if(hint && y_ofs == 0 && coords->y1 < 0) {
/*If the label changed too much recalculate the hint.*/
if(LV_MATH_ABS(hint->coord_y - coords->y1) > LV_LABEL_HINT_UPDATE_TH - 2 * line_height) {
hint->line_start = -1;
@@ -105,13 +174,13 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
pos.y += hint->y;
}
uint32_t line_end = line_start + lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, w, flag);
uint32_t line_end = line_start + _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
/*Go the first visible line*/
while(pos.y + line_height < mask->y1) {
while(pos.y + line_height_font < mask->y1) {
/*Go to next line*/
line_start = line_end;
line_end += lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, w, flag);
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
pos.y += line_height;
/*Save at the threshold coordinate*/
@@ -125,53 +194,90 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
}
/*Align to middle*/
if(flag & LV_TXT_FLAG_CENTER) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag);
if(dsc->flag & LV_TXT_FLAG_CENTER) {
line_width = _lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(flag & LV_TXT_FLAG_RIGHT) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag);
else if(dsc->flag & LV_TXT_FLAG_RIGHT) {
line_width = _lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
pos.x += lv_area_get_width(coords) - line_width;
}
lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->text.opa : (uint16_t)((uint16_t)style->text.opa * opa_scale) >> 8;
lv_opa_t opa = dsc->opa;
uint32_t sel_start = dsc->sel_start;
uint32_t sel_end = dsc->sel_end;
if(sel_start > sel_end) {
uint32_t tmp = sel_start;
sel_start = sel_end;
sel_end = tmp;
}
lv_draw_line_dsc_t line_dsc;
if((dsc->decor & LV_TEXT_DECOR_UNDERLINE) || (dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH)) {
lv_draw_line_dsc_init(&line_dsc);
line_dsc.color = dsc->color;
line_dsc.width = font->underline_thickness ? font->underline_thickness : LV_MATH_MAX(font->line_height / 10, 1);
line_dsc.opa = dsc->opa;
line_dsc.blend_mode = dsc->blend_mode;
}
cmd_state_t cmd_state = CMD_STATE_WAIT;
uint32_t i;
uint16_t par_start = 0;
uint32_t par_start = 0;
lv_color_t recolor;
lv_coord_t letter_w;
lv_style_t sel_style;
lv_style_copy(&sel_style, &lv_style_plain_color);
sel_style.body.main_color = sel_style.body.grad_color = style->text.sel_color;
int32_t letter_w;
lv_draw_rect_dsc_t draw_dsc_sel;
lv_draw_rect_dsc_init(&draw_dsc_sel);
draw_dsc_sel.bg_color = dsc->sel_color;
int32_t pos_x_start = pos.x;
/*Write out all lines*/
while(txt[line_start] != '\0') {
if(offset != NULL) {
pos.x += x_ofs;
}
pos.x += x_ofs;
/*Write all letter of a line*/
cmd_state = CMD_STATE_WAIT;
i = line_start;
uint32_t letter;
uint32_t letter_next;
while(i < line_end) {
letter = lv_txt_encoded_next(txt, &i);
letter_next = lv_txt_encoded_next(&txt[i], NULL);
i = 0;
#if LV_USE_BIDI
char * bidi_txt = _lv_mem_buf_get(line_end - line_start + 1);
_lv_bidi_process_paragraph(txt + line_start, bidi_txt, line_end - line_start, dsc->bidi_dir, NULL, 0);
#else
const char * bidi_txt = txt + line_start;
#endif
while(i < line_end - line_start) {
uint32_t logical_char_pos = 0;
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start);
uint32_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
#else
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
#endif
}
uint32_t letter = _lv_txt_encoded_next(bidi_txt, &i);
uint32_t letter_next = _lv_txt_encoded_next(&bidi_txt[i], NULL);
/*Handle the re-color command*/
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
if((dsc->flag & LV_TXT_FLAG_RECOLOR) != 0) {
if(letter == (uint32_t)LV_TXT_COLOR_CMD[0]) {
if(cmd_state == CMD_STATE_WAIT) { /*Start char*/
par_start = i;
cmd_state = CMD_STATE_PAR;
continue;
} else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
}
else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
cmd_state = CMD_STATE_WAIT;
} else if(cmd_state == CMD_STATE_IN) { /*Command end */
}
else if(cmd_state == CMD_STATE_IN) { /*Command end */
cmd_state = CMD_STATE_WAIT;
continue;
}
@@ -183,15 +289,16 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
/*Get the parameter*/
if(i - par_start == LABEL_RECOLOR_PAR_LENGTH + 1) {
char buf[LABEL_RECOLOR_PAR_LENGTH + 1];
memcpy(buf, &txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
_lv_memcpy_small(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
buf[LABEL_RECOLOR_PAR_LENGTH] = '\0';
int r, g, b;
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]);
b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]);
recolor = lv_color_make(r, g, b);
} else {
recolor.full = style->text.color.full;
}
else {
recolor.full = dsc->color.full;
}
cmd_state = CMD_STATE_IN; /*After the parameter the text is in the command*/
}
@@ -199,47 +306,71 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
}
}
lv_color_t color = style->text.color;
lv_color_t color = dsc->color;
if(cmd_state == CMD_STATE_IN) color = recolor;
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
int char_ind = lv_encoded_get_char_id(txt, i);
/*Do not draw the rectangle on the character at `sel_start`.*/
if(char_ind > sel_start && char_ind <= sel_end) {
if(logical_char_pos >= sel_start && logical_char_pos < sel_end) {
lv_area_t sel_coords;
sel_coords.x1 = pos.x;
sel_coords.y1 = pos.y;
sel_coords.x2 = pos.x + letter_w + style->text.letter_space - 1;
sel_coords.x2 = pos.x + letter_w + dsc->letter_space - 1;
sel_coords.y2 = pos.y + line_height - 1;
lv_draw_rect(&sel_coords, mask, &sel_style, opa);
lv_draw_rect(&sel_coords, mask, &draw_dsc_sel);
}
}
lv_draw_letter(&pos, mask, font, letter, color, opa);
lv_draw_letter(&pos, mask, font, letter, color, opa, dsc->blend_mode);
if(letter_w > 0) {
pos.x += letter_w + style->text.letter_space;
pos.x += letter_w + dsc->letter_space;
}
}
if(dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH) {
lv_point_t p1;
lv_point_t p2;
p1.x = pos_x_start;
p1.y = pos.y + (dsc->font->line_height / 2) + line_dsc.width / 2;
p2.x = pos.x;
p2.y = p1.y;
lv_draw_line(&p1, &p2, mask, &line_dsc);
}
if(dsc->decor & LV_TEXT_DECOR_UNDERLINE) {
lv_point_t p1;
lv_point_t p2;
p1.x = pos_x_start;
p1.y = pos.y + dsc->font->line_height - dsc->font->base_line - font->underline_position;
p2.x = pos.x;
p2.y = p1.y;
lv_draw_line(&p1, &p2, mask, &line_dsc);
}
#if LV_USE_BIDI
_lv_mem_buf_release(bidi_txt);
bidi_txt = NULL;
#endif
/*Go to next line*/
line_start = line_end;
line_end += lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, w, flag);
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
pos.x = coords->x1;
/*Align to middle*/
if(flag & LV_TXT_FLAG_CENTER) {
if(dsc->flag & LV_TXT_FLAG_CENTER) {
line_width =
lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag);
_lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(flag & LV_TXT_FLAG_RIGHT) {
else if(dsc->flag & LV_TXT_FLAG_RIGHT) {
line_width =
lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag);
_lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
pos.x += lv_area_get_width(coords) - line_width;
}
@@ -248,12 +379,442 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
if(pos.y > mask->y2) return;
}
LV_ASSERT_MEM_INTEGRITY();
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Draw a letter in the Virtual Display Buffer
* @param pos_p left-top coordinate of the latter
* @param mask_p the letter will be drawn only on this area (truncated to VDB area)
* @param font_p pointer to font
* @param letter a letter to draw
* @param color color of letter
* @param opa opacity of letter (0..255)
*/
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
const lv_font_t * font_p,
uint32_t letter,
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
{
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
if(font_p == NULL) {
LV_LOG_WARN("lv_draw_letter: font is NULL");
return;
}
lv_font_glyph_dsc_t g;
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
if(g_ret == false) {
/* Add waring if the dsc is not found
* but do not print warning for non printable ASCII chars (e.g. '\n')*/
if(letter >= 0x20) {
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
}
return;
}
/* Don't draw anything if the character is empty. E.g. space */
if((g.box_h == 0) || (g.box_w == 0)) return;
int32_t pos_x = pos_p->x + g.ofs_x;
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
/*If the letter is completely out of mask don't draw it */
if(pos_x + g.box_w < clip_area->x1 ||
pos_x > clip_area->x2 ||
pos_y + g.box_h < clip_area->y1 ||
pos_y > clip_area->y2) {
return;
}
const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter);
if(map_p == NULL) {
LV_LOG_WARN("lv_draw_letter: character's bitmap not found");
return;
}
if(font_p->subpx) {
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
}
else {
draw_letter_normal(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
}
}
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
const lv_area_t * clip_area,
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
{
const uint8_t * bpp_opa_table_p;
uint32_t bitmask_init;
uint32_t bitmask;
uint32_t bpp = g->bpp;
uint32_t shades;
if(bpp == 3) bpp = 4;
switch(bpp) {
case 1:
bpp_opa_table_p = _lv_bpp1_opa_table;
bitmask_init = 0x80;
shades = 2;
break;
case 2:
bpp_opa_table_p = _lv_bpp2_opa_table;
bitmask_init = 0xC0;
shades = 4;
break;
case 4:
bpp_opa_table_p = _lv_bpp4_opa_table;
bitmask_init = 0xF0;
shades = 16;
break;
case 8:
bpp_opa_table_p = _lv_bpp8_opa_table;
bitmask_init = 0xFF;
shades = 256;
break; /*No opa table, pixel value will be used directly*/
default:
LV_LOG_WARN("lv_draw_letter: invalid bpp");
return; /*Invalid bpp. Can't render the letter*/
}
static lv_opa_t opa_table[256];
static lv_opa_t prev_opa = LV_OPA_TRANSP;
static uint32_t prev_bpp = 0;
if(opa < LV_OPA_MAX) {
if(prev_opa != opa || prev_bpp != bpp) {
uint32_t i;
for(i = 0; i < shades; i++) {
opa_table[i] = bpp_opa_table_p[i] == LV_OPA_COVER ? opa : ((bpp_opa_table_p[i] * opa) >> 8);
}
}
bpp_opa_table_p = opa_table;
prev_opa = opa;
prev_bpp = bpp;
}
int32_t col, row;
int32_t box_w = g->box_w;
int32_t box_h = g->box_h;
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
/* Calculate the col/row start/end on the map*/
int32_t col_start = pos_x >= clip_area->x1 ? 0 : clip_area->x1 - pos_x;
int32_t col_end = pos_x + box_w <= clip_area->x2 ? box_w : clip_area->x2 - pos_x + 1;
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
int32_t row_end = pos_y + box_h <= clip_area->y2 ? box_h : clip_area->y2 - pos_y + 1;
/*Move on the map too*/
uint32_t bit_ofs = (row_start * width_bit) + (col_start * bpp);
map_p += bit_ofs >> 3;
uint8_t letter_px;
uint32_t col_bit;
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
uint32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : box_w * box_h;
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
int32_t mask_p = 0;
lv_area_t fill_area;
fill_area.x1 = col_start + pos_x;
fill_area.x2 = col_end + pos_x - 1;
fill_area.y1 = row_start + pos_y;
fill_area.y2 = fill_area.y1;
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
uint32_t col_bit_max = 8 - bpp;
uint32_t col_bit_row_ofs = (box_w + col_start - col_end) * bpp;
for(row = row_start ; row < row_end; row++) {
int32_t mask_p_start = mask_p;
bitmask = bitmask_init >> col_bit;
for(col = col_start; col < col_end; col++) {
/*Load the pixel's opacity into the mask*/
letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
if(letter_px) {
mask_buf[mask_p] = bpp_opa_table_p[letter_px];
}
else {
mask_buf[mask_p] = 0;
}
/*Go to the next column*/
if(col_bit < col_bit_max) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
else {
col_bit = 0;
bitmask = bitmask_init;
map_p++;
}
/*Next mask byte*/
mask_p++;
}
/*Apply masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2,
lv_area_get_width(&fill_area));
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
_lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&fill_area));
}
}
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
fill_area.y2 ++;
}
else {
_lv_blend_fill(clip_area, &fill_area,
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
blend_mode);
fill_area.y1 = fill_area.y2 + 1;
fill_area.y2 = fill_area.y1;
mask_p = 0;
}
col_bit += col_bit_row_ofs;
map_p += (col_bit >> 3);
col_bit = col_bit & 0x7;
}
/*Flush the last part*/
if(fill_area.y1 != fill_area.y2) {
fill_area.y2--;
_lv_blend_fill(clip_area, &fill_area,
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
blend_mode);
mask_p = 0;
}
_lv_mem_buf_release(mask_buf);
}
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
{
#if LV_USE_FONT_SUBPX
const uint8_t * bpp_opa_table;
uint32_t bitmask_init;
uint32_t bitmask;
uint32_t bpp = g->bpp;
if(bpp == 3) bpp = 4;
switch(bpp) {
case 1:
bpp_opa_table = _lv_bpp1_opa_table;
bitmask_init = 0x80;
break;
case 2:
bpp_opa_table = _lv_bpp2_opa_table;
bitmask_init = 0xC0;
break;
case 4:
bpp_opa_table = _lv_bpp4_opa_table;
bitmask_init = 0xF0;
break;
case 8:
bpp_opa_table = _lv_bpp8_opa_table;
bitmask_init = 0xFF;
break; /*No opa table, pixel value will be used directly*/
default:
LV_LOG_WARN("lv_draw_letter: invalid bpp not found");
return; /*Invalid bpp. Can't render the letter*/
}
int32_t col, row;
int32_t box_w = g->box_w;
int32_t box_h = g->box_h;
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
/* Calculate the col/row start/end on the map*/
int32_t col_start = pos_x >= clip_area->x1 ? 0 : (clip_area->x1 - pos_x) * 3;
int32_t col_end = pos_x + box_w / 3 <= clip_area->x2 ? box_w : (clip_area->x2 - pos_x + 1) * 3;
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
int32_t row_end = pos_y + box_h <= clip_area->y2 ? box_h : clip_area->y2 - pos_y + 1;
/*Move on the map too*/
int32_t bit_ofs = (row_start * width_bit) + (col_start * bpp);
map_p += bit_ofs >> 3;
uint8_t letter_px;
lv_opa_t px_opa;
int32_t col_bit;
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : g->box_w * g->box_h;
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
int32_t mask_p = 0;
lv_color_t * color_buf = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
int32_t vdb_width = lv_area_get_width(&vdb->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
/*Set a pointer on VDB to the first pixel of the letter*/
vdb_buf_tmp += ((pos_y - vdb->area.y1) * vdb_width) + pos_x - vdb->area.x1;
/*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp += (row_start * vdb_width) + col_start / 3;
lv_area_t map_area;
map_area.x1 = col_start / 3 + pos_x;
map_area.x2 = col_end / 3 + pos_x - 1;
map_area.y1 = row_start + pos_y;
map_area.y2 = map_area.y1;
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
uint8_t font_rgb[3];
#if LV_COLOR_16_SWAP == 0
uint8_t txt_rgb[3] = {color.ch.red, color.ch.green, color.ch.blue};
#else
uint8_t txt_rgb[3] = {color.ch.red, (color.ch.green_h << 3) + color.ch.green_l, color.ch.blue};
#endif
for(row = row_start ; row < row_end; row++) {
uint32_t subpx_cnt = 0;
bitmask = bitmask_init >> col_bit;
int32_t mask_p_start = mask_p;
for(col = col_start; col < col_end; col++) {
/*Load the pixel's opacity into the mask*/
letter_px = (*map_p & bitmask) >> (8 - col_bit - bpp);
if(letter_px != 0) {
if(opa == LV_OPA_COVER) {
px_opa = bpp == 8 ? letter_px : bpp_opa_table[letter_px];
}
else {
px_opa = bpp == 8 ? (uint32_t)((uint32_t)letter_px * opa) >> 8
: (uint32_t)((uint32_t)bpp_opa_table[letter_px] * opa) >> 8;
}
}
else {
px_opa = 0;
}
font_rgb[subpx_cnt] = px_opa;
subpx_cnt ++;
if(subpx_cnt == 3) {
subpx_cnt = 0;
lv_color_t res_color;
#if LV_COLOR_16_SWAP == 0
uint8_t bg_rgb[3] = {vdb_buf_tmp->ch.red, vdb_buf_tmp->ch.green, vdb_buf_tmp->ch.blue};
#else
uint8_t bg_rgb[3] = {vdb_buf_tmp->ch.red,
(vdb_buf_tmp->ch.green_h << 3) + vdb_buf_tmp->ch.green_l,
vdb_buf_tmp->ch.blue
};
#endif
#if LV_FONT_SUBPX_BGR
res_color.ch.blue = (uint32_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
res_color.ch.red = (uint32_t)((uint32_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
#else
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
res_color.ch.blue = (uint32_t)((uint16_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
#endif
#if LV_COLOR_16_SWAP == 0
res_color.ch.green = (uint32_t)((uint32_t)txt_rgb[1] * font_rgb[1] + (bg_rgb[1] * (255 - font_rgb[1]))) >> 8;
#else
uint8_t green = (uint32_t)((uint32_t)txt_rgb[1] * font_rgb[1] + (bg_rgb[1] * (255 - font_rgb[1]))) >> 8;
res_color.ch.green_h = green >> 3;
res_color.ch.green_l = green & 0x7;
#endif
#if LV_COLOR_DEPTH == 32
res_color.ch.alpha = 0xff;
#endif
if(font_rgb[0] == 0 && font_rgb[1] == 0 && font_rgb[2] == 0) mask_buf[mask_p] = LV_OPA_TRANSP;
else mask_buf[mask_p] = LV_OPA_COVER;
color_buf[mask_p] = res_color;
/*Next mask byte*/
mask_p++;
vdb_buf_tmp++;
}
/*Go to the next column*/
if(col_bit < (int32_t)(8 - bpp)) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
else {
col_bit = 0;
bitmask = bitmask_init;
map_p++;
}
}
/*Apply masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, map_area.x1, map_area.y2,
lv_area_get_width(&map_area));
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
_lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&map_area));
}
}
if((int32_t) mask_p + (col_end - col_start) < mask_buf_size) {
map_area.y2 ++;
}
else {
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
map_area.y1 = map_area.y2 + 1;
map_area.y2 = map_area.y1;
mask_p = 0;
}
col_bit += ((box_w - col_end) + col_start) * bpp;
map_p += (col_bit >> 3);
col_bit = col_bit & 0x7;
/*Next row in VDB*/
vdb_buf_tmp += vdb_width - (col_end - col_start) / 3;
}
/*Flush the last part*/
if(map_area.y1 != map_area.y2) {
map_area.y2--;
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
}
_lv_mem_buf_release(mask_buf);
_lv_mem_buf_release(color_buf);
#else
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
#endif
}
/**
* Convert a hexadecimal characters to a number (0..15)
* @param hex Pointer to a hexadecimal character (0..9, A..F)
@@ -265,17 +826,32 @@ static uint8_t hex_char_to_num(char hex)
if(hex >= '0' && hex <= '9') {
result = hex - '0';
} else {
}
else {
if(hex >= 'a') hex -= 'a' - 'A'; /*Convert to upper case*/
switch(hex) {
case 'A': result = 10; break;
case 'B': result = 11; break;
case 'C': result = 12; break;
case 'D': result = 13; break;
case 'E': result = 14; break;
case 'F': result = 15; break;
default: result = 0; break;
case 'A':
result = 10;
break;
case 'B':
result = 11;
break;
case 'C':
result = 12;
break;
case 'D':
result = 13;
break;
case 'E':
result = 14;
break;
case 'F':
result = 15;
break;
default:
result = 0;
break;
}
}

View File

@@ -13,16 +13,36 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "../lv_misc/lv_bidi.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_core/lv_style.h"
/*********************
* DEFINES
*********************/
#define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF)
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_color_t color;
lv_color_t sel_color;
const lv_font_t * font;
lv_opa_t opa;
lv_style_int_t line_space;
lv_style_int_t letter_space;
uint32_t sel_start;
uint32_t sel_end;
lv_coord_t ofs_x;
lv_coord_t ofs_y;
lv_bidi_dir_t bidi_dir;
lv_txt_flag_t flag;
lv_text_decor_t decor;
lv_blend_mode_t blend_mode;
} lv_draw_label_dsc_t;
/** Store some info to speed up drawing of very large texts
* It takes a lot of time to get the first visible character because
* all the previous characters needs to be checked to calculate the positions.
@@ -38,27 +58,38 @@ typedef struct {
/** The 'y1' coordinate of the label when the hint was saved.
* Used to invalidate the hint if the label has moved too much. */
int32_t coord_y;
}lv_draw_label_hint_t;
} lv_draw_label_hint_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
//! @cond Doxygen_Suppress
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
/**
* Write a text
* @param coords coordinates of the label
* @param mask the label will be drawn only in this area
* @param style pointer to a style
* @param opa_scale scale down all opacities by the factor
* @param txt 0 terminated text to write
* @param flag settings for the text from 'txt_flag_t' enum
* @param offset text offset in x and y direction (NULL if unused)
* @param sel_start start index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
* @param dsc pointer to draw descriptor
* @param txt `\0` terminated text to write
* @param hint pointer to a `lv_draw_label_hint_t` variable.
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
*/
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint);
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
const lv_draw_label_dsc_t * dsc,
const char * txt, lv_draw_label_hint_t * hint);
//! @endcond
/***********************
* GLOBAL VARIABLES
***********************/
extern const uint8_t _lv_bpp2_opa_table[];
extern const uint8_t _lv_bpp3_opa_table[];
extern const uint8_t _lv_bpp1_opa_table[];
extern const uint8_t _lv_bpp4_opa_table[];
extern const uint8_t _lv_bpp8_opa_table[];
/**********************
* MACROS

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_core/lv_style.h"
/*********************
* DEFINES
@@ -21,21 +22,37 @@ extern "C" {
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_color_t color;
lv_style_int_t width;
lv_style_int_t dash_width;
lv_style_int_t dash_gap;
lv_opa_t opa;
lv_blend_mode_t blend_mode : 2;
uint8_t round_start : 1;
uint8_t round_end : 1;
uint8_t raw_end : 1; /*Do not bother with perpendicular line ending is it's not visible for any reason*/
} lv_draw_line_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
//! @cond Doxygen_Suppress
/**
* Draw a line
* @param point1 first point of the line
* @param point2 second point of the line
* @param mask the line will be drawn only on this area
* @param style pointer to a line's style
* @param opa_scale scale down all opacities by the factor
* @param clip the line will be drawn only in this area
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * mask,
const lv_style_t * style, lv_opa_t opa_scale);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
//! @endcond
/**********************
* MACROS

1255
src/lv_draw/lv_draw_mask.c Normal file

File diff suppressed because it is too large Load Diff

307
src/lv_draw/lv_draw_mask.h Normal file
View File

@@ -0,0 +1,307 @@
/**
* @file lv_mask.h
*
*/
#ifndef LV_MASK_H
#define LV_MASK_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h"
/*********************
* DEFINES
*********************/
#define LV_MASK_ID_INV (-1)
#define _LV_MASK_MAX_NUM 16
/**********************
* TYPEDEFS
**********************/
enum {
LV_DRAW_MASK_RES_TRANSP,
LV_DRAW_MASK_RES_FULL_COVER,
LV_DRAW_MASK_RES_CHANGED,
LV_DRAW_MASK_RES_UNKNOWN
};
typedef uint8_t lv_draw_mask_res_t;
enum {
LV_DRAW_MASK_TYPE_LINE,
LV_DRAW_MASK_TYPE_ANGLE,
LV_DRAW_MASK_TYPE_RADIUS,
LV_DRAW_MASK_TYPE_FADE,
LV_DRAW_MASK_TYPE_MAP,
};
typedef uint8_t lv_draw_mask_type_t;
enum {
LV_DRAW_MASK_LINE_SIDE_LEFT = 0,
LV_DRAW_MASK_LINE_SIDE_RIGHT,
LV_DRAW_MASK_LINE_SIDE_TOP,
LV_DRAW_MASK_LINE_SIDE_BOTTOM,
};
/**
* A common callback type for every mask type.
* Used internally by the library.
*/
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
lv_coord_t len,
void * p);
typedef uint8_t lv_draw_mask_line_side_t;
typedef struct {
lv_draw_mask_xcb_t cb;
lv_draw_mask_type_t type;
} lv_draw_mask_common_dsc_t;
typedef struct {
/*The first element must be the common descriptor*/
lv_draw_mask_common_dsc_t dsc;
struct {
/*First point */
lv_point_t p1;
/*Second point*/
lv_point_t p2;
/*Which side to keep?*/
lv_draw_mask_line_side_t side : 2;
} cfg;
/*A point of the line*/
lv_point_t origo;
/* X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
int32_t xy_steep;
/* Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
int32_t yx_steep;
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines */
int32_t steep;
/*Steepness in 1 px in 0..255 range. Used only by flat lines. */
int32_t spx;
/*1: It's a flat line? (Near to horizontal)*/
uint8_t flat : 1;
/* Invert the mask. The default is: Keep the left part.
* It is used to select left/right/top/bottom*/
uint8_t inv: 1;
} lv_draw_mask_line_param_t;
typedef struct {
/*The first element must be the common descriptor*/
lv_draw_mask_common_dsc_t dsc;
struct {
lv_point_t vertex_p;
lv_coord_t start_angle;
lv_coord_t end_angle;
} cfg;
lv_draw_mask_line_param_t start_line;
lv_draw_mask_line_param_t end_line;
uint16_t delta_deg;
} lv_draw_mask_angle_param_t;
typedef struct {
/*The first element must be the common descriptor*/
lv_draw_mask_common_dsc_t dsc;
struct {
lv_area_t rect;
lv_coord_t radius;
/* Invert the mask. 0: Keep the pixels inside.*/
uint8_t outer: 1;
} cfg;
int32_t y_prev;
lv_sqrt_res_t y_prev_x;
} lv_draw_mask_radius_param_t;
typedef struct {
/*The first element must be the common descriptor*/
lv_draw_mask_common_dsc_t dsc;
struct {
lv_area_t coords;
lv_coord_t y_top;
lv_coord_t y_bottom;
lv_opa_t opa_top;
lv_opa_t opa_bottom;
} cfg;
} lv_draw_mask_fade_param_t;
typedef struct _lv_draw_mask_map_param_t {
/*The first element must be the common descriptor*/
lv_draw_mask_common_dsc_t dsc;
struct {
lv_area_t coords;
const lv_opa_t * map;
} cfg;
} lv_draw_mask_map_param_t;
typedef struct {
void * param;
void * custom_id;
} _lv_draw_mask_saved_t;
typedef _lv_draw_mask_saved_t _lv_draw_mask_saved_arr_t[_LV_MASK_MAX_NUM];
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Add a draw mask. Everything drawn after it (until removing the mask) will be affected by the mask.
* @param param an initialized mask parameter. Only the pointer is saved.
* @param custom_id a custom pointer to identify the mask. Used in `lv_draw_mask_remove_custom`.
* @return the an integer, the ID of the mask. Can be used in `lv_draw_mask_remove_id`.
*/
int16_t lv_draw_mask_add(void * param, void * custom_id);
//! @cond Doxygen_Suppress
/**
* Apply the added buffers on a line. Used internally by the library's drawing routines.
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
* @param abs_x absolute X coordinate where the line to calculate start
* @param abs_y absolute Y coordinate where the line to calculate start
* @param len length of the line to calculate (in pixel count)
* @return One of these values:
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
*/
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
lv_coord_t len);
//! @endcond
/**
* Remove a mask with a given ID
* @param id the ID of the mask. Returned by `lv_draw_mask_add`
* @return the parameter of the removed mask.
* If more masks have `custom_id` ID then the last mask's parameter will be returned
*/
void * lv_draw_mask_remove_id(int16_t id);
/**
* Remove all mask with a given custom ID
* @param custom_id a pointer used in `lv_draw_mask_add`
* @return return the parameter of the removed mask.
* If more masks have `custom_id` ID then the last mask's parameter will be returned
*/
void * lv_draw_mask_remove_custom(void * custom_id);
//! @cond Doxygen_Suppress
/**
* Count the currently added masks
* @return number of active masks
*/
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
//! @endcond
/**
*Initialize a line mask from two points.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param p1x X coordinate of the first point of the line
* @param p1y Y coordinate of the first point of the line
* @param p2x X coordinate of the second point of the line
* @param p2y y coordinate of the second point of the line
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
*/
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x,
lv_coord_t p2y, lv_draw_mask_line_side_t side);
/**
*Initialize a line mask from a point and an angle.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param px X coordinate of a point of the line
* @param py X coordinate of a point of the line
* @param angle right 0 deg, bottom: 90
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
*/
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle,
lv_draw_mask_line_side_t side);
/**
* Initialize an angle mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param vertex_x X coordinate of the angle vertex (absolute coordinates)
* @param vertex_y Y coordinate of the angle vertex (absolute coordinates)
* @param start_angle start angle in degrees. 0 deg on the right, 90 deg, on the bottom
* @param end_angle end angle
*/
void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y,
lv_coord_t start_angle, lv_coord_t end_angle);
/**
* Initialize a fade mask.
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
* @param rect coordinates of the rectangle to affect (absolute coordinates)
* @param radius radius of the rectangle
* @param inv: true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
*/
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
/**
* Initialize a fade mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param coords coordinates of the area to affect (absolute coordinates)
* @param opa_top opacity on the top
* @param y_top at which coordinate start to change to opacity to `opa_bottom`
* @param opa_bottom opacity at the bottom
* @param y_bottom at which coordinate reach `opa_bottom`.
*/
void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top,
lv_coord_t y_top,
lv_opa_t opa_bottom, lv_coord_t y_bottom);
/**
* Initialize a map mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param coords coordinates of the map (absolute coordinates)
* @param map array of bytes with the mask values
*/
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_MASK_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "../lv_core/lv_style.h"
/*********************
* DEFINES
@@ -23,18 +23,86 @@ extern "C" {
* TYPEDEFS
**********************/
typedef struct {
lv_style_int_t radius;
/*Background*/
lv_color_t bg_color;
lv_color_t bg_grad_color;
lv_grad_dir_t bg_grad_dir;
lv_style_int_t bg_main_color_stop;
lv_style_int_t bg_grad_color_stop;
lv_opa_t bg_opa;
lv_blend_mode_t bg_blend_mode;
/*Border*/
lv_color_t border_color;
lv_style_int_t border_width;
lv_style_int_t border_side;
lv_opa_t border_opa;
lv_blend_mode_t border_blend_mode;
/*Outline*/
lv_color_t outline_color;
lv_style_int_t outline_width;
lv_style_int_t outline_pad;
lv_opa_t outline_opa;
lv_blend_mode_t outline_blend_mode;
/*Shadow*/
lv_color_t shadow_color;
lv_style_int_t shadow_width;
lv_style_int_t shadow_ofs_x;
lv_style_int_t shadow_ofs_y;
lv_style_int_t shadow_spread;
lv_opa_t shadow_opa;
lv_blend_mode_t shadow_blend_mode;
/*Pattern*/
const void * pattern_image;
const lv_font_t * pattern_font;
lv_color_t pattern_recolor;
lv_opa_t pattern_opa;
lv_opa_t pattern_recolor_opa;
uint8_t pattern_repeat : 1;
lv_blend_mode_t pattern_blend_mode;
/*Value*/
const char * value_str;
const lv_font_t * value_font;
lv_opa_t value_opa;
lv_color_t value_color;
lv_style_int_t value_ofs_x;
lv_style_int_t value_ofs_y;
lv_style_int_t value_letter_space;
lv_style_int_t value_line_space;
lv_align_t value_align;
lv_blend_mode_t value_blend_mode;
} lv_draw_rect_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
//! @endcond
/**
* Draw a rectangle
* @param coords the coordinates of the rectangle
* @param mask the rectangle will be drawn only in this mask
* @param style pointer to a style
* @param opa_scale scale down all opacities by the factor
* @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc);
/**
* Draw a pixel
* @param point the coordinates of the point to draw
* @param mask the pixel will be drawn only in this mask
* @param style pointer to a style
*/
void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style);
/**********************
* MACROS

View File

@@ -8,6 +8,7 @@
*********************/
#include "lv_draw_triangle.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_mem.h"
/*********************
* DEFINES
@@ -20,9 +21,6 @@
/**********************
* STATIC PROTOTYPES
**********************/
void tri_draw_flat(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa);
void tri_draw_tall(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa);
static void point_swap(lv_point_t * p1, lv_point_t * p2);
/**********************
* STATIC VARIABLES
@@ -37,308 +35,131 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2);
**********************/
/**
*
* Draw a triangle
* @param points pointer to an array with 3 points
* @param mask the triangle will be drawn only in this mask
* @param style style for of the triangle
* @param opa_scale scale down all opacities by the factor (0..255)
* @param clip_area the triangle will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, const lv_draw_rect_dsc_t * draw_dsc)
{
/*Return is the triangle is degenerated*/
if(points[0].x == points[1].x && points[0].y == points[1].y) return;
if(points[1].x == points[2].x && points[1].y == points[2].y) return;
if(points[0].x == points[2].x && points[0].y == points[2].y) return;
if(points[0].x == points[1].x && points[1].x == points[2].x) return;
if(points[0].y == points[1].y && points[1].y == points[2].y) return;
lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;
/*Is the triangle flat or tall?*/
lv_coord_t x_min = LV_MATH_MIN(LV_MATH_MIN(points[0].x, points[1].x), points[2].x);
lv_coord_t x_max = LV_MATH_MAX(LV_MATH_MAX(points[0].x, points[1].x), points[2].x);
lv_coord_t y_min = LV_MATH_MIN(LV_MATH_MIN(points[0].y, points[1].y), points[2].y);
lv_coord_t y_max = LV_MATH_MAX(LV_MATH_MAX(points[0].y, points[1].y), points[2].y);
/* Draw the tall rectangles from vertical lines
* and from the flat triangles from horizontal lines
* to minimize the number of lines.
* Some pixels are overdrawn on the common edges of the triangles
* so use it only if the triangle has no opacity*/
/* Draw from horizontal lines*/
if(x_max - x_min < y_max - y_min) {
tri_draw_tall(points, mask, style, opa);
}
/*Else flat so draw from vertical lines*/
else {
tri_draw_flat(points, mask, style, opa);
}
lv_draw_polygon(points, 3, clip_area, draw_dsc);
}
/**
* Draw a polygon from triangles. Only convex polygons are supported
* Draw a polygon. Only convex polygons are supported
* @param points an array of points
* @param point_cnt number of points
* @param mask polygon will be drawn only in this mask
* @param style style of the polygon
* @param opa_scale scale down all opacities by the factor (0..255)
* @param clip_area polygon will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_polygon(const lv_point_t * points, uint32_t point_cnt, const lv_area_t * mask, const lv_style_t * style,
lv_opa_t opa_scale)
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * clip_area,
const lv_draw_rect_dsc_t * draw_dsc)
{
if(point_cnt < 3) return;
if(points == NULL) return;
uint32_t i;
lv_point_t tri[3];
tri[0].x = points[0].x;
tri[0].y = points[0].y;
for(i = 0; i < point_cnt - 1; i++) {
tri[1].x = points[i].x;
tri[1].y = points[i].y;
tri[2].x = points[i + 1].x;
tri[2].y = points[i + 1].y;
lv_draw_triangle(tri, mask, style, opa_scale);
int16_t i;
lv_area_t poly_coords = {.x1 = LV_COORD_MAX, .y1 = LV_COORD_MAX, .x2 = LV_COORD_MIN, .y2 = LV_COORD_MIN};
for(i = 0; i < point_cnt; i++) {
poly_coords.x1 = LV_MATH_MIN(poly_coords.x1, points[i].x);
poly_coords.y1 = LV_MATH_MIN(poly_coords.y1, points[i].y);
poly_coords.x2 = LV_MATH_MAX(poly_coords.x2, points[i].x);
poly_coords.y2 = LV_MATH_MAX(poly_coords.y2, points[i].y);
}
bool is_common;
lv_area_t poly_mask;
is_common = _lv_area_intersect(&poly_mask, &poly_coords, clip_area);
if(!is_common) return;
/*Find the lowest point*/
lv_coord_t y_min = points[0].y;
int16_t y_min_i = 0;
for(i = 1; i < point_cnt; i++) {
if(points[i].y < y_min) {
y_min = points[i].y;
y_min_i = i;
}
}
lv_draw_mask_line_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t) * point_cnt);
lv_draw_mask_line_param_t * mp_next = mp;
int32_t i_prev_left = y_min_i;
int32_t i_prev_right = y_min_i;
int32_t i_next_left;
int32_t i_next_right;
uint32_t mask_cnt = 0;
/* Check if the order of points is inverted or not.
* The normal case is when the left point is on `y_min_i - 1`*/
i_next_left = y_min_i - 1;
if(i_next_left < 0) i_next_left = point_cnt + i_next_left;
i_next_right = y_min_i + 1;
if(i_next_right > point_cnt - 1) i_next_right = 0;
bool inv = false;
if(points[i_next_left].x > points[i_next_right].x && points[i_next_left].y < points[i_next_right].y) inv = true;
do {
if(!inv) {
i_next_left = i_prev_left - 1;
if(i_next_left < 0) i_next_left = point_cnt + i_next_left;
i_next_right = i_prev_right + 1;
if(i_next_right > point_cnt - 1) i_next_right = 0;
}
else {
i_next_left = i_prev_left + 1;
if(i_next_left > point_cnt - 1) i_next_left = 0;
i_next_right = i_prev_right - 1;
if(i_next_right < 0) i_next_right = point_cnt + i_next_right;
}
if(points[i_next_left].y >= points[i_prev_left].y) {
if(points[i_next_left].y != points[i_prev_left].y &&
points[i_next_left].x != points[i_prev_left].x) {
lv_draw_mask_line_points_init(mp_next, points[i_prev_left].x, points[i_prev_left].y,
points[i_next_left].x, points[i_next_left].y,
LV_DRAW_MASK_LINE_SIDE_RIGHT);
lv_draw_mask_add(mp_next, mp);
mp_next++;
}
mask_cnt++;
i_prev_left = i_next_left;
}
if(mask_cnt == point_cnt) break;
if(points[i_next_right].y >= points[i_prev_right].y) {
if(points[i_next_right].y != points[i_prev_right].y &&
points[i_next_right].x != points[i_prev_right].x) {
lv_draw_mask_line_points_init(mp_next, points[i_prev_right].x, points[i_prev_right].y,
points[i_next_right].x, points[i_next_right].y,
LV_DRAW_MASK_LINE_SIDE_LEFT);
lv_draw_mask_add(mp_next, mp);
mp_next++;
}
mask_cnt++;
i_prev_right = i_next_right;
}
} while(mask_cnt < point_cnt);
lv_draw_rect(&poly_coords, clip_area, draw_dsc);
lv_draw_mask_remove_custom(mp);
_lv_mem_buf_release(mp);
}
/**********************
* STATIC FUNCTIONS
**********************/
void tri_draw_flat(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa)
{
/*Return if the points are out of the mask*/
if(points[0].x < mask->x1 && points[1].x < mask->x1 && points[2].x < mask->x1) {
return;
}
if(points[0].x > mask->x2 && points[1].x > mask->x2 && points[2].x > mask->x2) {
return;
}
if(points[0].y < mask->y1 && points[1].y < mask->y1 && points[2].y < mask->y1) {
return;
}
if(points[0].y > mask->y2 && points[1].y > mask->y2 && points[2].y > mask->y2) {
return;
}
lv_point_t tri[3];
memcpy(tri, points, sizeof(tri));
/*Sort the vertices according to their y coordinate (0: y max, 1: y mid, 2:y min)*/
if(tri[1].y < tri[0].y) point_swap(&tri[1], &tri[0]);
if(tri[2].y < tri[1].y) point_swap(&tri[2], &tri[1]);
if(tri[1].y < tri[0].y) point_swap(&tri[1], &tri[0]);
/*Draw the triangle*/
lv_point_t edge1;
lv_coord_t dx1 = LV_MATH_ABS(tri[0].x - tri[1].x);
lv_coord_t sx1 = tri[0].x < tri[1].x ? 1 : -1;
lv_coord_t dy1 = LV_MATH_ABS(tri[0].y - tri[1].y);
lv_coord_t sy1 = tri[0].y < tri[1].y ? 1 : -1;
lv_coord_t err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
lv_coord_t err_tmp1;
lv_point_t edge2;
lv_coord_t dx2 = LV_MATH_ABS(tri[0].x - tri[2].x);
lv_coord_t sx2 = tri[0].x < tri[2].x ? 1 : -1;
lv_coord_t dy2 = LV_MATH_ABS(tri[0].y - tri[2].y);
lv_coord_t sy2 = tri[0].y < tri[2].y ? 1 : -1;
lv_coord_t err2 = (dx1 > dy2 ? dx2 : -dy2) / 2;
lv_coord_t err_tmp2;
lv_coord_t y1_tmp;
lv_coord_t y2_tmp;
edge1.x = tri[0].x;
edge1.y = tri[0].y;
edge2.x = tri[0].x;
edge2.y = tri[0].y;
lv_area_t act_area;
lv_area_t draw_area;
while(1) {
act_area.x1 = edge1.x;
act_area.x2 = edge2.x;
act_area.y1 = edge1.y;
act_area.y2 = edge2.y;
/* Get the area of a line.
* Adjust it a little bit to perfectly match (no redrawn pixels) with the adjacent triangles*/
draw_area.x1 = LV_MATH_MIN(act_area.x1, act_area.x2) + 1;
draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2) - 1;
draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2) - 1;
lv_draw_fill(&draw_area, mask, style->body.main_color, opa);
/*Calc. the next point of edge1*/
y1_tmp = edge1.y;
do {
if(edge1.x == tri[1].x && edge1.y == tri[1].y) {
dx1 = LV_MATH_ABS(tri[1].x - tri[2].x);
sx1 = tri[1].x < tri[2].x ? 1 : -1;
dy1 = LV_MATH_ABS(tri[1].y - tri[2].y);
sy1 = tri[1].y < tri[2].y ? 1 : -1;
err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
} else if(edge1.x == tri[2].x && edge1.y == tri[2].y) {
return;
}
err_tmp1 = err1;
if(err_tmp1 > -dx1) {
err1 -= dy1;
edge1.x += sx1;
}
if(err_tmp1 < dy1) {
err1 += dx1;
edge1.y += sy1;
}
} while(edge1.y == y1_tmp);
/*Calc. the next point of edge2*/
y2_tmp = edge2.y;
do {
if(edge2.x == tri[2].x && edge2.y == tri[2].y) return;
err_tmp2 = err2;
if(err_tmp2 > -dx2) {
err2 -= dy2;
edge2.x += sx2;
}
if(err_tmp2 < dy2) {
err2 += dx2;
edge2.y += sy2;
}
} while(edge2.y == y2_tmp);
}
}
void tri_draw_tall(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa)
{
/*
* Better to draw from vertical lines
* |\
* | |
* | |
* | \
* | |
* |___|
*/
lv_point_t tri[3];
memcpy(tri, points, sizeof(tri));
/*Sort the vertices according to their x coordinate (0: x max, 1: x mid, 2:x min)*/
if(tri[1].x < tri[0].x) point_swap(&tri[1], &tri[0]);
if(tri[2].x < tri[1].x) point_swap(&tri[2], &tri[1]);
if(tri[1].x < tri[0].x) point_swap(&tri[1], &tri[0]);
/*Draw the triangle*/
lv_point_t edge1;
lv_coord_t dx1 = LV_MATH_ABS(tri[0].x - tri[1].x);
lv_coord_t sx1 = tri[0].x < tri[1].x ? 1 : -1;
lv_coord_t dy1 = LV_MATH_ABS(tri[0].y - tri[1].y);
lv_coord_t sy1 = tri[0].y < tri[1].y ? 1 : -1;
lv_coord_t err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
lv_coord_t err_tmp1;
lv_point_t edge2;
lv_coord_t dx2 = LV_MATH_ABS(tri[0].x - tri[2].x);
lv_coord_t sx2 = tri[0].x < tri[2].x ? 1 : -1;
lv_coord_t dy2 = LV_MATH_ABS(tri[0].y - tri[2].y);
lv_coord_t sy2 = tri[0].y < tri[2].y ? 1 : -1;
lv_coord_t err2 = (dx1 > dy2 ? dx2 : -dy2) / 2;
lv_coord_t err_tmp2;
lv_coord_t x1_tmp;
lv_coord_t x2_tmp;
edge1.x = tri[0].x;
edge1.y = tri[0].y;
edge2.x = tri[0].x;
edge2.y = tri[0].y;
lv_area_t act_area;
lv_area_t draw_area;
while(1) {
act_area.x1 = edge1.x;
act_area.x2 = edge2.x;
act_area.y1 = edge1.y;
act_area.y2 = edge2.y;
draw_area.x1 = LV_MATH_MIN(act_area.x1, act_area.x2);
draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2) - 1;
lv_draw_fill(&draw_area, mask, style->body.main_color, opa);
/*Calc. the next point of edge1*/
x1_tmp = edge1.x;
do {
if(edge1.y == tri[1].y && edge1.x == tri[1].x) {
dx1 = LV_MATH_ABS(tri[1].x - tri[2].x);
sx1 = tri[1].x < tri[2].x ? 1 : -1;
dy1 = LV_MATH_ABS(tri[1].y - tri[2].y);
sy1 = tri[1].y < tri[2].y ? 1 : -1;
err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
} else if(edge1.y == tri[2].y && edge1.x == tri[2].x) {
return;
}
err_tmp1 = err1;
if(err_tmp1 > -dx1) {
err1 -= dy1;
edge1.x += sx1;
}
if(err_tmp1 < dy1) {
err1 += dx1;
edge1.y += sy1;
}
} while(edge1.x == x1_tmp);
/*Calc. the next point of edge2*/
x2_tmp = edge2.x;
do {
if(edge2.y == tri[2].y && edge2.x == tri[2].x) {
return;
}
err_tmp2 = err2;
if(err_tmp2 > -dx2) {
err2 -= dy2;
edge2.x += sx2;
}
if(err_tmp2 < dy2) {
err2 += dx2;
edge2.y += sy2;
}
} while(edge2.x == x2_tmp);
}
}
/**
* Swap two points
* p1 pointer to the first point
* p2 pointer to the second point
*/
static void point_swap(lv_point_t * p1, lv_point_t * p2)
{
lv_point_t tmp;
tmp.x = p1->x;
tmp.y = p1->y;
p1->x = p2->x;
p1->y = p2->y;
p2->x = tmp.x;
p2->y = tmp.y;
}

View File

@@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw.h"
#include "lv_draw_rect.h"
/*********************
* DEFINES
@@ -28,24 +28,22 @@ extern "C" {
**********************/
/**
*
* Draw a triangle
* @param points pointer to an array with 3 points
* @param mask the triangle will be drawn only in this mask
* @param style style for of the triangle
* @param opa_scale scale down all opacities by the factor (0..255)
* @param clip_area the triangle will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc);
/**
* Draw a polygon from triangles. Only convex polygons are supported
* Draw a polygon. Only convex polygons are supported.
* @param points an array of points
* @param point_cnt number of points
* @param mask polygon will be drawn only in this mask
* @param style style of the polygon
* @param opa_scale scale down all opacities by the factor (0..255)
* @param clip_area polygon will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_polygon(const lv_point_t * points, uint32_t point_cnt, const lv_area_t * mask, const lv_style_t * style,
lv_opa_t opa_scale);
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask,
const lv_draw_rect_dsc_t * draw_dsc);
/**********************
* MACROS

677
src/lv_draw/lv_img_buf.c Normal file
View File

@@ -0,0 +1,677 @@
/**
* @file lv_img_buf.c
*
*/
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include <string.h>
#include "lv_img_buf.h"
#include "lv_draw_img.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
#include "../lv_misc/lv_mem.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Get the color of an image's pixel
* @param dsc an image descriptor
* @param x x coordinate of the point to get
* @param y x coordinate of the point to get
* @param color the color of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` this color is used.
* Not used in other cases.
* @param safe true: check out of bounds
* @return color of the point
*/
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color)
{
lv_color_t p_color = LV_COLOR_BLACK;
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED ||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
#if LV_COLOR_SIZE == 32
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a default alpha value*/
#endif
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
buf_u8 += 4 * 2;
uint8_t bit = x & 0x7;
x = x >> 3;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8, 16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
p_color.full = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
buf_u8 += 4 * 4;
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
/* Get the current pixel.
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
* so the possible real width are 4, 8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
p_color.full = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_4BIT) {
buf_u8 += 4 * 16;
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
* so the possible real width are 2, 4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
p_color.full = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
buf_u8 += 4 * 256;
uint32_t px = dsc->header.w * y + x;
p_color.full = buf_u8[px];
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT || dsc->header.cf == LV_IMG_CF_ALPHA_2BIT ||
dsc->header.cf == LV_IMG_CF_ALPHA_4BIT || dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
p_color = color;
}
return p_color;
}
/**
* Get the alpha value of an image's pixel
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param safe true: check out of bounds
* @return alpha value of the point
*/
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
{
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint32_t px = dsc->header.w * y * LV_IMG_PX_SIZE_ALPHA_BYTE + x * LV_IMG_PX_SIZE_ALPHA_BYTE;
return buf_u8[px + LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT) {
uint8_t bit = x & 0x7;
x = x >> 3;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
uint8_t px_opa = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
return px_opa ? LV_OPA_TRANSP : LV_OPA_COVER;
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
const uint8_t opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
/* Get the current pixel.
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 4 ,8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
uint8_t px_opa = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
return opa_table[px_opa];
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
const uint8_t opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255
};
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
uint8_t px_opa = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
return opa_table[px_opa];
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
uint32_t px = dsc->header.w * y + x;
return buf_u8[px];
}
return LV_OPA_COVER;
}
/**
* Set the alpha value of a pixel of an image. The color won't be affected
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param opa the desired opacity
* @param safe true: check out of bounds
*/
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa)
{
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
buf_u8[px + px_size - 1] = opa;
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT) {
opa = opa >> 7; /*opa -> [0,1]*/
uint8_t bit = x & 0x7;
x = x >> 3;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x1) << (7 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
opa = opa >> 6; /*opa -> [0,3]*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
/* Get the current pixel.
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 4 ,8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x3) << (6 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
opa = opa >> 4; /*opa -> [0,15]*/
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0xF) << (4 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
uint32_t px = dsc->header.w * y + x;
buf_u8[px] = opa;
}
}
/**
* Set the color of a pixel of an image. The alpha channel won't be affected.
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param c color of the point
* @param safe true: check out of bounds
*/
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c)
{
uint8_t * buf_u8 = (uint8_t *)dsc->data;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
_lv_memcpy_small(&buf_u8[px], &c, px_size);
}
else if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
_lv_memcpy_small(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
buf_u8 += sizeof(lv_color32_t) * 2; /*Skip the palette*/
uint8_t bit = x & 0x7;
x = x >> 3;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x1) << (7 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
buf_u8 += sizeof(lv_color32_t) * 4; /*Skip the palette*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
/* Get the current pixel.
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
* so the possible real width are 4, 8 ,12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x3) << (6 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_4BIT) {
buf_u8 += sizeof(lv_color32_t) * 16; /*Skip the palette*/
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0xF) << (4 - bit));
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
buf_u8 += sizeof(lv_color32_t) * 256; /*Skip the palette*/
uint32_t px = dsc->header.w * y + x;
buf_u8[px] = c.full;
}
}
/**
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
* @param dsc pointer to an image descriptor
* @param id the palette color to set:
* - for `LV_IMG_CF_INDEXED1`: 0..1
* - for `LV_IMG_CF_INDEXED2`: 0..3
* - for `LV_IMG_CF_INDEXED4`: 0..15
* - for `LV_IMG_CF_INDEXED8`: 0..255
* @param c the color to set
*/
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
{
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
return;
}
lv_color32_t c32;
c32.full = lv_color_to32(c);
uint8_t * buf = (uint8_t *)dsc->data;
_lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
}
/**
* Allocate an image buffer in RAM
* @param w width of image
* @param h height of image
* @param cf a color format (`LV_IMG_CF_...`)
* @return an allocated image, or NULL on failure
*/
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
{
/* Allocate image descriptor */
lv_img_dsc_t * dsc = lv_mem_alloc(sizeof(lv_img_dsc_t));
if(dsc == NULL)
return NULL;
_lv_memset_00(dsc, sizeof(lv_img_dsc_t));
/* Get image data size */
dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
if(dsc->data_size == 0) {
lv_mem_free(dsc);
return NULL;
}
/* Allocate raw buffer */
dsc->data = lv_mem_alloc(dsc->data_size);
if(dsc->data == NULL) {
lv_mem_free(dsc);
return NULL;
}
_lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
/* Fill in header */
dsc->header.always_zero = 0;
dsc->header.w = w;
dsc->header.h = h;
dsc->header.cf = cf;
return dsc;
}
/**
* Free an allocated image buffer
* @param dsc image buffer to free
*/
void lv_img_buf_free(lv_img_dsc_t * dsc)
{
if(dsc != NULL) {
if(dsc->data != NULL)
lv_mem_free(dsc->data);
lv_mem_free(dsc);
}
}
/**
* Get the memory consumption of a raw bitmap, given color format and dimensions.
* @param w width
* @param h height
* @param cf color format
* @return size in bytes
*/
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
{
switch(cf) {
case LV_IMG_CF_TRUE_COLOR:
return LV_IMG_BUF_SIZE_TRUE_COLOR(w, h);
case LV_IMG_CF_TRUE_COLOR_ALPHA:
return LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h);
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
return LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h);
case LV_IMG_CF_ALPHA_1BIT:
return LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h);
case LV_IMG_CF_ALPHA_2BIT:
return LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h);
case LV_IMG_CF_ALPHA_4BIT:
return LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h);
case LV_IMG_CF_ALPHA_8BIT:
return LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h);
case LV_IMG_CF_INDEXED_1BIT:
return LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h);
case LV_IMG_CF_INDEXED_2BIT:
return LV_IMG_BUF_SIZE_INDEXED_2BIT(w, h);
case LV_IMG_CF_INDEXED_4BIT:
return LV_IMG_BUF_SIZE_INDEXED_4BIT(w, h);
case LV_IMG_CF_INDEXED_8BIT:
return LV_IMG_BUF_SIZE_INDEXED_8BIT(w, h);
default:
return 0;
}
}
#if LV_USE_IMG_TRANSFORM
/**
* Initialize a descriptor to transform an image
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
*/
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
{
dsc->tmp.pivot_x_256 = dsc->cfg.pivot_x * 256;
dsc->tmp.pivot_y_256 = dsc->cfg.pivot_y * 256;
int32_t angle_low = dsc->cfg.angle / 10;
int32_t angle_hight = angle_low + 1;
int32_t angle_rem = dsc->cfg.angle - (angle_low * 10);
int32_t s1 = _lv_trigo_sin(-angle_low);
int32_t s2 = _lv_trigo_sin(-angle_hight);
int32_t c1 = _lv_trigo_sin(-angle_low + 90);
int32_t c2 = _lv_trigo_sin(-angle_hight + 90);
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
/*Use smaller value to avoid overflow*/
dsc->tmp.sinma = dsc->tmp.sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
dsc->tmp.cosma = dsc->tmp.cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
dsc->tmp.chroma_keyed = lv_img_cf_is_chroma_keyed(dsc->cfg.cf) ? 1 : 0;
dsc->tmp.has_alpha = lv_img_cf_has_alpha(dsc->cfg.cf) ? 1 : 0;
if(dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR || dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
dsc->tmp.native_color = 1;
}
else {
dsc->tmp.native_color = 0;
}
dsc->tmp.img_dsc.data = dsc->cfg.src;
dsc->tmp.img_dsc.header.always_zero = 0;
dsc->tmp.img_dsc.header.cf = dsc->cfg.cf;
dsc->tmp.img_dsc.header.w = dsc->cfg.src_w;
dsc->tmp.img_dsc.header.h = dsc->cfg.src_h;
dsc->tmp.zoom_inv = (256 * 256) / dsc->cfg.zoom;
dsc->res.opa = LV_OPA_COVER;
dsc->res.color = dsc->cfg.color;
}
#endif
/**
* Get the area of a rectangle if its rotated and scaled
* @param res store the coordinates here
* @param w width of the rectangle to transform
* @param h height of the rectangle to transform
* @param angle angle of rotation
* @param zoom zoom, (256 no zoom)
* @param pivot x,y pivot coordinates of rotation
*/
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
const lv_point_t * pivot)
{
#if LV_USE_IMG_TRANSFORM
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) {
res->x1 = 0;
res->y1 = 0;
res->x2 = w - 1;
res->y2 = h - 1;
return;
}
int32_t angle_low = angle / 10;
int32_t angle_hight = angle_low + 1;
int32_t angle_rem = angle - (angle_low * 10);
int32_t s1 = _lv_trigo_sin(angle_low);
int32_t s2 = _lv_trigo_sin(angle_hight);
int32_t c1 = _lv_trigo_sin(angle_low + 90);
int32_t c2 = _lv_trigo_sin(angle_hight + 90);
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
/*Use smaller value to avoid overflow*/
sinma = sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
cosma = cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
lv_point_t lt;
lv_point_t rt;
lv_point_t lb;
lv_point_t rb;
lv_coord_t xt;
lv_coord_t yt;
lv_area_t a;
a.x1 = ((-pivot->x) * zoom) >> 8;
a.y1 = ((-pivot->y) * zoom) >> 8;
a.x2 = ((w - pivot->x) * zoom) >> 8;
a.y2 = ((h - pivot->y) * zoom) >> 8;
xt = a.x1;
yt = a.y1;
lt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
lt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x2;
yt = a.y1;
rt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
rt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x1;
yt = a.y2;
lb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
lb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x2;
yt = a.y2;
rb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
rb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
res->x1 = LV_MATH_MIN4(lb.x, lt.x, rb.x, rt.x);
res->x2 = LV_MATH_MAX4(lb.x, lt.x, rb.x, rt.x);
res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y);
res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y);
#else
LV_UNUSED(angle);
LV_UNUSED(zoom);
LV_UNUSED(pivot);
res->x1 = 0;
res->y1 = 0;
res->x2 = w - 1;
res->y2 = h - 1;
#endif
}
#if LV_USE_IMG_TRANSFORM
/**
* Continue transformation by taking the neighbors into account
* @param dsc pointer to the transformation descriptor
*/
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
{
const uint8_t * src_u8 = dsc->cfg.src;
/*Get the fractional part of the source pixel*/
int xs_fract = dsc->tmp.xs & 0xff;
int ys_fract = dsc->tmp.ys & 0xff;
int32_t xn; /*x neighbor*/
lv_opa_t xr; /*x mix ratio*/
if(xs_fract < 0x70) {
xn = - 1;
if(dsc->tmp.xs_int + xn < 0) xn = 0;
xr = xs_fract + 0x80;
}
else if(xs_fract > 0x90) {
xn = 1;
if(dsc->tmp.xs_int + xn >= dsc->cfg.src_w) xn = 0;
xr = (0xFF - xs_fract) + 0x80;
}
else {
xn = 0;
xr = 0xFF;
}
int32_t yn; /*x neighbor*/
lv_opa_t yr; /*x mix ratio*/
if(ys_fract < 0x70) {
yn = - 1;
if(dsc->tmp.ys_int + yn < 0) yn = 0;
yr = ys_fract + 0x80;
}
else if(ys_fract > 0x90) {
yn = 1;
if(dsc->tmp.ys_int + yn >= dsc->cfg.src_h) yn = 0;
yr = (0xFF - ys_fract) + 0x80;
}
else {
yn = 0;
yr = 0xFF;
}
lv_color_t c00 = dsc->res.color;
lv_color_t c01;
lv_color_t c10;
lv_color_t c11;
lv_opa_t a00 = dsc->res.opa;
lv_opa_t a10 = 0;
lv_opa_t a01 = 0;
lv_opa_t a11 = 0;
if(dsc->tmp.native_color) {
_lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
_lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
_lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
sizeof(lv_color_t));
if(dsc->tmp.has_alpha) {
a10 = src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
a01 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size - 1];
a11 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
}
}
else {
c01 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int, dsc->cfg.color);
c10 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int, dsc->tmp.ys_int + yn, dsc->cfg.color);
c11 = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int + yn, dsc->cfg.color);
if(dsc->tmp.has_alpha) {
a10 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int);
a01 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int, dsc->tmp.ys_int + yn);
a11 = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, dsc->tmp.xs_int + xn, dsc->tmp.ys_int + yn);
}
}
lv_opa_t xr0 = xr;
lv_opa_t xr1 = xr;
if(dsc->tmp.has_alpha) {
lv_opa_t a0 = (a00 * xr + (a10 * (255 - xr))) >> 8;
lv_opa_t a1 = (a01 * xr + (a11 * (255 - xr))) >> 8;
dsc->res.opa = (a0 * yr + (a1 * (255 - yr))) >> 8;
if(a0 <= LV_OPA_MIN && a1 <= LV_OPA_MIN) return false;
if(a0 <= LV_OPA_MIN) yr = LV_OPA_TRANSP;
if(a1 <= LV_OPA_MIN) yr = LV_OPA_COVER;
if(a00 <= LV_OPA_MIN) xr0 = LV_OPA_TRANSP;
if(a10 <= LV_OPA_MIN) xr0 = LV_OPA_COVER;
if(a01 <= LV_OPA_MIN) xr1 = LV_OPA_TRANSP;
if(a11 <= LV_OPA_MIN) xr1 = LV_OPA_COVER;
}
else {
xr0 = xr;
xr1 = xr;
dsc->res.opa = LV_OPA_COVER;
}
lv_color_t c0;
if(xr0 == LV_OPA_TRANSP) c0 = c01;
else if(xr0 == LV_OPA_COVER) c0 = c00;
else c0 = lv_color_mix(c00, c01, xr0);
lv_color_t c1;
if(xr1 == LV_OPA_TRANSP) c1 = c11;
else if(xr1 == LV_OPA_COVER) c1 = c10;
else c1 = lv_color_mix(c10, c11, xr1);
if(yr == LV_OPA_TRANSP) dsc->res.color = c1;
else if(yr == LV_OPA_COVER) dsc->res.color = c0;
else dsc->res.color = lv_color_mix(c0, c1, yr);
return true;
}
#endif
/**********************
* STATIC FUNCTIONS
**********************/

395
src/lv_draw/lv_img_buf.h Normal file
View File

@@ -0,0 +1,395 @@
/**
* @file lv_img_buf.h
*
*/
#ifndef LV_IMG_BUF_H
#define LV_IMG_BUF_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
/*********************
* DEFINES
*********************/
/*If image pixels contains alpha we need to know how much byte is a pixel*/
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
#define LV_IMG_PX_SIZE_ALPHA_BYTE 2
#elif LV_COLOR_DEPTH == 16
#define LV_IMG_PX_SIZE_ALPHA_BYTE 3
#elif LV_COLOR_DEPTH == 32
#define LV_IMG_PX_SIZE_ALPHA_BYTE 4
#endif
#define LV_IMG_BUF_SIZE_TRUE_COLOR(w, h) ((LV_COLOR_SIZE / 8) * w * h)
#define LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h) ((LV_COLOR_SIZE / 8) * w * h)
#define LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h)
/*+ 1: to be sure no fractional row*/
#define LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h))
#define LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h))
#define LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h))
#define LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
/*4 * X: for palette*/
#define LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2)
#define LV_IMG_BUF_SIZE_INDEXED_2BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h) + 4 * 4)
#define LV_IMG_BUF_SIZE_INDEXED_4BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h) + 4 * 16)
#define LV_IMG_BUF_SIZE_INDEXED_8BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h) + 4 * 256)
#define LV_IMG_ZOOM_NONE 256
#define _LV_TRANSFORM_TRIGO_SHIFT 10
/**********************
* TYPEDEFS
**********************/
/*Image color format*/
enum {
LV_IMG_CF_UNKNOWN = 0,
LV_IMG_CF_RAW, /**< Contains the file as it is. Needs custom decoder function*/
LV_IMG_CF_RAW_ALPHA, /**< Contains the file as it is. The image has alpha. Needs custom decoder
function*/
LV_IMG_CF_RAW_CHROMA_KEYED, /**< Contains the file as it is. The image is chroma keyed. Needs
custom decoder function*/
LV_IMG_CF_TRUE_COLOR, /**< Color format and depth should match with LV_COLOR settings*/
LV_IMG_CF_TRUE_COLOR_ALPHA, /**< Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /**< Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels
will be transparent*/
LV_IMG_CF_INDEXED_1BIT, /**< Can have 2 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_2BIT, /**< Can have 4 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_4BIT, /**< Can have 16 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_8BIT, /**< Can have 256 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_ALPHA_1BIT, /**< Can have one color and it can be drawn or not*/
LV_IMG_CF_ALPHA_2BIT, /**< Can have one color but 4 different alpha value*/
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
LV_IMG_CF_RESERVED_15, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_16, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_17, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_18, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_19, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_20, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_21, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_22, /**< Reserved for further use. */
LV_IMG_CF_RESERVED_23, /**< Reserved for further use. */
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format. */
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format. */
};
typedef uint8_t lv_img_cf_t;
/**
* LVGL image header
*/
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c
* On big endian systems the order is reversed so cf and always_zero must be at
* the end of the struct.
* */
#if LV_BIG_ENDIAN_SYSTEM
typedef struct {
uint32_t h : 11; /*Height of the image map*/
uint32_t w : 11; /*Width of the image map*/
uint32_t reserved : 2; /*Reserved to be used later*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
} lv_img_header_t;
#else
typedef struct {
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
uint32_t reserved : 2; /*Reserved to be used later*/
uint32_t w : 11; /*Width of the image map*/
uint32_t h : 11; /*Height of the image map*/
} lv_img_header_t;
#endif
/** Image header it is compatible with
* the result from image converter utility*/
typedef struct {
lv_img_header_t header;
uint32_t data_size;
const uint8_t * data;
} lv_img_dsc_t;
typedef struct {
struct {
const void * src; /*image source (array of pixels)*/
lv_coord_t src_w; /*width of the image source*/
lv_coord_t src_h; /*height of the image source*/
lv_coord_t pivot_x; /*pivot x*/
lv_coord_t pivot_y; /* pivot y*/
int16_t angle; /*angle to rotate*/
uint16_t zoom; /*256 no zoom, 128 half size, 512 double size*/
lv_color_t color; /*a color used for `LV_IMG_CF_INDEXED_1/2/4/8BIT` color formats*/
lv_img_cf_t cf; /*color format of the image to rotate*/
bool antialias;
} cfg;
struct {
lv_color_t color;
lv_opa_t opa;
} res;
struct {
lv_img_dsc_t img_dsc;
int32_t pivot_x_256;
int32_t pivot_y_256;
int32_t sinma;
int32_t cosma;
uint8_t chroma_keyed : 1;
uint8_t has_alpha : 1;
uint8_t native_color : 1;
uint16_t zoom_inv;
/*Runtime data*/
lv_coord_t xs;
lv_coord_t ys;
lv_coord_t xs_int;
lv_coord_t ys_int;
uint32_t pxi;
uint8_t px_size;
} tmp;
} lv_img_transform_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Allocate an image buffer in RAM
* @param w width of image
* @param h height of image
* @param cf a color format (`LV_IMG_CF_...`)
* @return an allocated image, or NULL on failure
*/
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
/**
* Get the color of an image's pixel
* @param dsc an image descriptor
* @param x x coordinate of the point to get
* @param y x coordinate of the point to get
* @param color the color of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` this color is used.
* Not used in other cases.
* @param safe true: check out of bounds
* @return color of the point
*/
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
/**
* Get the alpha value of an image's pixel
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param safe true: check out of bounds
* @return alpha value of the point
*/
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
/**
* Set the color of a pixel of an image. The alpha channel won't be affected.
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param c color of the point
* @param safe true: check out of bounds
*/
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
/**
* Set the alpha value of a pixel of an image. The color won't be affected
* @param dsc pointer to an image descriptor
* @param x x coordinate of the point to set
* @param y x coordinate of the point to set
* @param opa the desired opacity
* @param safe true: check out of bounds
*/
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
/**
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
* @param dsc pointer to an image descriptor
* @param id the palette color to set:
* - for `LV_IMG_CF_INDEXED1`: 0..1
* - for `LV_IMG_CF_INDEXED2`: 0..3
* - for `LV_IMG_CF_INDEXED4`: 0..15
* - for `LV_IMG_CF_INDEXED8`: 0..255
* @param c the color to set
*/
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
/**
* Free an allocated image buffer
* @param dsc image buffer to free
*/
void lv_img_buf_free(lv_img_dsc_t * dsc);
/**
* Get the memory consumption of a raw bitmap, given color format and dimensions.
* @param w width
* @param h height
* @param cf color format
* @return size in bytes
*/
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
#if LV_USE_IMG_TRANSFORM
/**
* Initialize a descriptor to rotate an image
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
*/
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc);
/**
* Continue transformation by taking the neighbors into account
* @param dsc pointer to the transformation descriptor
*/
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc);
/**
* Get which color and opa would come to a pixel if it were rotated
* @param dsc a descriptor initialized by `lv_img_buf_rotate_init`
* @param x the coordinate which color and opa should be get
* @param y the coordinate which color and opa should be get
* @return true: there is valid pixel on these x/y coordinates; false: the rotated pixel was out of the image
* @note the result is written back to `dsc->res_color` and `dsc->res_opa`
*/
static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
{
const uint8_t * src_u8 = (const uint8_t *)dsc->cfg.src;
/*Get the target point relative coordinates to the pivot*/
int32_t xt = x - dsc->cfg.pivot_x;
int32_t yt = y - dsc->cfg.pivot_y;
int32_t xs;
int32_t ys;
if(dsc->cfg.zoom == LV_IMG_ZOOM_NONE) {
/*Get the source pixel from the upscaled image*/
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
}
else if(dsc->cfg.angle == 0) {
xt *= dsc->tmp.zoom_inv;
yt *= dsc->tmp.zoom_inv;
xs = xt + dsc->tmp.pivot_x_256;
ys = yt + dsc->tmp.pivot_y_256;
}
else {
xt *= dsc->tmp.zoom_inv;
yt *= dsc->tmp.zoom_inv;
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
}
/*Get the integer part of the source pixel*/
int32_t xs_int = xs >> 8;
int32_t ys_int = ys >> 8;
if(xs_int >= dsc->cfg.src_w) return false;
else if(xs_int < 0) return false;
if(ys_int >= dsc->cfg.src_h) return false;
else if(ys_int < 0) return false;
uint8_t px_size;
uint32_t pxi;
if(dsc->tmp.native_color) {
if(dsc->tmp.has_alpha == 0) {
px_size = LV_COLOR_SIZE >> 3;
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
_lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size);
}
else {
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE;
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
_lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size - 1);
dsc->res.opa = src_u8[pxi + px_size - 1];
}
}
else {
pxi = 0; /*unused*/
px_size = 0; /*unused*/
dsc->res.color = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, xs_int, ys_int, dsc->cfg.color);
dsc->res.opa = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, xs_int, ys_int);
}
if(dsc->tmp.chroma_keyed) {
lv_color_t ct = LV_COLOR_TRANSP;
if(dsc->res.color.full == ct.full) return false;
}
if(dsc->cfg.antialias == false) return true;
dsc->tmp.xs = xs;
dsc->tmp.ys = ys;
dsc->tmp.xs_int = xs_int;
dsc->tmp.ys_int = ys_int;
dsc->tmp.pxi = pxi;
dsc->tmp.px_size = px_size;
bool ret;
ret = _lv_img_buf_transform_anti_alias(dsc);
return ret;
}
#endif
/**
* Get the area of a rectangle if its rotated and scaled
* @param res store the coordinates here
* @param w width of the rectangle to transform
* @param h height of the rectangle to transform
* @param angle angle of rotation
* @param zoom zoom, (256 no zoom)
* @param pivot x,y pivot coordinates of rotation
*/
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
const lv_point_t * pivot);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_IMG_BUF_H*/

View File

@@ -6,12 +6,15 @@
/*********************
* INCLUDES
*********************/
#include "../lv_misc/lv_debug.h"
#include "lv_img_cache.h"
#include "lv_img_decoder.h"
#include "lv_draw_img.h"
#include "../lv_hal/lv_hal_tick.h"
#include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
* DEFINES
@@ -27,7 +30,7 @@
#define LV_IMG_CACHE_LIFE_LIMIT 1000
#if LV_IMG_CACHE_DEF_SIZE < 1
#error "LV_IMG_CACHE_DEF_SIZE must be >= 1. See lv_conf.h"
#error "LV_IMG_CACHE_DEF_SIZE must be >= 1. See lv_conf.h"
#endif
/**********************
@@ -56,10 +59,10 @@ static uint16_t entry_cnt;
* The image will be left open meaning if the image decoder open callback allocated memory then it will remain.
* The image is closed if a new image is opened and the new image takes its place in the cache.
* @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable
* @param style style of the image
* @param color color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return pointer to the cache entry or NULL if can open the image
*/
lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * style)
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
{
if(entry_cnt == 0) {
LV_LOG_WARN("lv_img_cache_open: the cache size is 0");
@@ -79,7 +82,16 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
/*Is the image cached?*/
lv_img_cache_entry_t * cached_src = NULL;
for(i = 0; i < entry_cnt; i++) {
if(cache[i].dec_dsc.src == src) {
bool match = false;
lv_img_src_t src_type = lv_img_src_get_type(cache[i].dec_dsc.src);
if(src_type == LV_IMG_SRC_VARIABLE) {
if(cache[i].dec_dsc.src == src && cache[i].dec_dsc.color.full == color.full) match = true;
}
else if(src_type == LV_IMG_SRC_FILE) {
if(strcmp(cache[i].dec_dsc.src, src) == 0) match = true;
}
if(match) {
/* If opened increment its life.
* Image difficult to open should live longer to keep avoid frequent their recaching.
* Therefore increase `life` with `time_to_open`*/
@@ -105,7 +117,8 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
if(cached_src->dec_dsc.src) {
lv_img_decoder_close(&cached_src->dec_dsc);
LV_LOG_INFO("image draw: cache miss, close and reuse an entry");
} else {
}
else {
LV_LOG_INFO("image draw: cache miss, cached to an empty entry");
}
@@ -113,12 +126,12 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
uint32_t t_start;
t_start = lv_tick_get();
cached_src->dec_dsc.time_to_open = 0;
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, color);
if(open_res == LV_RES_INV) {
LV_LOG_WARN("Image draw cannot open the image resource");
lv_img_decoder_close(&cached_src->dec_dsc);
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(cached_src, 0, sizeof(lv_img_cache_entry_t));
_lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
_lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
return NULL;
}
@@ -152,7 +165,7 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
/*Reallocate the cache*/
LV_GC_ROOT(_lv_img_cache_array) = lv_mem_alloc(sizeof(lv_img_cache_entry_t) * new_entry_cnt);
lv_mem_assert(LV_GC_ROOT(_lv_img_cache_array));
LV_ASSERT_MEM(LV_GC_ROOT(_lv_img_cache_array));
if(LV_GC_ROOT(_lv_img_cache_array) == NULL) {
entry_cnt = 0;
return;
@@ -162,8 +175,8 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
/*Clean the cache*/
uint16_t i;
for(i = 0; i < entry_cnt; i++) {
memset(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(&LV_GC_ROOT(_lv_img_cache_array)[i], 0, sizeof(lv_img_cache_entry_t));
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i], sizeof(lv_img_cache_entry_t));
}
}
@@ -184,8 +197,8 @@ void lv_img_cache_invalidate_src(const void * src)
lv_img_decoder_close(&cache[i].dec_dsc);
}
memset(&cache[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(&cache[i], 0, sizeof(lv_img_cache_entry_t));
_lv_memset_00(&cache[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
_lv_memset_00(&cache[i], sizeof(lv_img_cache_entry_t));
}
}
}

View File

@@ -25,11 +25,10 @@ extern "C" {
/**
* When loading images from the network it can take a long time to download and decode the image.
*
*
* To avoid repeating this heavy load images can be cached.
*/
typedef struct
{
typedef struct {
lv_img_decoder_dsc_t dec_dsc; /**< Image information */
/** Count the cache entries's life. Add `time_tio_open` to `life` when the entry is used.
@@ -47,10 +46,10 @@ typedef struct
* The image will be left open meaning if the image decoder open callback allocated memory then it will remain.
* The image is closed if a new image is opened and the new image takes its place in the cache.
* @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable
* @param style style of the image
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return pointer to the cache entry or NULL if can open the image
*/
lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * style);
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color);
/**
* Set the number of images to be cached.

View File

@@ -7,39 +7,36 @@
* INCLUDES
*********************/
#include "lv_img_decoder.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_img.h"
#include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
* DEFINES
*********************/
#define CF_BUILT_IN_FIRST LV_IMG_CF_TRUE_COLOR
#define CF_BUILT_IN_LAST LV_IMG_CF_ALPHA_8BIT
/**********************
* TYPEDEFS
**********************/
typedef struct
{
typedef struct {
#if LV_USE_FILESYSTEM
lv_fs_file_t * f;
#endif
lv_color_t * palette;
lv_opa_t * opa;
} lv_img_decoder_built_in_data_t;
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header);
static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
static lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc, lv_coord_t x,
lv_coord_t y, lv_coord_t len, uint8_t * buf);
static void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
lv_coord_t len, uint8_t * buf);
static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
@@ -62,9 +59,9 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
/**
* Initialize the image decoder module
* */
void lv_img_decoder_init(void)
void _lv_img_decoder_init(void)
{
lv_ll_init(&LV_GC_ROOT(_lv_img_defoder_ll), sizeof(lv_img_decoder_t));
_lv_ll_init(&LV_GC_ROOT(_lv_img_defoder_ll), sizeof(lv_img_decoder_t));
lv_img_decoder_t * decoder;
@@ -72,7 +69,7 @@ void lv_img_decoder_init(void)
decoder = lv_img_decoder_create();
if(decoder == NULL) {
LV_LOG_WARN("lv_img_decoder_init: out of memory");
lv_mem_assert(decoder);
LV_ASSERT_MEM(decoder);
return;
}
@@ -92,11 +89,13 @@ void lv_img_decoder_init(void)
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
{
header->always_zero = 0;
header->h = 0;
header->w = 0;
header->cf = LV_IMG_CF_UNKNOWN;
lv_res_t res = LV_RES_INV;
lv_img_decoder_t * d;
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
{
_LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
res = LV_RES_INV;
if(d->info_cb) {
res = d->info_cb(d, src, header);
@@ -115,22 +114,29 @@ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param style the style of the image
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
* LV_RES_INV: none of the registered image decoders were able to open the image.
*/
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const lv_style_t * style)
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_color_t color)
{
dsc->style = style;
dsc->src = src;
dsc->color = color;
dsc->src_type = lv_img_src_get_type(src);
dsc->user_data = NULL;
if(dsc->src_type == LV_IMG_SRC_FILE) {
size_t fnlen = strlen(src);
dsc->src = lv_mem_alloc(fnlen + 1);
strcpy((char *)dsc->src, src);
}
else {
dsc->src = src;
}
lv_res_t res = LV_RES_INV;
lv_img_decoder_t * d;
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
{
_LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
/*Info an Open callbacks are required*/
if(d->info_cb == NULL || d->open_cb == NULL) continue;
@@ -147,10 +153,6 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
if(res == LV_RES_OK) break;
}
if(res == LV_RES_INV) {
memset(dsc, 0, sizeof(lv_img_decoder_dsc_t));
}
return res;
}
@@ -177,7 +179,14 @@ lv_res_t lv_img_decoder_read_line(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_c
*/
void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
{
if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);
if(dsc->decoder) {
if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);
if(dsc->src_type == LV_IMG_SRC_FILE) {
lv_mem_free(dsc->src);
dsc->src = NULL;
}
}
}
/**
@@ -187,11 +196,11 @@ void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
lv_img_decoder_t * lv_img_decoder_create(void)
{
lv_img_decoder_t * decoder;
decoder = lv_ll_ins_head(&LV_GC_ROOT(_lv_img_defoder_ll));
lv_mem_assert(decoder);
decoder = _lv_ll_ins_head(&LV_GC_ROOT(_lv_img_defoder_ll));
LV_ASSERT_MEM(decoder);
if(decoder == NULL) return NULL;
memset(decoder, 0, sizeof(lv_img_decoder_t));
_lv_memset_00(decoder, sizeof(lv_img_decoder_t));
return decoder;
}
@@ -202,7 +211,7 @@ lv_img_decoder_t * lv_img_decoder_create(void)
*/
void lv_img_decoder_delete(lv_img_decoder_t * decoder)
{
lv_ll_rem(&LV_GC_ROOT(_lv_img_defoder_ll), decoder);
_lv_ll_remove(&LV_GC_ROOT(_lv_img_defoder_ll), decoder);
lv_mem_free(decoder);
}
@@ -246,16 +255,22 @@ void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_clos
decoder->close_cb = close_cb;
}
/**********************
* STATIC FUNCTIONS
**********************/
static lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header)
/**
* Get info about a built-in image
* @param decoder the decoder where this function belongs
* @param src the image source: pointer to an `lv_img_dsc_t` variable, a file path or a symbol
* @param header store the image data here
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
*/
lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header)
{
(void)decoder; /*Unused*/
lv_img_src_t src_type = lv_img_src_get_type(src);
if(src_type == LV_IMG_SRC_VARIABLE) {
lv_img_cf_t cf = ((lv_img_dsc_t *)src)->header.cf;
if(cf < CF_BUILT_IN_FIRST || cf > CF_BUILT_IN_LAST) return LV_RES_INV;
header->w = ((lv_img_dsc_t *)src)->header.w;
header->h = ((lv_img_dsc_t *)src)->header.h;
header->cf = ((lv_img_dsc_t *)src)->header.cf;
@@ -269,15 +284,14 @@ static lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const v
if(res == LV_FS_RES_OK) {
res = lv_fs_read(&file, header, sizeof(lv_img_header_t), &rn);
lv_fs_close(&file);
if(res != LV_FS_RES_OK || rn != sizeof(lv_img_header_t)) {
LV_LOG_WARN("Image get info get read file header");
return LV_RES_INV;
}
}
/*Create a dummy header on fs error*/
if(res != LV_FS_RES_OK || rn != sizeof(lv_img_header_t)) {
header->w = LV_DPI;
header->h = LV_DPI;
header->cf = LV_IMG_CF_UNKNOWN;
return LV_RES_INV;
}
if(header->cf < CF_BUILT_IN_FIRST || header->cf > CF_BUILT_IN_LAST) return LV_RES_INV;
}
#endif
else if(src_type == LV_IMG_SRC_SYMBOL) {
@@ -288,14 +302,21 @@ static lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const v
/* Symbols always have transparent parts. Important because of cover check in the design
* function. The actual value doesn't matter because lv_draw_label will draw it*/
header->cf = LV_IMG_CF_ALPHA_1BIT;
} else {
}
else {
LV_LOG_WARN("Image get info found unknown src type");
return LV_RES_INV;
}
return LV_RES_OK;
}
static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc)
/**
* Open a built in image
* @param decoder the decoder where this function belongs
* @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it.
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
*/
lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc)
{
/*Open the file if it's a file*/
if(dsc->src_type == LV_IMG_SRC_FILE) {
@@ -314,27 +335,36 @@ static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_
/*If the file was open successfully save the file descriptor*/
if(dsc->user_data == NULL) {
dsc->user_data = lv_mem_alloc(sizeof(lv_img_decoder_built_in_data_t));
LV_ASSERT_MEM(dsc->user_data);
if(dsc->user_data == NULL) {
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
lv_mem_assert(dsc->user_data);
return LV_RES_INV;
}
memset(dsc->user_data, 0, sizeof(lv_img_decoder_built_in_data_t));
_lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
}
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
user_data->f = lv_mem_alloc(sizeof(f));
user_data->f = lv_mem_alloc(sizeof(f));
LV_ASSERT_MEM(user_data->f);
if(user_data->f == NULL) {
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
lv_mem_assert(user_data->f);
lv_img_decoder_built_in_close(decoder, dsc);
return LV_RES_INV;
}
memcpy(user_data->f, &f, sizeof(f));
_lv_memcpy_small(user_data->f, &f, sizeof(f));
#else
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
}
else if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
/*The variables should have valid data*/
if(((lv_img_dsc_t *)dsc->src)->data == NULL) {
return LV_RES_INV;
}
}
lv_img_cf_t cf = dsc->header.cf;
/*Process true color formats*/
@@ -344,7 +374,8 @@ static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_
* So simply give its pointer*/
dsc->img_data = ((lv_img_dsc_t *)dsc->src)->data;
return LV_RES_OK;
} else {
}
else {
/*If it's a file it need to be read line by line later*/
dsc->img_data = NULL;
return LV_RES_OK;
@@ -355,44 +386,57 @@ static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_
cf == LV_IMG_CF_INDEXED_8BIT) {
#if LV_IMG_CF_INDEXED
uint8_t px_size = lv_img_color_format_get_px_size(cf);
uint8_t px_size = lv_img_cf_get_px_size(cf);
uint32_t palette_size = 1 << px_size;
/*Allocate the palette*/
if(dsc->user_data == NULL) {
dsc->user_data = lv_mem_alloc(sizeof(lv_img_decoder_built_in_data_t));
LV_ASSERT_MEM(dsc->user_data);
if(dsc->user_data == NULL) {
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
lv_mem_assert(dsc->user_data);
lv_img_decoder_built_in_close(decoder, dsc);
return LV_RES_INV;
}
memset(dsc->user_data, 0, sizeof(lv_img_decoder_built_in_data_t));
_lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
}
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
user_data->palette = lv_mem_alloc(palette_size * sizeof(lv_color_t));
if(user_data->palette == NULL) {
LV_ASSERT_MEM(user_data->palette);
user_data->opa = lv_mem_alloc(palette_size * sizeof(lv_opa_t));
LV_ASSERT_MEM(user_data->opa);
if(user_data->palette == NULL || user_data->opa == NULL) {
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
#if LV_USE_FILESYSTEM
lv_mem_assert(user_data->f);
#endif
lv_img_decoder_built_in_close(decoder, dsc);
return LV_RES_INV;
}
if(dsc->src_type == LV_IMG_SRC_FILE) {
/*Read the palette from file*/
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, 4); /*Skip the header*/
lv_fs_read(user_data->f, user_data->palette, palette_size * sizeof(lv_color_t), NULL);
lv_color32_t cur_color;
uint32_t i;
for(i = 0; i < palette_size; i++) {
lv_fs_read(user_data->f, &cur_color, sizeof(lv_color32_t), NULL);
user_data->palette[i] = lv_color_make(cur_color.ch.red, cur_color.ch.green, cur_color.ch.blue);
user_data->opa[i] = cur_color.ch.alpha;
}
#else
LV_LOG_WARN("Image built-in decoder can read the palette because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
} else {
}
else {
/*The palette begins in the beginning of the image data. Just point to it.*/
lv_color32_t * palette_p = (lv_color32_t *)((lv_img_dsc_t *)dsc->src)->data;
uint32_t i;
for(i = 0; i < palette_size; i++) {
user_data->palette[i] = lv_color_make(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue);
user_data->opa[i] = palette_p[i].ch.alpha;
}
}
@@ -424,8 +468,19 @@ static lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_
}
}
static lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc, lv_coord_t x,
lv_coord_t y, lv_coord_t len, uint8_t * buf)
/**
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
* Required only if the "open" function can't return with the whole decoded pixel array.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
* @param x start x coordinate
* @param y start y coordinate
* @param len number of pixels to decode
* @param buf a buffer to store the decoded pixels
* @return LV_RES_OK: ok; LV_RES_INV: failed
*/
lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc, lv_coord_t x,
lv_coord_t y, lv_coord_t len, uint8_t * buf)
{
(void)decoder; /*Unused*/
@@ -438,14 +493,17 @@ static lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv
if(dsc->src_type == LV_IMG_SRC_FILE) {
res = lv_img_decoder_built_in_line_true_color(dsc, x, y, len, buf);
}
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT || dsc->header.cf == LV_IMG_CF_ALPHA_2BIT ||
dsc->header.cf == LV_IMG_CF_ALPHA_4BIT || dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
}
else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT || dsc->header.cf == LV_IMG_CF_ALPHA_2BIT ||
dsc->header.cf == LV_IMG_CF_ALPHA_4BIT || dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
res = lv_img_decoder_built_in_line_alpha(dsc, x, y, len, buf);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT || dsc->header.cf == LV_IMG_CF_INDEXED_2BIT ||
dsc->header.cf == LV_IMG_CF_INDEXED_4BIT || dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT || dsc->header.cf == LV_IMG_CF_INDEXED_2BIT ||
dsc->header.cf == LV_IMG_CF_INDEXED_4BIT || dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
res = lv_img_decoder_built_in_line_indexed(dsc, x, y, len, buf);
} else {
}
else {
LV_LOG_WARN("Built-in image decoder read not supports the color format");
return LV_RES_INV;
}
@@ -453,7 +511,12 @@ static lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv
return res;
}
static void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc)
/**
* Close the pending decoding. Free resources etc.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
*/
void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc)
{
(void)decoder; /*Unused*/
@@ -466,6 +529,7 @@ static void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_dec
}
#endif
if(user_data->palette) lv_mem_free(user_data->palette);
if(user_data->opa) lv_mem_free(user_data->opa);
lv_mem_free(user_data);
@@ -473,13 +537,18 @@ static void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_dec
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y,
lv_coord_t len, uint8_t * buf)
{
#if LV_USE_FILESYSTEM
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
lv_fs_res_t res;
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf);
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf);
uint32_t pos = ((y * dsc->header.w + x) * px_size) >> 3;
pos += 4; /*Skip the header*/
@@ -490,7 +559,7 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
}
uint32_t btr = len * (px_size >> 3);
uint32_t br = 0;
lv_fs_read(user_data->f, buf, btr, &br);
res = lv_fs_read(user_data->f, buf, btr, &br);
if(res != LV_FS_RES_OK || btr != br) {
LV_LOG_WARN("Built-in image decoder read failed");
return LV_RES_INV;
@@ -498,6 +567,11 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
return LV_RES_OK;
#else
LV_UNUSED(dsc);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(len);
LV_UNUSED(buf);
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif
@@ -511,10 +585,11 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
const lv_opa_t alpha1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
const lv_opa_t alpha2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
const lv_opa_t alpha4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255};
68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255
};
/*Simply fill the buffer with the color. Later only the alpha value will be modified.*/
lv_color_t bg_color = dsc->style->image.color;
lv_color_t bg_color = dsc->color;
lv_coord_t i;
for(i = 0; i < len; i++) {
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
@@ -531,7 +606,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
}
const lv_opa_t * opa_table = NULL;
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf);
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf);
uint16_t mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/
lv_coord_t w = 0;
@@ -568,7 +643,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
#if LV_USE_FILESYSTEM
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
uint8_t fs_buf[LV_HOR_RES_MAX];
uint8_t * fs_buf = _lv_mem_buf_get(w);
#endif
const uint8_t * data_tmp = NULL;
@@ -576,7 +651,8 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
const lv_img_dsc_t * img_dsc = dsc->src;
data_tmp = img_dsc->data + ofs;
} else {
}
else {
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, ofs + 4); /*+4 to skip the header*/
lv_fs_read(user_data->f, fs_buf, w, NULL);
@@ -588,10 +664,8 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
#endif
}
uint8_t byte_act = 0;
uint8_t val_act;
for(i = 0; i < len; i++) {
val_act = (data_tmp[byte_act] & (mask << pos)) >> pos;
uint8_t val_act = (*data_tmp & (mask << pos)) >> pos;
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE + LV_IMG_PX_SIZE_ALPHA_BYTE - 1] =
dsc->header.cf == LV_IMG_CF_ALPHA_8BIT ? val_act : opa_table[val_act];
@@ -602,7 +676,9 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
data_tmp++;
}
}
#if LV_USE_FILESYSTEM
_lv_mem_buf_release(fs_buf);
#endif
return LV_RES_OK;
#else
@@ -616,7 +692,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
{
#if LV_IMG_CF_INDEXED
uint8_t px_size = lv_img_color_format_get_px_size(dsc->header.cf);
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf);
uint16_t mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/
lv_coord_t w = 0;
@@ -655,13 +731,14 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
#if LV_USE_FILESYSTEM
uint8_t fs_buf[LV_HOR_RES_MAX];
uint8_t * fs_buf = _lv_mem_buf_get(w);
#endif
const uint8_t * data_tmp = NULL;
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
const lv_img_dsc_t * img_dsc = dsc->src;
data_tmp = img_dsc->data + ofs;
} else {
}
else {
#if LV_USE_FILESYSTEM
lv_fs_seek(user_data->f, ofs + 4); /*+4 to skip the header*/
lv_fs_read(user_data->f, fs_buf, w, NULL);
@@ -673,13 +750,23 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
#endif
}
uint8_t byte_act = 0;
uint8_t val_act;
lv_coord_t i;
lv_color_t * cbuf = (lv_color_t *)buf;
for(i = 0; i < len; i++) {
val_act = (data_tmp[byte_act] & (mask << pos)) >> pos;
cbuf[i] = user_data->palette[val_act];
uint8_t val_act = (*data_tmp & (mask << pos)) >> pos;
lv_color_t color = user_data->palette[val_act];
#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE] = color.full;
#elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE] = color.full & 0xFF;
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE + 1] = (color.full >> 8) & 0xFF;
#elif LV_COLOR_DEPTH == 32
*((uint32_t *)&buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE]) = color.full;
#else
#error "Invalid LV_COLOR_DEPTH. Check it in lv_conf.h"
#endif
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE + LV_IMG_PX_SIZE_ALPHA_BYTE - 1] = user_data->opa[val_act];
pos -= px_size;
if(pos < 0) {
@@ -687,7 +774,9 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
data_tmp++;
}
}
#if LV_USE_FILESYSTEM
_lv_mem_buf_release(fs_buf);
#endif
return LV_RES_OK;
#else
LV_LOG_WARN("Image built-in indexed line reader failed because LV_IMG_CF_INDEXED is 0 in lv_conf.h");

View File

@@ -13,13 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_img_buf.h"
#include "../lv_misc/lv_fs.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_area.h"
@@ -28,14 +25,6 @@ extern "C" {
/*********************
* DEFINES
*********************/
/*If image pixels contains alpha we need to know how much byte is a pixel*/
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
#define LV_IMG_PX_SIZE_ALPHA_BYTE 2
#elif LV_COLOR_DEPTH == 16
#define LV_IMG_PX_SIZE_ALPHA_BYTE 3
#elif LV_COLOR_DEPTH == 32
#define LV_IMG_PX_SIZE_ALPHA_BYTE 4
#endif
/**********************
* TYPEDEFS
@@ -51,59 +40,6 @@ enum {
};
typedef uint8_t lv_img_src_t;
/**
* LittlevGL image header
*/
typedef struct
{
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c */
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
uint32_t reserved : 2; /*Reserved to be used later*/
uint32_t w : 11; /*Width of the image map*/
uint32_t h : 11; /*Height of the image map*/
} lv_img_header_t;
/*Image color format*/
enum {
LV_IMG_CF_UNKNOWN = 0,
LV_IMG_CF_RAW, /**< Contains the file as it is. Needs custom decoder function*/
LV_IMG_CF_RAW_ALPHA, /**< Contains the file as it is. The image has alpha. Needs custom decoder
function*/
LV_IMG_CF_RAW_CHROMA_KEYED, /**< Contains the file as it is. The image is chroma keyed. Needs
custom decoder function*/
LV_IMG_CF_TRUE_COLOR, /**< Color format and depth should match with LV_COLOR settings*/
LV_IMG_CF_TRUE_COLOR_ALPHA, /**< Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /**< Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels
will be transparent*/
LV_IMG_CF_INDEXED_1BIT, /**< Can have 2 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_2BIT, /**< Can have 4 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_4BIT, /**< Can have 16 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_8BIT, /**< Can have 256 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_ALPHA_1BIT, /**< Can have one color and it can be drawn or not*/
LV_IMG_CF_ALPHA_2BIT, /**< Can have one color but 4 different alpha value*/
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
};
typedef uint8_t lv_img_cf_t;
/** Image header it is compatible with
* the result from image converter utility*/
typedef struct
{
lv_img_header_t header;
uint32_t data_size;
const uint8_t * data;
} lv_img_dsc_t;
/* Decoder function definitions */
@@ -148,8 +84,7 @@ typedef lv_res_t (*lv_img_decoder_read_line_f_t)(struct _lv_img_decoder * decode
*/
typedef void (*lv_img_decoder_close_f_t)(struct _lv_img_decoder * decoder, struct _lv_img_decoder_dsc * dsc);
typedef struct _lv_img_decoder
{
typedef struct _lv_img_decoder {
lv_img_decoder_info_f_t info_cb;
lv_img_decoder_open_f_t open_cb;
lv_img_decoder_read_line_f_t read_line_cb;
@@ -161,8 +96,7 @@ typedef struct _lv_img_decoder
} lv_img_decoder_t;
/**Describe an image decoding session. Stores data about the decoding*/
typedef struct _lv_img_decoder_dsc
{
typedef struct _lv_img_decoder_dsc {
/**The decoder which was able to open the image source*/
lv_img_decoder_t * decoder;
@@ -170,7 +104,7 @@ typedef struct _lv_img_decoder_dsc
const void * src;
/**Style to draw the image.*/
const lv_style_t * style;
lv_color_t color;
/**Type of the source: file or variable. Can be set in `open` function if required*/
lv_img_src_t src_type;
@@ -201,7 +135,7 @@ typedef struct _lv_img_decoder_dsc
/**
* Initialize the image decoder module
*/
void lv_img_decoder_init(void);
void _lv_img_decoder_init(void);
/**
* Get information about an image.
@@ -223,11 +157,11 @@ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header);
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param style the style of the image
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
* LV_RES_INV: none of the registered image decoders were able to open the image.
*/
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const lv_style_t * style);
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_color_t color);
/**
* Read a line from an opened image
@@ -287,6 +221,44 @@ void lv_img_decoder_set_read_line_cb(lv_img_decoder_t * decoder, lv_img_decoder_
*/
void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_close_f_t close_cb);
/**
* Get info about a built-in image
* @param decoder the decoder where this function belongs
* @param src the image source: pointer to an `lv_img_dsc_t` variable, a file path or a symbol
* @param header store the image data here
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
*/
lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header);
/**
* Open a built in image
* @param decoder the decoder where this function belongs
* @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it.
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
*/
lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
/**
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
* Required only if the "open" function can't return with the whole decoded pixel array.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
* @param x start x coordinate
* @param y start y coordinate
* @param len number of pixels to decode
* @param buf a buffer to store the decoded pixels
* @return LV_RES_OK: ok; LV_RES_INV: failed
*/
lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc, lv_coord_t x,
lv_coord_t y, lv_coord_t len, uint8_t * buf);
/**
* Close the pending decoding. Free resources etc.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
*/
void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
/**********************
* MACROS
**********************/

View File

@@ -58,7 +58,8 @@ const uint8_t * lv_font_get_glyph_bitmap(const lv_font_t * font_p, uint32_t lett
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, uint32_t letter_next)
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next)
{
return font_p->get_glyph_dsc(font_p, dsc_out, letter, letter_next);
}

View File

@@ -13,17 +13,13 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_symbol_def.h"
#include "../lv_misc/lv_area.h"
/*********************
* DEFINES
@@ -43,19 +39,28 @@ extern "C" {
*-----------------*/
/** Describes the properties of a glyph. */
typedef struct
{
typedef struct {
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
uint8_t box_w; /**< Width of the glyph's bounding box*/
uint8_t box_h; /**< Height of the glyph's bounding box*/
int8_t ofs_x; /**< x offset of the bounding box*/
int8_t ofs_y; /**< y offset of the bounding box*/
uint16_t box_w; /**< Width of the glyph's bounding box*/
uint16_t box_h; /**< Height of the glyph's bounding box*/
int16_t ofs_x; /**< x offset of the bounding box*/
int16_t ofs_y; /**< y offset of the bounding box*/
uint8_t bpp; /**< Bit-per-pixel: 1, 2, 4, 8*/
}lv_font_glyph_dsc_t;
} lv_font_glyph_dsc_t;
/*Describe the properties of a font*/
typedef struct _lv_font_struct
{
/** The bitmaps might be upscaled by 3 to achieve subpixel rendering. */
enum {
LV_FONT_SUBPX_NONE,
LV_FONT_SUBPX_HOR,
LV_FONT_SUBPX_VER,
LV_FONT_SUBPX_BOTH,
};
typedef uint8_t lv_font_subpx_t;
/** Describe the properties of a font*/
typedef struct _lv_font_struct {
/** Get a glyph's descriptor from a font*/
bool (*get_glyph_dsc)(const struct _lv_font_struct *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
@@ -63,12 +68,19 @@ typedef struct _lv_font_struct
const uint8_t * (*get_glyph_bitmap)(const struct _lv_font_struct *, uint32_t);
/*Pointer to the font in a font pack (must have the same line height)*/
uint8_t line_height; /**< The real line height where any text fits*/
uint8_t base_line; /**< Base line measured from the top of the line_height*/
void * dsc; /**< Store implementation specific data here*/
lv_coord_t line_height; /**< The real line height where any text fits*/
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/
int8_t underline_thickness; /**< Thickness of the underline*/
void * dsc; /**< Store implementation specific or run_time data or caching here*/
#if LV_USE_USER_DATA
lv_font_user_data_t user_data; /**< Custom user data for font. */
lv_font_user_data_t user_data; /**< Custom user data for font. */
#endif
} lv_font_t;
/**********************
@@ -91,7 +103,8 @@ const uint8_t * lv_font_get_glyph_bitmap(const lv_font_t * font_p, uint32_t lett
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, uint32_t letter_next);
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next);
/**
* Get the width of a glyph with kerning
@@ -107,7 +120,7 @@ uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32
* @param font_p pointer to a font
* @return the height of a font
*/
static inline uint8_t lv_font_get_line_height(const lv_font_t * font_p)
static inline lv_coord_t lv_font_get_line_height(const lv_font_t * font_p)
{
return font_p->line_height;
}
@@ -118,26 +131,102 @@ static inline uint8_t lv_font_get_line_height(const lv_font_t * font_p)
#define LV_FONT_DECLARE(font_name) extern lv_font_t font_name;
#if LV_FONT_ROBOTO_12
LV_FONT_DECLARE(lv_font_roboto_12)
#if LV_FONT_MONTSERRAT_12
LV_FONT_DECLARE(lv_font_montserrat_12)
#endif
#if LV_FONT_ROBOTO_16
LV_FONT_DECLARE(lv_font_roboto_16)
#if LV_FONT_MONTSERRAT_14
LV_FONT_DECLARE(lv_font_montserrat_14)
#endif
#if LV_FONT_ROBOTO_22
LV_FONT_DECLARE(lv_font_roboto_22)
#if LV_FONT_MONTSERRAT_16
LV_FONT_DECLARE(lv_font_montserrat_16)
#endif
#if LV_FONT_ROBOTO_28
LV_FONT_DECLARE(lv_font_roboto_28)
#if LV_FONT_MONTSERRAT_18
LV_FONT_DECLARE(lv_font_montserrat_18)
#endif
#if LV_FONT_MONTSERRAT_20
LV_FONT_DECLARE(lv_font_montserrat_20)
#endif
#if LV_FONT_MONTSERRAT_22
LV_FONT_DECLARE(lv_font_montserrat_22)
#endif
#if LV_FONT_MONTSERRAT_24
LV_FONT_DECLARE(lv_font_montserrat_24)
#endif
#if LV_FONT_MONTSERRAT_26
LV_FONT_DECLARE(lv_font_montserrat_26)
#endif
#if LV_FONT_MONTSERRAT_28
LV_FONT_DECLARE(lv_font_montserrat_28)
#endif
#if LV_FONT_MONTSERRAT_30
LV_FONT_DECLARE(lv_font_montserrat_30)
#endif
#if LV_FONT_MONTSERRAT_32
LV_FONT_DECLARE(lv_font_montserrat_32)
#endif
#if LV_FONT_MONTSERRAT_34
LV_FONT_DECLARE(lv_font_montserrat_34)
#endif
#if LV_FONT_MONTSERRAT_36
LV_FONT_DECLARE(lv_font_montserrat_36)
#endif
#if LV_FONT_MONTSERRAT_38
LV_FONT_DECLARE(lv_font_montserrat_38)
#endif
#if LV_FONT_MONTSERRAT_40
LV_FONT_DECLARE(lv_font_montserrat_40)
#endif
#if LV_FONT_MONTSERRAT_42
LV_FONT_DECLARE(lv_font_montserrat_42)
#endif
#if LV_FONT_MONTSERRAT_44
LV_FONT_DECLARE(lv_font_montserrat_44)
#endif
#if LV_FONT_MONTSERRAT_46
LV_FONT_DECLARE(lv_font_montserrat_46)
#endif
#if LV_FONT_MONTSERRAT_48
LV_FONT_DECLARE(lv_font_montserrat_48)
#endif
#if LV_FONT_MONTSERRAT_28_COMPRESSED
LV_FONT_DECLARE(lv_font_montserrat_28_compressed)
#endif
#if LV_FONT_MONTSERRAT_12_SUBPX
LV_FONT_DECLARE(lv_font_montserrat_12_subpx)
#endif
#if LV_FONT_UNSCII_8
LV_FONT_DECLARE(lv_font_unscii_8)
#endif
#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW
LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew)
#endif
#if LV_FONT_SIMSUN_16_CJK
LV_FONT_DECLARE(lv_font_simsun_16_cjk)
#endif
/*Declare the custom (user defined) fonts*/
#ifdef LV_FONT_CUSTOM_DECLARE
LV_FONT_CUSTOM_DECLARE

View File

@@ -1,11 +1,30 @@
CSRCS += lv_font.c
CSRCS += lv_font_fmt_txt.c
CSRCS += lv_font_roboto_12.c
CSRCS += lv_font_roboto_16.c
CSRCS += lv_font_roboto_22.c
CSRCS += lv_font_roboto_28.c
CSRCS += lv_font_montserrat_12.c
CSRCS += lv_font_montserrat_14.c
CSRCS += lv_font_montserrat_16.c
CSRCS += lv_font_montserrat_18.c
CSRCS += lv_font_montserrat_20.c
CSRCS += lv_font_montserrat_22.c
CSRCS += lv_font_montserrat_24.c
CSRCS += lv_font_montserrat_26.c
CSRCS += lv_font_montserrat_28.c
CSRCS += lv_font_montserrat_30.c
CSRCS += lv_font_montserrat_32.c
CSRCS += lv_font_montserrat_34.c
CSRCS += lv_font_montserrat_36.c
CSRCS += lv_font_montserrat_38.c
CSRCS += lv_font_montserrat_40.c
CSRCS += lv_font_montserrat_42.c
CSRCS += lv_font_montserrat_44.c
CSRCS += lv_font_montserrat_46.c
CSRCS += lv_font_montserrat_48.c
CSRCS += lv_font_montserrat_12_subpx.c
CSRCS += lv_font_montserrat_28_compressed.c
CSRCS += lv_font_unscii_8.c
CSRCS += lv_font_dejavu_16_persian_hebrew.c
DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_font
VPATH += :$(LVGL_DIR)/lvgl/src/lv_font
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_font"
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font"

File diff suppressed because it is too large Load Diff

View File

@@ -6,11 +6,14 @@
/*********************
* INCLUDES
*********************/
#include "lv_font.h"
#include "lv_font_fmt_txt.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_log.h"
#include "../lv_misc/lv_utils.h"
#include "../lv_misc/lv_mem.h"
/*********************
* DEFINES
@@ -19,6 +22,11 @@
/**********************
* TYPEDEFS
**********************/
typedef enum {
RLE_STATE_SINGLE = 0,
RLE_STATE_REPEATE,
RLE_STATE_COUNTER,
} rle_state_t;
/**********************
* STATIC PROTOTYPES
@@ -29,9 +37,23 @@ static int32_t unicode_list_compare(const void * ref, const void * element);
static int32_t kern_pair_8_compare(const void * ref, const void * element);
static int32_t kern_pair_16_compare(const void * ref, const void * element);
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter);
static inline void decompress_line(uint8_t * out, lv_coord_t w);
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len);
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len);
static inline void rle_init(const uint8_t * in, uint8_t bpp);
static inline uint8_t rle_next(void);
/**********************
* STATIC VARIABLES
**********************/
static uint8_t * decompr_buf;
static uint32_t rle_rdp;
static const uint8_t * rle_in;
static uint8_t rle_bpp;
static uint8_t rle_prev_v;
static uint8_t rle_cnt;
static rle_state_t rle_state;
/**********************
* GLOBAL PROTOTYPES
@@ -53,13 +75,54 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element);
*/
const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unicode_letter)
{
if(unicode_letter == '\t') unicode_letter = ' ';
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
if(!gid) return false;
if(!gid) return NULL;
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
if(gdsc) return &fdsc->glyph_bitmap[gdsc->bitmap_index];
if(fdsc->bitmap_format == LV_FONT_FMT_TXT_PLAIN) {
if(gdsc) return &fdsc->glyph_bitmap[gdsc->bitmap_index];
}
/*Handle compressed bitmap*/
else {
#if LV_USE_FONT_COMPRESSED
uint32_t gsize = gdsc->box_w * gdsc->box_h;
if(gsize == 0) return NULL;
uint32_t buf_size = gsize;
/*Compute memory size needed to hold decompressed glyph, rounding up*/
switch(fdsc->bpp) {
case 1:
buf_size = (gsize + 7) >> 3;
break;
case 2:
buf_size = (gsize + 3) >> 2;
break;
case 3:
buf_size = (gsize + 1) >> 1;
break;
case 4:
buf_size = (gsize + 1) >> 1;
break;
}
if(_lv_mem_get_size(decompr_buf) < buf_size) {
decompr_buf = lv_mem_realloc(decompr_buf, buf_size);
LV_ASSERT_MEM(decompr_buf);
if(decompr_buf == NULL) return NULL;
}
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp,
prefilter);
return decompr_buf;
#else /* !LV_USE_FONT_COMPRESSED */
return NULL;
#endif
}
/*If not returned earlier then the letter is not found in this font*/
return NULL;
@@ -73,8 +136,14 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter,
uint32_t unicode_letter_next)
{
bool is_tab = false;
if(unicode_letter == '\t') {
unicode_letter = ' ';
is_tab = true;
}
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
if(!gid) return false;
@@ -90,7 +159,12 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
/*Put together a glyph dsc*/
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
uint32_t adv_w = gdsc->adv_w + ((int32_t)((int32_t)kvalue * fdsc->kern_scale) >> 4);
int32_t kv = ((int32_t)((int32_t)kvalue * fdsc->kern_scale) >> 4);
uint32_t adv_w = gdsc->adv_w;
if(is_tab) adv_w *= 2;
adv_w += kv;
adv_w = (adv_w + (1 << 3)) >> 4;
dsc_out->adv_w = adv_w;
@@ -98,11 +172,25 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
dsc_out->box_w = gdsc->box_w;
dsc_out->ofs_x = gdsc->ofs_x;
dsc_out->ofs_y = gdsc->ofs_y;
dsc_out->bpp = fdsc->bpp;
dsc_out->bpp = (uint8_t)fdsc->bpp;
if(is_tab) dsc_out->box_w = dsc_out->box_w * 2;
return true;
}
/**
* Free the allocated memories.
*/
void _lv_font_clean_up_fmt_txt(void)
{
if(decompr_buf) {
lv_mem_free(decompr_buf);
decompr_buf = NULL;
}
}
/**********************
* STATIC FUNCTIONS
**********************/
@@ -113,7 +201,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
/*Check the chacge first*/
/*Check the cache first*/
if(letter == fdsc->last_letter) return fdsc->last_glyph_id;
uint16_t i;
@@ -131,19 +219,23 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
uint32_t ofs = (uintptr_t)p - (uintptr_t) fdsc->cmaps[i].unicode_list;
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
glyph_id = fdsc->cmaps[i].glyph_id_start + ofs;
}
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
uint32_t ofs = (uintptr_t)p - (uintptr_t) fdsc->cmaps[i].unicode_list;
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
@@ -176,41 +268,44 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
* The pairs are ordered left_id first, then right_id secondly. */
const uint8_t * g_ids = kdsc->glyph_ids;
uint16_t g_id_both = (gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
uintptr_t ofs = (uintptr_t)kid_p - (uintptr_t)g_ids;
lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - g_ids);
ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/
value = kdsc->values[ofs];
}
} else if(kdsc->glyph_ids_size == 1) {
}
else if(kdsc->glyph_ids_size == 1) {
/* Use binary search to find the kern value.
* The pairs are ordered left_id first, then right_id secondly. */
const uint16_t * g_ids = kdsc->glyph_ids;
uint32_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
uintptr_t ofs = (uintptr_t)kid_p - (uintptr_t)g_ids;
lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - (const uint8_t *)g_ids);
ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/
value = kdsc->values[ofs];
}
} else {
}
else {
/*Invalid value*/
}
} else {
}
else {
/*Kern classes*/
const lv_font_fmt_txt_kern_classes_t * kdsc = fdsc->kern_dsc;
uint8_t left_class = kdsc->left_class_mapping[gid_left];
uint8_t right_class = kdsc->left_class_mapping[gid_right];
uint8_t right_class = kdsc->right_class_mapping[gid_right];
/* If class = 0, kerning not exist for that glyph
* else got the value form `class_pair_values` 2D array*/
if(left_class > 0 && right_class > 0) {
value = kdsc->class_pair_values[(left_class-1)* kdsc->right_class_cnt + (right_class-1)];
value = kdsc->class_pair_values[(left_class - 1) * kdsc->right_class_cnt + (right_class - 1)];
}
}
@@ -238,6 +333,236 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element)
else return (int32_t) ref16_p[1] - element16_p[1];
}
/**
* The compress a glyph's bitmap
* @param in the compressed bitmap
* @param out buffer to store the result
* @param px_num number of pixels in the glyph (width * height)
* @param bpp bit per pixel (bpp = 3 will be converted to bpp = 4)
* @param prefilter true: the lines are XORed
*/
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter)
{
uint32_t wrp = 0;
uint8_t wr_size = bpp;
if(bpp == 3) wr_size = 4;
rle_init(in, bpp);
uint8_t * line_buf1 = _lv_mem_buf_get(w);
uint8_t * line_buf2 = NULL;
if(prefilter) {
line_buf2 = _lv_mem_buf_get(w);
}
decompress_line(line_buf1, w);
lv_coord_t y;
lv_coord_t x;
for(x = 0; x < w; x++) {
bits_write(out, wrp, line_buf1[x], bpp);
wrp += wr_size;
}
for(y = 1; y < h; y++) {
if(prefilter) {
decompress_line(line_buf2, w);
for(x = 0; x < w; x++) {
line_buf1[x] = line_buf2[x] ^ line_buf1[x];
bits_write(out, wrp, line_buf1[x], bpp);
wrp += wr_size;
}
}
else {
decompress_line(line_buf1, w);
for(x = 0; x < w; x++) {
bits_write(out, wrp, line_buf1[x], bpp);
wrp += wr_size;
}
}
}
_lv_mem_buf_release(line_buf1);
_lv_mem_buf_release(line_buf2);
}
/**
* Decompress one line. Store one pixel per byte
* @param out output buffer
* @param w width of the line in pixel count
*/
static inline void decompress_line(uint8_t * out, lv_coord_t w)
{
lv_coord_t i;
for(i = 0; i < w; i++) {
out[i] = rle_next();
}
}
/**
* Read bits from an input buffer. The read can cross byte boundary.
* @param in the input buffer to read from.
* @param bit_pos index of the first bit to read.
* @param len number of bits to read (must be <= 8).
* @return the read bits
*/
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len)
{
uint8_t bit_mask;
switch(len) {
case 1:
bit_mask = 0x1;
break;
case 2:
bit_mask = 0x3;
break;
case 3:
bit_mask = 0x7;
break;
case 4:
bit_mask = 0xF;
break;
case 8:
bit_mask = 0xFF;
break;
default:
bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
}
uint32_t byte_pos = bit_pos >> 3;
bit_pos = bit_pos & 0x7;
if(bit_pos + len >= 8) {
uint16_t in16 = (in[byte_pos] << 8) + in[byte_pos + 1];
return (in16 >> (16 - bit_pos - len)) & bit_mask;
}
else {
return (in[byte_pos] >> (8 - bit_pos - len)) & bit_mask;
}
}
/**
* Write `val` data to `bit_pos` position of `out`. The write can NOT cross byte boundary.
* @param out buffer where to write
* @param bit_pos bit index to write
* @param val value to write
* @param len length of bits to write from `val`. (Counted from the LSB).
* @note `len == 3` will be converted to `len = 4` and `val` will be upscaled too
*/
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len)
{
if(len == 3) {
len = 4;
switch(val) {
case 0:
val = 0;
break;
case 1:
val = 2;
break;
case 2:
val = 4;
break;
case 3:
val = 6;
break;
case 4:
val = 9;
break;
case 5:
val = 11;
break;
case 6:
val = 13;
break;
case 7:
val = 15;
break;
}
}
uint16_t byte_pos = bit_pos >> 3;
bit_pos = bit_pos & 0x7;
bit_pos = 8 - bit_pos - len;
uint8_t bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
out[byte_pos] &= ((~bit_mask) << bit_pos);
out[byte_pos] |= (val << bit_pos);
}
static inline void rle_init(const uint8_t * in, uint8_t bpp)
{
rle_in = in;
rle_bpp = bpp;
rle_state = RLE_STATE_SINGLE;
rle_rdp = 0;
rle_prev_v = 0;
rle_cnt = 0;
}
static inline uint8_t rle_next(void)
{
uint8_t v = 0;
uint8_t ret = 0;
if(rle_state == RLE_STATE_SINGLE) {
ret = get_bits(rle_in, rle_rdp, rle_bpp);
if(rle_rdp != 0 && rle_prev_v == ret) {
rle_cnt = 0;
rle_state = RLE_STATE_REPEATE;
}
rle_prev_v = ret;
rle_rdp += rle_bpp;
}
else if(rle_state == RLE_STATE_REPEATE) {
v = get_bits(rle_in, rle_rdp, 1);
rle_cnt++;
rle_rdp += 1;
if(v == 1) {
ret = rle_prev_v;
if(rle_cnt == 11) {
rle_cnt = get_bits(rle_in, rle_rdp, 6);
rle_rdp += 6;
if(rle_cnt != 0) {
rle_state = RLE_STATE_COUNTER;
}
else {
ret = get_bits(rle_in, rle_rdp, rle_bpp);
rle_prev_v = ret;
rle_rdp += rle_bpp;
rle_state = RLE_STATE_SINGLE;
}
}
}
else {
ret = get_bits(rle_in, rle_rdp, rle_bpp);
rle_prev_v = ret;
rle_rdp += rle_bpp;
rle_state = RLE_STATE_SINGLE;
}
}
else if(rle_state == RLE_STATE_COUNTER) {
ret = rle_prev_v;
rle_cnt--;
if(rle_cnt == 0) {
ret = get_bits(rle_in, rle_rdp, rle_bpp);
rle_prev_v = ret;
rle_rdp += rle_bpp;
rle_state = RLE_STATE_SINGLE;
}
}
return ret;
}
/** Code Comparator.
*
* Compares the value of both input arguments.
@@ -253,5 +578,5 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element)
*/
static int32_t unicode_list_compare(const void * ref, const void * element)
{
return (*(uint16_t *)ref) - (*(uint16_t *)element);
return ((int32_t)(*(uint16_t *)ref)) - ((int32_t)(*(uint16_t *)element));
}

View File

@@ -13,12 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../../lv_conf.h"
#endif
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
@@ -33,30 +27,39 @@ extern "C" {
**********************/
/** This describes a glyph. */
typedef struct
{
typedef struct {
#if LV_FONT_FMT_TXT_LARGE == 0
uint32_t bitmap_index : 20; /**< Start index of the bitmap. A font can be max 1 MB. */
uint32_t adv_w :12; /**< Draw the next glyph after this width. 12.4 format (real_value * 16 is stored). */
uint32_t adv_w : 12; /**< Draw the next glyph after this width. 8.4 format (real_value * 16 is stored). */
uint8_t box_w; /**< Width of the glyph's bounding box*/
uint8_t box_h; /**< Height of the glyph's bounding box*/
int8_t ofs_x; /**< x offset of the bounding box*/
uint8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
}lv_font_fmt_txt_glyph_dsc_t;
int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#else
uint32_t bitmap_index; /**< Start index of the bitmap. A font can be max 4 GB. */
uint32_t adv_w; /**< Draw the next glyph after this width. 28.4 format (real_value * 16 is stored). */
uint16_t box_w; /**< Width of the glyph's bounding box*/
uint16_t box_h; /**< Height of the glyph's bounding box*/
int16_t ofs_x; /**< x offset of the bounding box*/
int16_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#endif
} lv_font_fmt_txt_glyph_dsc_t;
/** Format of font character map. */
typedef enum {
enum {
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL,
LV_FONT_FMT_TXT_CMAP_SPARSE_TINY,
LV_FONT_FMT_TXT_CMAP_SPARSE_FULL,
}lv_font_fmt_txt_cmap_type_t;
};
typedef uint8_t lv_font_fmt_txt_cmap_type_t;
/* Map codepoints to a `glyph_dsc`s
* Several formats are supported to optimize memory usage
* See https://github.com/littlevgl/lv_font_conv/blob/master/doc/font_spec.md
* See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
*/
typedef struct {
/** First Unicode character for this range */
@@ -71,7 +74,7 @@ typedef struct {
/*
According the specification there are 4 formats:
https://github.com/littlevgl/lv_font_conv/blob/master/doc/font_spec.md
https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
For simplicity introduce "relative code point":
rcp = codepoint - range_start
@@ -96,7 +99,7 @@ typedef struct {
glyph_id = glyph_id_start + glyph_id_ofs_list[search(unicode_list, rcp)]
*/
uint16_t * unicode_list;
const uint16_t * unicode_list;
/** if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's `uint8_t *`
* if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's `uint16_t *`
@@ -107,8 +110,8 @@ typedef struct {
uint16_t list_length;
/** Type of this character map*/
lv_font_fmt_txt_cmap_type_t type :2;
}lv_font_fmt_txt_cmap_t;
lv_font_fmt_txt_cmap_type_t type;
} lv_font_fmt_txt_cmap_t;
/** A simple mapping of kern values from pairs*/
typedef struct {
@@ -121,9 +124,9 @@ typedef struct {
*/
const void * glyph_ids;
const int8_t * values;
uint32_t pair_cnt :24;
uint32_t glyph_ids_size :2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/
}lv_font_fmt_txt_kern_pair_t;
uint32_t pair_cnt : 24;
uint32_t glyph_ids_size : 2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/
} lv_font_fmt_txt_kern_pair_t;
/** More complex but more optimal class based kern value storage*/
typedef struct {
@@ -132,27 +135,28 @@ typedef struct {
2 Get the class of the left and right glyphs as `left_class` and `right_class`
left_class = left_class_mapping[glyph_id_left];
right_class = right_class_mapping[glyph_id_right];
3. value = class_pair_values[(left_class-1)*right_class_cnt + (righ_class-1)]
3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)]
*/
const uint8_t * class_pair_values; /*left_class_num * right_class_num value*/
const int8_t * class_pair_values; /*left_class_num * right_class_num value*/
const uint8_t * left_class_mapping; /*Map the glyph_ids to classes: index -> glyph_id -> class_id*/
const uint8_t * right_class_mapping; /*Map the glyph_ids to classes: index -> glyph_id -> class_id*/
uint8_t left_class_cnt;
uint8_t right_class_cnt;
}lv_font_fmt_txt_kern_classes_t;
} lv_font_fmt_txt_kern_classes_t;
/** Bitmap formats*/
typedef enum {
LV_FONT_FMT_TXT_PLAIN = 0,
LV_FONT_FMT_TXT_COMPRESSED = 1,
}lv_font_fmt_txt_bitmap_format_t;
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 1,
} lv_font_fmt_txt_bitmap_format_t;
/*Describe store additional data for fonts */
typedef struct {
/*The bitmaps os all glyphs*/
/*The bitmaps of all glyphs*/
const uint8_t * glyph_bitmap;
/*Describe the glyphs*/
@@ -172,25 +176,25 @@ typedef struct {
uint16_t kern_scale;
/*Number of cmap tables*/
uint16_t cmap_num :10;
uint16_t cmap_num : 10;
/*Bit per pixel: 1, 2, 4 or 8*/
uint16_t bpp :3;
/*Bit per pixel: 1, 2, 3, 4, 8*/
uint16_t bpp : 4;
/*Type of `kern_dsc`*/
uint16_t kern_classes :1;
uint16_t kern_classes : 1;
/*
* storage format of the bitmap
* from `lv_font_fmt_txt_bitmap_format_t`
*/
uint16_t bitmap_format :2;
uint16_t bitmap_format : 2;
/*Cache the last letter and is glyph id*/
uint32_t last_letter;
uint32_t last_glyph_id;
}lv_font_fmt_txt_dsc_t;
} lv_font_fmt_txt_dsc_t;
/**********************
* GLOBAL PROTOTYPES
@@ -212,7 +216,13 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t lett
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next);
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter,
uint32_t unicode_letter_next);
/**
* Free the allocated memories.
*/
void _lv_font_clean_up_fmt_txt(void);
/**********************
* MACROS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More