pub enum GraphicsElem {
Fill(Color, Path),
Stroke(Length, Color, Path),
DashedStroke(Length, Dash, Color, Path),
Text {
pt: Point,
contents: Vec<(Length, PureHorzBox)>,
width: Length,
height: Length,
depth: Length,
transform: Option<(f64, f64, f64, f64)>,
},
Group(Vec<GraphicsElem>),
Clip(Path, Vec<GraphicsElem>),
Destination {
key: String,
pt: Point,
},
}Expand description
One graphics element (GraphicD.element). place_graphics
(rustyfi-pdf) matches this exhaustively, without a wildcard arm.
See crate::hbox::PureHorzBox for what the #[subast] list means and
what checks it.
Variants§
Fill(Color, Path)
Filled region, even-odd rule (upstream’s op_f').
Stroke(Length, Color, Path)
Stroked outline at the given line width.
DashedStroke(Length, Dash, Color, Path)
Dashed stroked outline (dashed-stroke), rendered with a PDF d
dash-array op alongside the same stroke ops as Stroke.
Text
draw-text: a text run anchored at pt (box-local, y-up; the run’s
leftmost baseline point). contents is the run laid out at NATURAL
width (upstream LineBreak.natural = determine_widths None,
widperfil = 0; here fit_cell(boxes, natural_width)), each box with
its x offset from pt. width/height/depth are the run’s
natural_metrics, stored at construction so graphics_bbox needs no
re-measure. Rendered by each PDF writer re-entering its own per-box
emission at pt + dx INSIDE place_graphics’s box-local cm frame.
Fields
contents: Vec<(Length, PureHorzBox)>transform: Option<(f64, f64, f64, f64)>The accumulated 2×2 linear transform (linear-transform-graphics,
row-major (a, b, c, d) — same convention as
linear_transform_point) applied to the run about its local
origin BEFORE the pt translation. None means identity: the run
is drawn upright at pt. Some appears once
rotate-graphics/scale-graphics is composed onto a draw-text;
the writer then emits the run under a cm carrying this matrix
(upstream’s lazy LinearTrans render-time cm).
Group(Vec<GraphicsElem>)
0.1 collection node (GraphicD.concat, dev-0-1-0 graphicD.ml:23):
unite-graphics’ payload. No 0.0.6-visible primitive builds one, so it
is unreachable from 0.0.6 rendering by construction.
Clip(Path, Vec<GraphicsElem>)
0.1 clip node (GraphicD.make_clip, graphicD.ml:97-98): render
contents clipped to clip (even-odd, Op_W' — graphicD.ml:331).
The port’s Path already carries N subpaths, standing in for
upstream’s path list. Never constructed by any 0.0.6 path, as Group.
Destination
A DEFERRED register-destination call, carrying NO ink. pt is
box-local in the same y-up frame as every other element’s
coordinates, so the existing transform pipeline carries it, and
rustyfi-lang’s fire_hooks replays it once the box has a page and a
placed point.
It exists because this port applies an inline-graphics callback
eagerly at construction time (prim_inline_graphics) rather than during
page breaking as upstream does, so a register-destination inside one
has no page and annotation.ml:15’s gate — faithfully — refuses it.
KNOWN GAP: math_boxes_of_inline_boxes (rustyfi-lang) harvests a
graphics box’s elements into a PureHorzBox::Math’s rules and
fire_hooks has no Math arm, so an anchor inside a make_paren
delimiter closure never fires. shift_graphics carries the point
correctly, so closing it is one arm and no arithmetic.
Implementations§
Source§impl GraphicsElem
impl GraphicsElem
Sourcepub fn visit<__T>(&self, visitor: impl IntoVisitor<__T>) -> &Self
pub fn visit<__T>(&self, visitor: impl IntoVisitor<__T>) -> &Self
Visit self with any Visit, returning self to chain.
Source§impl GraphicsElem
impl GraphicsElem
Sourcepub fn visit_mut<__T>(&mut self, visitor: impl IntoVisitorMut<__T>) -> &mut Self
pub fn visit_mut<__T>(&mut self, visitor: impl IntoVisitorMut<__T>) -> &mut Self
Visit self with any VisitMut, returning self to chain.
Trait Implementations§
impl Ast for GraphicsElem
Source§impl Clone for GraphicsElem
impl Clone for GraphicsElem
Source§fn clone(&self) -> GraphicsElem
fn clone(&self) -> GraphicsElem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphicsElem
impl Debug for GraphicsElem
Source§impl<__F: FnMut(&GraphicsElem)> IntoHook<GraphicsElem> for __F
impl<__F: FnMut(&GraphicsElem)> IntoHook<GraphicsElem> for __F
Source§impl<__F: FnMut(&mut GraphicsElem)> IntoHookMut<GraphicsElem> for __F
impl<__F: FnMut(&mut GraphicsElem)> IntoHookMut<GraphicsElem> for __F
fn into_hook_mut(self) -> impl HookMut
Source§impl<__F: FnMut(&GraphicsElem)> IntoVisitor<GraphicsElem> for __F
impl<__F: FnMut(&GraphicsElem)> IntoVisitor<GraphicsElem> for __F
fn into_visitor(self) -> impl Visit
Source§impl<__F: FnMut(&mut GraphicsElem)> IntoVisitorMut<GraphicsElem> for __F
impl<__F: FnMut(&mut GraphicsElem)> IntoVisitorMut<GraphicsElem> for __F
fn into_visitor_mut(self) -> impl VisitMut
Source§impl PartialEq for GraphicsElem
impl PartialEq for GraphicsElem
Source§impl Repeater<0> for GraphicsElem
impl Repeater<0> for GraphicsElem
Source§impl Repeater<1> for GraphicsElem
impl Repeater<1> for GraphicsElem
Source§impl Repeater<2> for GraphicsElem
impl Repeater<2> for GraphicsElem
Source§impl Repeater<3> for GraphicsElem
impl Repeater<3> for GraphicsElem
Source§impl Repeater<4> for GraphicsElem
impl Repeater<4> for GraphicsElem
Source§impl Repeater<5> for GraphicsElem
impl Repeater<5> for GraphicsElem
Source§type Type = Vec<GraphicsElem>
type Type = Vec<GraphicsElem>
<T as Repeater<INDEX>>::Type.