render: paint backgrounds to a tiny-skia pixmap

Adds a paint feature to obscura-render (tiny-skia: pure Rust, CPU,
deterministic, no system deps). paint_dom lays out the DOM and fills
each element's border box with its parsed background-color over a white
page, in tree order so descendants paint over ancestors.

Style parsing now also extracts background-color (hex #rgb/#rgba/
later enhancements.
This commit is contained in:
SGavrl committed 2026-07-01 15:58:27 +00:00
1 parent 399181b975
commit 4ca85e87d8
6 files changed
+228

No files matched your search

+7
View File
@@ -6,9 +6,16 @@ license.workspace = true
repository.workspace = true
description = "Optional scoped render layer for Obscura: layout (taffy) and, with the paint feature, text and raster output for screenshots."
[features]
default = []
# Rasterize the laid-out tree to a pixmap (tiny-skia). Off by default; the
# layout core (getBoundingClientRect etc.) works without it.
paint = ["dep:tiny-skia"]
[dependencies]
taffy = { workspace = true }
obscura-dom = { workspace = true }
tiny-skia = { workspace = true, optional = true }
[lib]
path = "src/lib.rs"