Source code
Revision control
Copy as Markdown
Other Tools
---
# Inset shadow with fractional spread/blur. For inset, prim_rect == element_rect,
# so prim_rect.round() is a no-op when the element is integer-aligned (after the
# scene_building snap). What can still be fractional is dest_rect_offset (since
# dest_rect = inner_shadow_rect.inflate(blur_offset) carries the spread's
# fractional component). The fix in prepare.rs uses prim_rect.min.round() for
# both dest_rect_offset and element_offset_rel_prim, which keeps inset correct.
root:
items:
- type: stacking-context
bounds: [0, 0, 700, 360]
items:
- type: rect
bounds: [0, 0, 700, 360]
color: [255, 255, 255]
# Integer-coord box, integer spread+blur (control, no artifact expected).
- type: rect
bounds: [50, 50, 200, 200]
color: [103, 150, 29]
- type: box-shadow
bounds: [50, 50, 200, 200]
color: [0, 0, 0, 0.47]
clip-mode: inset
offset: [0, 0]
blur-radius: 7
spread-radius: 2
# Integer element, fractional spread+blur (reproduces fractional
# dest_rect.p0 / inner_shadow_rect; with the fix both edges stay clean).
- type: rect
bounds: [350, 50, 250, 250]
color: [103, 150, 29]
- type: box-shadow
bounds: [350, 50, 250, 250]
color: [0, 0, 0, 0.47]
clip-mode: inset
offset: [0, 0]
blur-radius: 8.75
spread-radius: 2.5