mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 15:28:34 +08:00
@@ -380,8 +380,10 @@ async def to_code(configs):
|
|||||||
# This must be done after all widgets are created
|
# This must be done after all widgets are created
|
||||||
for comp in helpers.lvgl_components_required:
|
for comp in helpers.lvgl_components_required:
|
||||||
cg.add_define(f"USE_LVGL_{comp.upper()}")
|
cg.add_define(f"USE_LVGL_{comp.upper()}")
|
||||||
# Currently always need RGB565 for the display buffer, and ARGB8888 is used for layer blending
|
for use in helpers.lv_uses:
|
||||||
lv_image_formats = {"RGB565", "ARGB8888"}
|
df.add_define(f"LV_USE_{use.upper()}")
|
||||||
|
cg.add_define(f"USE_LVGL_{use.upper()}")
|
||||||
|
|
||||||
if {
|
if {
|
||||||
"transform_rotation",
|
"transform_rotation",
|
||||||
"transform_scale",
|
"transform_scale",
|
||||||
@@ -389,9 +391,18 @@ async def to_code(configs):
|
|||||||
"transform_scale_y",
|
"transform_scale_y",
|
||||||
} & styles_used:
|
} & styles_used:
|
||||||
df.add_define("LV_COLOR_SCREEN_TRANSP", "1")
|
df.add_define("LV_COLOR_SCREEN_TRANSP", "1")
|
||||||
for use in helpers.lv_uses:
|
|
||||||
df.add_define(f"LV_USE_{use.upper()}")
|
# Currently always need RGB565 for the display buffer, and ARGB8888 is used for layer blending
|
||||||
cg.add_define(f"USE_LVGL_{use.upper()}")
|
lv_image_formats = {"RGB565", "ARGB8888"}
|
||||||
|
if {
|
||||||
|
"drop_shadow_color",
|
||||||
|
"drop_shadow_offset_x",
|
||||||
|
"drop_shadow_offset_y",
|
||||||
|
"drop_shadow_opa",
|
||||||
|
"drop_shadow_quality",
|
||||||
|
"drop_shadow_radius",
|
||||||
|
} & styles_used:
|
||||||
|
lv_image_formats.add("A8")
|
||||||
|
|
||||||
for image_id in lv_images_used:
|
for image_id in lv_images_used:
|
||||||
await cg.get_variable(image_id)
|
await cg.get_variable(image_id)
|
||||||
@@ -410,6 +421,7 @@ async def to_code(configs):
|
|||||||
lv_image_formats.add("RGB888")
|
lv_image_formats.add("RGB888")
|
||||||
for fmt in lv_image_formats:
|
for fmt in lv_image_formats:
|
||||||
df.add_define(f"LV_DRAW_SW_SUPPORT_{fmt}", "1")
|
df.add_define(f"LV_DRAW_SW_SUPPORT_{fmt}", "1")
|
||||||
|
|
||||||
lv_conf_h_file = CORE.relative_src_path(LV_CONF_FILENAME)
|
lv_conf_h_file = CORE.relative_src_path(LV_CONF_FILENAME)
|
||||||
write_file_if_changed(lv_conf_h_file, generate_lv_conf_h())
|
write_file_if_changed(lv_conf_h_file, generate_lv_conf_h())
|
||||||
cg.add_build_flag("-DLV_CONF_H=1")
|
cg.add_build_flag("-DLV_CONF_H=1")
|
||||||
|
|||||||
@@ -74,11 +74,13 @@ inline void lv_style_set_text_font(lv_style_t *style, const font::Font *font) {
|
|||||||
#if defined(USE_LVGL_IMAGE) && defined(USE_IMAGE)
|
#if defined(USE_LVGL_IMAGE) && defined(USE_IMAGE)
|
||||||
// Shortcut / overload, so that the source of an image can easily be updated
|
// Shortcut / overload, so that the source of an image can easily be updated
|
||||||
// from within a lambda.
|
// from within a lambda.
|
||||||
inline void lv_image_set_src(lv_obj_t *obj, esphome::image::Image *image) {
|
inline void lv_image_set_src(lv_obj_t *obj, image::Image *image) { lv_image_set_src(obj, image->get_lv_image_dsc()); }
|
||||||
lv_image_set_src(obj, image->get_lv_image_dsc());
|
|
||||||
|
inline void lv_obj_set_style_bitmap_mask_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector) {
|
||||||
|
lv_obj_set_style_bitmap_mask_src(obj, image->get_lv_image_dsc(), selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void lv_obj_set_style_bg_image_src(lv_obj_t *obj, esphome::image::Image *image, lv_style_selector_t selector) {
|
inline void lv_obj_set_style_bg_image_src(lv_obj_t *obj, image::Image *image, lv_style_selector_t selector) {
|
||||||
lv_obj_set_style_bg_image_src(obj, image->get_lv_image_dsc(), selector);
|
lv_obj_set_style_bg_image_src(obj, image->get_lv_image_dsc(), selector);
|
||||||
}
|
}
|
||||||
#endif // USE_LVGL_IMAGE
|
#endif // USE_LVGL_IMAGE
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ BASE_PROPS = {
|
|||||||
"bg_main_opa": lvalid.opacity,
|
"bg_main_opa": lvalid.opacity,
|
||||||
"bg_main_stop": lvalid.stop_value,
|
"bg_main_stop": lvalid.stop_value,
|
||||||
"bg_opa": lvalid.opacity,
|
"bg_opa": lvalid.opacity,
|
||||||
|
"bitmap_mask_src": lvalid.lv_image,
|
||||||
"blend_mode": df.LvConstant(
|
"blend_mode": df.LvConstant(
|
||||||
"LV_BLEND_MODE_",
|
"LV_BLEND_MODE_",
|
||||||
"NORMAL",
|
"NORMAL",
|
||||||
|
|||||||
@@ -511,6 +511,7 @@ lvgl:
|
|||||||
image:
|
image:
|
||||||
src: cat_image
|
src: cat_image
|
||||||
align: top_left
|
align: top_left
|
||||||
|
bitmap_mask_src: alert
|
||||||
on_click:
|
on_click:
|
||||||
- lvgl.widget.focus: spin_up
|
- lvgl.widget.focus: spin_up
|
||||||
- lvgl.widget.focus: next
|
- lvgl.widget.focus: next
|
||||||
@@ -1189,6 +1190,13 @@ image:
|
|||||||
type: BINARY
|
type: BINARY
|
||||||
transparency: chroma_key
|
transparency: chroma_key
|
||||||
|
|
||||||
|
- id: alert
|
||||||
|
file: $component_dir/logo-text.svg
|
||||||
|
type: grayscale
|
||||||
|
resize: 100x100
|
||||||
|
invert_alpha: true
|
||||||
|
transparency: alpha_channel
|
||||||
|
|
||||||
color:
|
color:
|
||||||
- id: light_blue
|
- id: light_blue
|
||||||
hex: "3340FF"
|
hex: "3340FF"
|
||||||
|
|||||||
Reference in New Issue
Block a user