「App:Library:LVGL:docs:Overview:Displays」の版間の差分
2行目: | 2行目: | ||
__NOTOC__ | __NOTOC__ | ||
= Displays = | = Displays = | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Important | Important | ||
The basic concept of a ''display'' in LVGL is explained in the [Porting](/porting/display) section. So before reading further, please read the [Porting](/porting/display) section first. | The basic concept of a ''display'' in LVGL is explained in the [Porting](/porting/display) section. So before reading further, please read the [Porting](/porting/display) section first. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
== Multiple display support == | == Multiple display support == | ||
− | In LVGL you can have multiple displays, each with their own driver and objects. The only limitation is that every display needs to have the same color depth (as defined in <code>LV_COLOR_DEPTH</code>). If the displays are different in this regard the rendered image can be converted to the correct format in the drivers <code>flush_cb</code>. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | In LVGL you can have multiple displays, each with their own driver and objects. The only limitation is that every display needs to have the same color depth (as defined in <code style="color: #bb0000;">LV_COLOR_DEPTH</code>). If the displays are different in this regard the rendered image can be converted to the correct format in the drivers <code style="color: #bb0000;">flush_cb</code>. | ||
− | Creating more displays is easy: just initialize more display buffers and register another driver for every display. When you create the UI, use <code>lv_disp_set_default(disp)</code> to tell the library on which display to create objects. | + | Creating more displays is easy: just initialize more display buffers and register another driver for every display. When you create the UI, use <code style="color: #bb0000;">lv_disp_set_default(disp)</code> to tell the library on which display to create objects. |
Why would you want multi-display support? Here are some examples: | Why would you want multi-display support? Here are some examples: | ||
17行目: | 31行目: | ||
* Have some smaller and simple displays in a large instrument or technology. | * Have some smaller and simple displays in a large instrument or technology. | ||
* Have two large TFT displays: one for a customer and one for the shop assistant. | * Have two large TFT displays: one for a customer and one for the shop assistant. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
=== Using only one display === | === Using only one display === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Using more displays can be useful but in most cases it's not required. Therefore, the whole concept of multi-display handling is completely hidden if you register only one display. By default, the last created (and only) display is used. | Using more displays can be useful but in most cases it's not required. Therefore, the whole concept of multi-display handling is completely hidden if you register only one display. By default, the last created (and only) display is used. | ||
− | <code>lv_scr_act()</code>, <code>lv_scr_load(scr)</code>, <code>lv_layer_top()</code>, <code>lv_layer_sys()</code>, <code>LV_HOR_RES</code> and <code>LV_VER_RES</code> are always applied on the most recently created (default) display. If you pass <code>NULL</code> as <code>disp</code> parameter to display related functions the default display will usually be used. E.g. <code>lv_disp_trig_activity(NULL)</code> will trigger a user activity on the default display. (See below in Inactivity). | + | <code style="color: #bb0000;">lv_scr_act()</code>, <code style="color: #bb0000;">lv_scr_load(scr)</code>, <code style="color: #bb0000;">lv_layer_top()</code>, <code style="color: #bb0000;">lv_layer_sys()</code>, <code style="color: #bb0000;">LV_HOR_RES</code> and <code style="color: #bb0000;">LV_VER_RES</code> are always applied on the most recently created (default) display. If you pass <code style="color: #bb0000;">NULL</code> as <code style="color: #bb0000;">disp</code> parameter to display related functions the default display will usually be used. E.g. <code style="color: #bb0000;">lv_disp_trig_activity(NULL)</code> will trigger a user activity on the default display. (See below in Inactivity). |
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
=== Mirror display === | === Mirror display === | ||
− | To mirror the image of a display to another display, you don't need to use multi-display support. Just transfer the buffer received in <code>drv.flush_cb</code> to the other display too. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | To mirror the image of a display to another display, you don't need to use multi-display support. Just transfer the buffer received in <code style="color: #bb0000;">drv.flush_cb</code> to the other display too. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
=== Split image === | === Split image === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
You can create a larger virtual display from an array of smaller ones. You can create it as below: | You can create a larger virtual display from an array of smaller ones. You can create it as below: | ||
# Set the resolution of the displays to the large display's resolution. | # Set the resolution of the displays to the large display's resolution. | ||
− | # In <code>drv.flush_cb</code>, truncate and modify the <code>area</code> parameter for each display. | + | # In <code style="color: #bb0000;">drv.flush_cb</code>, truncate and modify the <code style="color: #bb0000;">area</code> parameter for each display. |
# Send the buffer's content to each real display with the truncated area. | # Send the buffer's content to each real display with the truncated area. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
== Screens == | == Screens == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Every display has its own set of screens and the objects on each screen. | Every display has its own set of screens and the objects on each screen. | ||
41行目: | 91行目: | ||
* Screens are the high-level root objects associated with a particular display. One display can have multiple screens associated with it, but not vice versa. | * Screens are the high-level root objects associated with a particular display. One display can have multiple screens associated with it, but not vice versa. | ||
− | Screens can be considered the highest level containers which have no parent. A screen's size is always equal to its display and their origin is (0;0). Therefore, a screen's coordinates can't be changed, i.e. <code>lv_obj_set_pos()</code>, <code>lv_obj_set_size()</code> or similar functions can't be used on screens. | + | Screens can be considered the highest level containers which have no parent. A screen's size is always equal to its display and their origin is (0;0). Therefore, a screen's coordinates can't be changed, i.e. <code style="color: #bb0000;">lv_obj_set_pos()</code>, <code style="color: #bb0000;">lv_obj_set_size()</code> or similar functions can't be used on screens. |
A screen can be created from any object type but the two most typical types are Base object and Image (to create a wallpaper). | A screen can be created from any object type but the two most typical types are Base object and Image (to create a wallpaper). | ||
− | To create a screen, use <code>lv_obj_t * scr = lv_<type>_create(NULL, copy)</code>. <code>copy</code> can be an existing screen copied into the new screen. | + | To create a screen, use <code style="color: #bb0000;">lv_obj_t * scr = lv_<type>_create(NULL, copy)</code>. <code style="color: #bb0000;">copy</code> can be an existing screen copied into the new screen. |
+ | |||
+ | To load a screen, use <code style="color: #bb0000;">lv_scr_load(scr)</code>. To get the active screen, use <code style="color: #bb0000;">lv_scr_act()</code>. These functions work on the default display. If you want to specify which display to work on, use <code style="color: #bb0000;">lv_disp_get_scr_act(disp)</code> and <code style="color: #bb0000;">lv_disp_load_scr(disp, scr)</code>. A screen can be loaded with animations too. Read more here. | ||
− | + | Screens can be deleted with <code style="color: #bb0000;">lv_obj_del(scr)</code>, but ensure that you do not delete the currently loaded screen. | |
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
− | |||
=== Transparent screens === | === Transparent screens === | ||
− | Usually, the opacity of the screen is <code>LV_OPA_COVER</code> to provide a solid background for its children. If this is not the case (opacity < 100%) the display's background color or image will be visible. See the Display background section for more details. If the display's background opacity is also not <code>LV_OPA_COVER</code> LVGL has no solid background to draw. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | Usually, the opacity of the screen is <code style="color: #bb0000;">LV_OPA_COVER</code> to provide a solid background for its children. If this is not the case (opacity < 100%) the display's background color or image will be visible. See the Display background section for more details. If the display's background opacity is also not <code style="color: #bb0000;">LV_OPA_COVER</code> LVGL has no solid background to draw. | ||
This configuration (transparent screen and display) could be used to create for example OSD menus where a video is played on a lower layer, and a menu is overlayed on an upper layer. | This configuration (transparent screen and display) could be used to create for example OSD menus where a video is played on a lower layer, and a menu is overlayed on an upper layer. | ||
− | To handle transparent displays, special (slower) color mixing algorithms need to be used by LVGL so this feature needs to enabled with <code>LV_COLOR_SCREEN_TRANSP</code> in <code>lv_conf.h</code>. As this mode operates on the Alpha channel of the pixels <code>LV_COLOR_DEPTH = 32</code> is also required. The Alpha channel of 32-bit colors will be 0 where there are no objects and 255 where there are solid objects. | + | To handle transparent displays, special (slower) color mixing algorithms need to be used by LVGL so this feature needs to enabled with <code style="color: #bb0000;">LV_COLOR_SCREEN_TRANSP</code> in <code style="color: #bb0000;">lv_conf.h</code>. As this mode operates on the Alpha channel of the pixels <code style="color: #bb0000;">LV_COLOR_DEPTH = 32</code> is also required. The Alpha channel of 32-bit colors will be 0 where there are no objects and 255 where there are solid objects. |
In summary, to enable transparent screens and displays for OSD menu-like UIs: | In summary, to enable transparent screens and displays for OSD menu-like UIs: | ||
− | * Enable <code>LV_COLOR_SCREEN_TRANSP</code> in <code>lv_conf.h</code> | + | * Enable <code style="color: #bb0000;">LV_COLOR_SCREEN_TRANSP</code> in <code style="color: #bb0000;">lv_conf.h</code> |
− | * Be sure to use <code>LV_COLOR_DEPTH 32</code> | + | * Be sure to use <code style="color: #bb0000;">LV_COLOR_DEPTH 32</code> |
− | * Set the screen's opacity to <code>LV_OPA_TRANSP</code> e.g. with <code>lv_obj_set_style_local_bg_opa(lv_scr_act(), LV_OBJMASK_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP)</code> | + | * Set the screen's opacity to <code style="color: #bb0000;">LV_OPA_TRANSP</code> e.g. with <code style="color: #bb0000;">lv_obj_set_style_local_bg_opa(lv_scr_act(), LV_OBJMASK_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP)</code> |
− | * Set the display opacity to <code>LV_OPA_TRANSP</code> with <code>lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);</code> | + | * Set the display opacity to <code style="color: #bb0000;">LV_OPA_TRANSP</code> with <code style="color: #bb0000;">lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);</code> |
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
+ | |||
== Features of displays == | == Features of displays == | ||
+ | === Inactivity === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | A user's inactivity time is measured on each display. Every use of an Input device (if associated with the display) counts as an activity. To get time elapsed since the last activity, use <code style="color: #bb0000;">lv_disp_get_inactive_time(disp)</code>. If <code style="color: #bb0000;">NULL</code> is passed, the lowest inactivity time among all displays will be returned (NULL isn't just the default display). | ||
− | + | You can manually trigger an activity using <code style="color: #bb0000;">lv_disp_trig_activity(disp)</code>. If <code style="color: #bb0000;">disp</code> is <code style="color: #bb0000;">NULL</code>, the default screen will be used (and not all displays). | |
− | + | | | |
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
− | |||
=== Background === | === Background === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Every display has a background color, background image and background opacity properties. They become visible when the current screen is transparent or not positioned to cover the whole display. | Every display has a background color, background image and background opacity properties. They become visible when the current screen is transparent or not positioned to cover the whole display. | ||
− | The background color is a simple color to fill the display. It can be adjusted with <code>lv_disp_set_bg_color(disp, color)</code>; | + | The background color is a simple color to fill the display. It can be adjusted with <code style="color: #bb0000;">lv_disp_set_bg_color(disp, color)</code>; |
− | The display background image is a path to a file or a pointer to an <code>lv_img_dsc_t</code> variable (converted image data) to be used as wallpaper. It can be set with <code>lv_disp_set_bg_image(disp, &my_img)</code>; If a background image is configured the background won't be filled with <code>bg_color</code>. | + | The display background image is a path to a file or a pointer to an <code style="color: #bb0000;">lv_img_dsc_t</code> variable (converted image data) to be used as wallpaper. It can be set with <code style="color: #bb0000;">lv_disp_set_bg_image(disp, &my_img)</code>; If a background image is configured the background won't be filled with <code style="color: #bb0000;">bg_color</code>. |
− | The opacity of the background color or image can be adjusted with <code>lv_disp_set_bg_opa(disp, opa)</code>. | + | The opacity of the background color or image can be adjusted with <code style="color: #bb0000;">lv_disp_set_bg_opa(disp, opa)</code>. |
+ | |||
+ | The <code style="color: #bb0000;">disp</code> parameter of these functions can be <code style="color: #bb0000;">NULL</code> to select the default display. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | ||
− | |||
== API == | == API == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Enums | Enums | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">enum lv_scr_load_anim_t </span> | |
: ''Values:'' | : ''Values:'' | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_NONE </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_OVER_LEFT </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_OVER_RIGHT </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_OVER_TOP </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_OVER_BOTTOM </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_MOVE_LEFT </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_MOVE_RIGHT </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_MOVE_TOP </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_MOVE_BOTTOM </span> |
:: | :: | ||
− | : | + | : <span style="background-color: #eeeeee;">enumerator LV_SCR_LOAD_ANIM_FADE_ON </span> |
:: | :: | ||
− | Functions | + | '''Functions''' |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">lv_obj_t *lv_disp_get_scr_act(lv_disp_t *disp) </span> | |
− | : Return with a pointer to the active screen | + | : Return with a pointer to the active screen |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to display which active screen should be get. (NULL to use the default screen) | + | :: '''disp''' -- pointer to display which active screen should be get. (NULL to use the default screen) |
− | : | + | : '''Returns''' |
:: pointer to the active screen object (loaded by 'lv_scr_load()') | :: pointer to the active screen object (loaded by 'lv_scr_load()') | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">lv_obj_t *lv_disp_get_scr_prev(lv_disp_t *disp) </span> | |
− | : Return with a pointer to the previous | + | : Return with a pointer to the previous screen. Only used during screen transitions. |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to display which previous screen should be get. (NULL to use the default screen) | + | :: '''disp''' -- pointer to display which previous screen should be get. (NULL to use the default screen) |
− | : | + | : '''Returns''' |
:: pointer to the previous screen object or NULL if not used now | :: pointer to the previous screen object or NULL if not used now | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_load_scr(lv_obj_t *scr) </span> | |
: Make a screen active | : Make a screen active | ||
− | : | + | : '''Parameters''' |
:: scr -- pointer to a screen | :: scr -- pointer to a screen | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">lv_obj_t *lv_disp_get_layer_top(lv_disp_t *disp) </span> | |
− | : Return with the top layer. (Same on every | + | : Return with the top layer. (Same on every screen and it is above the normal screen layer) |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to display which top layer should be get. (NULL to use the default screen) | + | :: '''disp''' -- pointer to display which top layer should be get. (NULL to use the default screen) |
− | : | + | : '''Returns''' |
:: pointer to the top layer object (transparent screen sized lv_obj) | :: pointer to the top layer object (transparent screen sized lv_obj) | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">lv_obj_t *lv_disp_get_layer_sys(lv_disp_t *disp) </span> | |
− | : Return with the sys. layer. (Same on every | + | : Return with the sys. layer. (Same on every screen and it is above the normal screen and the top layer) |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to display which sys. layer should be retrieved. (NULL to use the default screen) | + | :: '''disp''' -- pointer to display which sys. layer should be retrieved. (NULL to use the default screen) |
− | : | + | : '''Returns''' |
:: pointer to the sys layer object (transparent screen sized lv_obj) | :: pointer to the sys layer object (transparent screen sized lv_obj) | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_set_theme(lv_disp_t *disp, lv_theme_t *th) </span> | |
: Set the theme of a display | : Set the theme of a display | ||
− | : | + | : '''Parameters''' |
− | :: disp -- | + | :: '''disp''' -- pointer to a display |
− | + | lv_theme_t *lv_disp_get_theme(lv_disp_t *disp) | |
: Get the theme of a display | : Get the theme of a display | ||
− | : | + | : '''Parameters''' |
− | + | ||
− | :: disp -- pointer to a display | + | :: '''disp''' -- pointer to a display |
− | : | + | : '''Returns''' |
:: the display's theme (can be NULL) | :: the display's theme (can be NULL) | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_set_bg_color(lv_disp_t *disp, lv_color_t color) </span> | |
: Set the background color of a display | : Set the background color of a display | ||
− | : | + | : '''Parameters''' |
− | ::* | + | ::* '''disp''' -- pointer to a display |
− | ::* color -- color of the background | + | ::* '''color''' -- color of the background |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_set_bg_image(lv_disp_t *disp, const void *img_src) </span> | |
: Set the background image of a display | : Set the background image of a display | ||
− | : | + | : '''Parameters''' |
− | ::* | + | ::* '''disp''' -- pointer to a display |
− | ::* img_src -- path to file or pointer to an <code>lv_img_dsc_t</code> variable | + | ::* '''img_src''' -- path to file or pointer to an <code style="color: #bb0000;">lv_img_dsc_t</code> variable |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_set_bg_opa(lv_disp_t *disp, lv_opa_t opa) </span> | |
: Set opacity of the background | : Set opacity of the background | ||
− | : | + | : '''Parameters''' |
− | ::* | + | ::* '''disp''' -- pointer to a display |
− | ::* opa -- opacity (0..255) | + | ::* '''opa''' -- opacity (0..255) |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">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) </span> | |
: Switch screen with animation | : Switch screen with animation | ||
− | : | + | : '''Parameters''' |
− | ::* scr -- pointer to the new screen to load | + | ::* '''scr''' -- pointer to the new screen to load |
− | ::* anim_type -- | + | ::* '''anim_type''' -- type of the animation from <code style="color: #bb0000;">lv_scr_load_anim_t</code>. E.g. <code style="color: #bb0000;">LV_SCR_LOAD_ANIM_MOVE_LEFT</code> |
− | ::* time -- time of the animation | + | ::* '''time''' -- time of the animation |
− | ::* delay -- delay before the transition | + | ::* '''delay''' -- delay before the transition |
− | ::* auto_del -- true: automatically delete the old screen | + | ::* '''auto_del''' -- true: automatically delete the old screen |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp) </span> | |
− | : Get elapsed time since last user activity on a | + | : Get elapsed time since last user activity on a display (e.g. click) |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to a display (NULL to get the overall smallest inactivity) | + | :: '''disp''' -- pointer to a display (NULL to get the overall smallest inactivity) |
− | : | + | : '''Returns''' |
:: elapsed ticks (milliseconds) since the last activity | :: elapsed ticks (milliseconds) since the last activity | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_trig_activity(lv_disp_t *disp) </span> | |
− | : Manually trigger an activity on a | + | : Manually trigger an activity on a display |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to a display (NULL to use the default display) | + | :: '''disp''' -- pointer to a display (NULL to use the default display) |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">void lv_disp_clean_dcache(lv_disp_t *disp) </span> | |
− | : Clean any CPU cache that is related to | + | : Clean any CPU cache that is related to the display. |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to a display (NULL to use the default display) | + | :: '''disp''' -- pointer to a display (NULL to use the default display) |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">lv_timer_t *_lv_disp_get_refr_timer(lv_disp_t *disp) </span> | |
− | : Get a pointer to the screen refresher timer to | + | : Get a pointer to the screen refresher timer to modify its parameters with <code style="color: #bb0000;">lv_timer_...</code> functions. |
− | : | + | : '''Parameters''' |
− | :: disp -- pointer to a display | + | :: '''disp''' -- pointer to a display |
− | : | + | : '''Returns''' |
:: pointer to the display refresher timer. (NULL on error) | :: pointer to the display refresher timer. (NULL on error) | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">static inline lv_obj_t *lv_scr_act(void) </span> | |
− | : Get the active screen of the default | + | : Get the active screen of the default display |
− | : | + | : '''Returns''' |
:: pointer to the active screen | :: pointer to the active screen | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">static inline lv_obj_t *lv_layer_top(void) </span> | |
− | : Get the top layer of the default | + | : Get the top layer of the default display |
− | : | + | : '''Returns''' |
:: pointer to the top layer | :: pointer to the top layer | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">static inline lv_obj_t *lv_layer_sys(void) </span> | |
− | : Get the active screen of the default | + | : Get the active screen of the default display |
− | : | + | : '''Returns''' |
:: pointer to the sys layer | :: pointer to the sys layer | ||
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">static inline void lv_scr_load(lv_obj_t *scr) </span> | |
: | : | ||
− | + | static inline lv_coord_t lv_dpx(lv_coord_t n) | |
− | : Scale the given number of pixels (a | + | : Scale the given number of pixels (a distance or size) relative to a 160 DPI display considering the DPI of the default display. It ensures that e.g. <code style="color: #bb0000;">lv_dpx(100)</code> will have the same physical size regardless to the DPI of the display. |
− | : | + | : '''Parameters''' |
:: n -- the number of pixels to scale | :: n -- the number of pixels to scale | ||
− | : | + | : '''Returns''' |
− | :: <code>n x current_dpi/160</code> | + | :: <code style="color: #bb0000;">n x current_dpi/160</code> |
− | + | <span style="background-color:#e7f2fa;color:#2980b9;">static inline lv_coord_t lv_disp_dpx(const lv_disp_t *disp, lv_coord_t n) </span> | |
− | : Scale the given number of pixels (a distance or size) relative to a | + | : Scale the given number of pixels (a distance or size) relative to a 160 DPI display considering the DPI of the given display. It ensures that e.g. <code style="color: #bb0000;">lv_dpx(100)</code> will have the same physical size regardless to the DPI of the display. |
− | : | + | : '''Parameters''' |
::* obj -- a display whose dpi should be considered | ::* obj -- a display whose dpi should be considered | ||
::* n -- the number of pixels to scale | ::* n -- the number of pixels to scale | ||
− | : | + | : '''Returns''' |
− | :: <code>n x current_dpi/160</code> | + | :: <code style="color: #bb0000;">n x current_dpi/160</code> |
− | + | | | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
:[[App:Library:LVGL#Overview|戻る : Previous]] | :[[App:Library:LVGL#Overview|戻る : Previous]] |
2022年7月1日 (金) 11:58時点における版
https://docs.lvgl.io/8.2/overview/display.html
Displays
英文 | 自動翻訳 |
---|---|
Important The basic concept of a display in LVGL is explained in the [Porting](/porting/display) section. So before reading further, please read the [Porting](/porting/display) section first. |
Multiple display support
英文 | 自動翻訳 |
---|---|
In LVGL you can have multiple displays, each with their own driver and objects. The only limitation is that every display needs to have the same color depth (as defined in Creating more displays is easy: just initialize more display buffers and register another driver for every display. When you create the UI, use Why would you want multi-display support? Here are some examples:
|
Using only one display
英文 | 自動翻訳 |
---|---|
Using more displays can be useful but in most cases it's not required. Therefore, the whole concept of multi-display handling is completely hidden if you register only one display. By default, the last created (and only) display is used.
|
Mirror display
英文 | 自動翻訳 |
---|---|
To mirror the image of a display to another display, you don't need to use multi-display support. Just transfer the buffer received in |
Split image
英文 | 自動翻訳 |
---|---|
You can create a larger virtual display from an array of smaller ones. You can create it as below:
|
Screens
英文 | 自動翻訳 |
---|---|
Every display has its own set of screens and the objects on each screen. Be sure not to confuse displays and screens:
Screens can be considered the highest level containers which have no parent. A screen's size is always equal to its display and their origin is (0;0). Therefore, a screen's coordinates can't be changed, i.e. A screen can be created from any object type but the two most typical types are Base object and Image (to create a wallpaper). To create a screen, use To load a screen, use Screens can be deleted with |
Transparent screens
英文 | 自動翻訳 |
---|---|
Usually, the opacity of the screen is This configuration (transparent screen and display) could be used to create for example OSD menus where a video is played on a lower layer, and a menu is overlayed on an upper layer. To handle transparent displays, special (slower) color mixing algorithms need to be used by LVGL so this feature needs to enabled with In summary, to enable transparent screens and displays for OSD menu-like UIs:
|
Features of displays
Inactivity
英文 | 自動翻訳 |
---|---|
A user's inactivity time is measured on each display. Every use of an Input device (if associated with the display) counts as an activity. To get time elapsed since the last activity, use You can manually trigger an activity using |
Background
英文 | 自動翻訳 |
---|---|
Every display has a background color, background image and background opacity properties. They become visible when the current screen is transparent or not positioned to cover the whole display. The background color is a simple color to fill the display. It can be adjusted with The display background image is a path to a file or a pointer to an The opacity of the background color or image can be adjusted with The |
API
英文 | 自動翻訳 |
---|---|
Enums enum lv_scr_load_anim_t
Functions lv_obj_t *lv_disp_get_scr_act(lv_disp_t *disp)
lv_obj_t *lv_disp_get_scr_prev(lv_disp_t *disp)
void lv_disp_load_scr(lv_obj_t *scr)
lv_obj_t *lv_disp_get_layer_top(lv_disp_t *disp)
lv_obj_t *lv_disp_get_layer_sys(lv_disp_t *disp)
void lv_disp_set_theme(lv_disp_t *disp, lv_theme_t *th)
lv_theme_t *lv_disp_get_theme(lv_disp_t *disp)
void lv_disp_set_bg_color(lv_disp_t *disp, lv_color_t color)
void lv_disp_set_bg_image(lv_disp_t *disp, const void *img_src)
void lv_disp_set_bg_opa(lv_disp_t *disp, lv_opa_t opa)
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)
uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp)
void lv_disp_trig_activity(lv_disp_t *disp)
void lv_disp_clean_dcache(lv_disp_t *disp)
lv_timer_t *_lv_disp_get_refr_timer(lv_disp_t *disp)
static inline lv_obj_t *lv_scr_act(void)
static inline lv_obj_t *lv_layer_top(void)
static inline lv_obj_t *lv_layer_sys(void)
static inline void lv_scr_load(lv_obj_t *scr) static inline lv_coord_t lv_dpx(lv_coord_t n)
static inline lv_coord_t lv_disp_dpx(const lv_disp_t *disp, lv_coord_t n)
|