mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-26 02:37:01 +08:00
feat(dropshadow): add drop shadow support (#9331)
Co-authored-by: André Costa <andre_miguel_costa@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
918e480c66
commit
bb3233b794
+23
-3
@@ -30,6 +30,7 @@ style_properties_type = {
|
||||
"LV_STYLE_TEXT_FONT": "LV_PROPERTY_TYPE_FONT",
|
||||
"LV_STYLE_TEXT_OUTLINE_STROKE_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
"LV_STYLE_TRANSITION": "LV_PROPERTY_TYPE_POINTER",
|
||||
"LV_STYLE_DROP_SHADOW_COLOR": "LV_PROPERTY_TYPE_COLOR",
|
||||
}
|
||||
|
||||
|
||||
@@ -68,16 +69,35 @@ def read_widget_properties(directory):
|
||||
id)
|
||||
|
||||
def match_styles(file_path):
|
||||
pattern = r'^\s+LV_STYLE_(\w+)\s*=\s*(\d+),'
|
||||
pattern_with_value = r'^\s+LV_STYLE_(\w+)\s*=\s*(\d+),'
|
||||
pattern_name_only = r'^\s+LV_STYLE_(\w+)\s*,'
|
||||
last_value = 0
|
||||
process = False
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
for line in file.readlines():
|
||||
match = re.match(pattern, line)
|
||||
if re.match("enum _lv_style_id_t", line):
|
||||
process = True
|
||||
continue
|
||||
|
||||
if process and re.match("};", line):
|
||||
return
|
||||
|
||||
if process == False: continue
|
||||
match = re.match(pattern_with_value, line)
|
||||
name = ""
|
||||
if match:
|
||||
name = match.group(1).upper()
|
||||
last_value = int(match.group(2))
|
||||
else:
|
||||
match = re.match(pattern_name_only, line)
|
||||
if match:
|
||||
name = match.group(1).upper()
|
||||
last_value += 1
|
||||
if name:
|
||||
id = f"LV_PROPERTY_STYLE_{name}"
|
||||
yield Property("style",
|
||||
match.group(1).lower(), "style",
|
||||
match.group(2), id)
|
||||
last_value, id)
|
||||
|
||||
properties_by_widget = defaultdict(list)
|
||||
for file_path in find_headers(directory):
|
||||
|
||||
+40
-11
@@ -364,7 +364,47 @@ props = [
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the letter outline stroke. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
|
||||
|
||||
{'section': 'Blur', 'dsc':'Blur the widget or its background' },
|
||||
{'name': 'BLUR_RADIUS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Sets the intensity of blurring. Applied on each lv_part separately before the children are rendered."},
|
||||
|
||||
{'name': 'BLUR_BACKDROP',
|
||||
'style_type': 'num', 'var_type': 'bool', 'default':'`false`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "If `true` the background of the widget will be blurred. The part should have < 100% opacity to make it visible. If `false` the given part will be blurred when it's rendered but before drawing the children."},
|
||||
|
||||
{'name': 'BLUR_QUALITY',
|
||||
'style_type': 'num', 'var_type': 'lv_blur_quality_t', 'default':'`LV_BLUR_QUALITY_AUTO`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. "},
|
||||
|
||||
{'section': 'Drop shadow', 'dsc':'Take an A8 snapshot of the given part and blur it.' },
|
||||
|
||||
{'name': 'DROP_SHADOW_RADIUS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Sets the intensity of blurring. Applied on each lv_part separately before the children are rendered."},
|
||||
|
||||
{'name': 'DROP_SHADOW_OFFSET_X',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set an offset on the shadow in pixels in X direction."},
|
||||
|
||||
{'name': 'DROP_SHADOW_OFFSET_Y',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
|
||||
'dsc': "Set an offset on the shadow in pixels in Y direction."},
|
||||
|
||||
{'name': 'DROP_SHADOW_COLOR',
|
||||
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
|
||||
'dsc': "Set the color of the shadow."},
|
||||
|
||||
{'name': 'DROP_SHADOW_OPA',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set the opacity of the shadow."},
|
||||
|
||||
{'name': 'DROP_SHADOW_QUALITY',
|
||||
'style_type': 'num', 'var_type': 'lv_blur_quality_t', 'default':'`LV_BLUR_QUALITY_AUTO`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. "},
|
||||
|
||||
{'section': 'Miscellaneous', 'dsc':'Mixed properties for various purposes.' },
|
||||
|
||||
{'name': 'RADIUS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Set radius on every corner. The value is interpreted in pixels (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"},
|
||||
@@ -401,17 +441,6 @@ props = [
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Sets the intensity of color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent. A value of 255, `LV_OPA_100` or `LV_OPA_COVER` means fully opaque. Intermediate values like LV_OPA_10, LV_OPA_20, etc result in semi-transparency."},
|
||||
|
||||
{'name': 'BLUR_RADIUS',
|
||||
'style_type': 'num', 'var_type': 'int32_t', 'default':'`0`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Sets the intensity of blurring. Applied on each lv_part separately before the children are rendered."},
|
||||
|
||||
{'name': 'BLUR_BACKDROP',
|
||||
'style_type': 'num', 'var_type': 'bool', 'default':'`false`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "If `true` the background of the widget will be blurred. The part should have < 100% opacity to make it visible. If `false` the given part will be blurred when it's rendered but before drawing the children."},
|
||||
|
||||
{'name': 'BLUR_QUALITY',
|
||||
'style_type': 'num', 'var_type': 'lv_blur_quality_t', 'default':'`LV_BLUR_QUALITY_AUTO`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Setting to `LV_BLUR_QUALITY_SPEED` the blurring algorithm will prefer speed over quality. `LV_BLUR_QUALITY_PRECISION` will force using higher quality but slower blur. With `LV_BLUR_QUALITY_AUTO` the quality will be selected automatically. "},
|
||||
|
||||
{'name': 'ANIM',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_anim_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
|
||||
Reference in New Issue
Block a user