pub enum RenderNode {
Empty,
TextLines {
area: Rect,
style: TextStyle,
lines: Vec<String>,
paragraph_end: Vec<bool>,
line_height_pt: f32,
url: Option<String>,
anchor: Option<String>,
link_to: Option<String>,
outline_level: Option<u8>,
},
RichTextLines {
area: Rect,
align: Align,
lines: Vec<RichLine>,
},
Rect {
area: Rect,
background: Option<Color>,
border: Option<Border>,
corner_radius: f32,
},
Line {
x1: f32,
y1: f32,
x2: f32,
y2: f32,
thickness: f32,
color: Color,
},
Image {
area: Rect,
bytes: Arc<[u8]>,
format: ImageFormat,
width_px: u32,
height_px: u32,
components: u8,
alt: Option<String>,
},
Group {
area: Rect,
clip: bool,
background: Option<Color>,
border: Option<Border>,
corner_radius: f32,
children: Vec<RenderNode>,
},
Tagged {
role: StructRole,
inner: Box<RenderNode>,
},
}Expand description
Positioned, resolved layout output ready for the facade to translate
into lightweight-pdf-writer content-stream operations. Never seen by
lightweight-pdf-writer directly (plan/00a-contracts-and-artifacts.md point 3).
Variants§
Empty
TextLines
Already-wrapped lines, one per output line, top-aligned within area.
Fields
RichTextLines
Text::rich(..) (issue #11) — the multi-style counterpart to
TextLines. Deliberately a separate variant rather than a shape
change to TextLines: every existing TextLines consumer (facade
rendering, font-collection, outline/anchor collection) keeps
working unmodified for plain Text, and this variant just isn’t
handled by any of the outline/anchor/link machinery yet (rich text
doesn’t support those in V1, see Text::spans’ doc comment).
Rect
Line
Image
A validated JPEG/PNG placed at its final, Contain-fit size. bytes
are the original file bytes (facade decides how to embed them —
JPEG passes through as DCTDecode, PNG gets decoded once here to
split out the alpha channel as a SMask).
Fields
format: ImageFormatGroup
A container’s own box: clipped (Grundprinzip 4), optionally painted with a background/border, holding its children.
Fields
children: Vec<RenderNode>Tagged
Wraps inner with a structure-tree role (issue #27) — a wrapper
variant rather than a field on every other variant, so tagging
support doesn’t require touching every RenderNode construction
site in this crate. Attached at Element::layout’s dispatch (see
layoutable::mod) plus, for Table/List/TableOfContents,
inside their own layout code where row/cell/item structure is
known.
Implementations§
Source§impl RenderNode
impl RenderNode
Sourcepub fn clipped(area: Rect, inner: RenderNode) -> RenderNode
pub fn clipped(area: Rect, inner: RenderNode) -> RenderNode
Wraps self in a clipping group bound to area — the render-pass
safety net required from every element, not only containers
(Grundprinzip 4/6).
pub fn height(&self) -> f32
Sourcepub fn tagged(role: StructRole, inner: RenderNode) -> RenderNode
pub fn tagged(role: StructRole, inner: RenderNode) -> RenderNode
Wraps self with a structure-tree role (issue #27) — see
RenderNode::Tagged’s doc comment.
Trait Implementations§
Source§impl Clone for RenderNode
impl Clone for RenderNode
Source§fn clone(&self) -> RenderNode
fn clone(&self) -> RenderNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more