Skip to main content

GraphicsElem

Enum GraphicsElem 

Source
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)>
§width: Length
§height: Length
§depth: Length
§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.

Fields

Implementations§

Source§

impl GraphicsElem

Source

pub fn visit<__T>(&self, visitor: impl IntoVisitor<__T>) -> &Self

Visit self with any Visit, returning self to chain.

Source§

impl GraphicsElem

Source

pub fn visit_mut<__T>(&mut self, visitor: impl IntoVisitorMut<__T>) -> &mut Self

Visit self with any VisitMut, returning self to chain.

Trait Implementations§

Source§

impl Ast for GraphicsElem

Source§

impl Clone for GraphicsElem

Source§

fn clone(&self) -> GraphicsElem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphicsElem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<__F: FnMut(&GraphicsElem)> IntoHook<GraphicsElem> for __F

Source§

fn into_hook(self) -> impl Hook

Source§

impl<__F: FnMut(&mut GraphicsElem)> IntoHookMut<GraphicsElem> for __F

Source§

impl<__F: FnMut(&GraphicsElem)> IntoVisitor<GraphicsElem> for __F

Source§

fn into_visitor(self) -> impl Visit

Source§

impl<__F: FnMut(&mut GraphicsElem)> IntoVisitorMut<GraphicsElem> for __F

Source§

impl PartialEq for GraphicsElem

Source§

fn eq(&self, other: &GraphicsElem) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Repeater<0> for GraphicsElem

Source§

type Type = Path

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<1> for GraphicsElem

Source§

type Type = Vec<(Length, PureHorzBox)>

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<2> for GraphicsElem

Source§

type Type = Length

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<3> for GraphicsElem

Source§

type Type = Color

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<4> for GraphicsElem

Source§

type Type = Option<(f64, f64, f64, f64)>

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<5> for GraphicsElem

Source§

type Type = Vec<GraphicsElem>

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<6> for GraphicsElem

Source§

type Type = (Length, Length)

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<7> for GraphicsElem

Source§

type Type = String

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl Repeater<8> for GraphicsElem

Source§

type Type = (Length, Length, Length)

The leaked type, valid in the referrer’s context via <T as Repeater<INDEX>>::Type.
Source§

impl StructuralPartialEq for GraphicsElem

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Clone for T
where T: Clone,

Source§

fn clone(&self) -> T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Debug for T
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.