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:
1 parent
399181b975
commit
4ca85e87d8
6 files changed
+228
No files matched your search
@@ -19,6 +19,11 @@ pub use style::compute_style;
|
||||
mod dom;
|
||||
pub use dom::{layout_dom, DomLayout};
|
||||
|
||||
#[cfg(feature = "paint")]
|
||||
mod paint;
|
||||
#[cfg(feature = "paint")]
|
||||
pub use paint::paint_dom;
|
||||
|
||||
/// An axis-aligned rectangle in CSS pixels, relative to the containing block.
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq)]
|
||||
pub struct Rect {
|
||||
@@ -58,6 +63,8 @@ pub struct LayoutStyle {
|
||||
pub margin: Edges,
|
||||
pub padding: Edges,
|
||||
pub border: Edges,
|
||||
/// RGBA for the paint step. Parsed always (cheap), used only with `paint`.
|
||||
pub background_color: Option<[u8; 4]>,
|
||||
}
|
||||
|
||||
/// A node in the input layout tree. `text` is carried for the paint phase; it
|
||||
|
||||
Reference in new issue
Block a user