Microchip SAMA5D27上运行LVGL V7.02
LVGL简介
LVGL - 轻量级通用图形库.
- 强大的构件-按钮、图表、列表、滑块、图像等。
- 先进的图形-支持动画,抗锯齿,不透明度,平滑滚动。
- 同时支持各种输入设备,如触摸屏、鼠标、键盘、编码器、按钮等。
- 同时使用多种显示设备,即单色和彩色显示器。
- 支持UTF-8编码的多语言,双向支持和阿拉伯语文本处理。
- 完全可定制的图形元素
- 硬件独立,可与任何微控制器或显示器一起使用。
- 可扩展到以较少的内存进行操作(64 kB闪存,10 kB RAM)。
- 支持操作系统、外置内存和GPU,但不是必需的。
- 即使是先进的图形效果,也可以进行单帧缓冲操作。
- 用C语言编写,以达到最大的兼容性(兼容C++)。
- Micropython Binding在Micropython中公开LVGL API
- 无需嵌入式硬件就能在PC上开发的模拟器
- 提供教程、例子、主题帮助快速完成开发
- 提供参考的说明文档和API文档
LVGL V7.0新版本特性
抢先看LVGL V7.0带来了哪些新的特性:
新的绘图系统
- 完全重构LVGL的绘制引擎,使用 "mask"来实现更高级、更高质量的图形效果。
- 新系统的新引入的一个功能是可以去除圆角边缘的溢出内容。
- 它还允许绘制完美的反锯齿圆、线和弧。
- 在内部绘图是通过定义mask(如圆角矩形、线条、角度)来实现的。
当绘制一些东西时,当前活动的遮罩可以使一些像素透明。(作者补充-开源2D矢量图型引擎Cairo里面也有用到mask概念)
例如,矩形边框是通过使用2个矩形遮罩来绘制的:一个遮罩去除内部部分,另一个遮罩去除外部部分。
新的系统风格
- 用一种更灵活, 轻量级的系统取代旧的系统。
- 使用了一种类似于CSS的方法:支持层叠样式,继承属性和每个对象的本地属性。
- 作为这些更新的一部分,很多对象被重新设计,API也被改变。
GPU加速
- 为了更好地利用GPU,从这个版本开始,GPU的使用可以整合到LVGL中。在lv_conf.h中,任何支持的GPU都可以通过一个配置选项来启用。
- 目前只支持ST’s DMA2D (Chrom-ART) , 更多GPU的支持会在后续版本中加入进来.
命名的改进
以下对象类型进行了重命名:
- 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
重新设计和改进的对象
- 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
LVGL V7.0.2初体验
话不多说,直接上图看官方例程效果图。
LVGL在Microchip SAMA5D27运行效果
LVGL V7.02移植到SAMA5D27+7"LCD屏(分辨率是800*480), 核心处理器是ARM Cortex-A5架构,主频500MHz带NEON,用来跑LVGL足够.
LVGL不足之处
- 目前没有针对NEON进行优化
- 屏幕切换的时候不够自然,能够见到抖动(已经开了双frame buffer)
- 不支持直接贴图显示