FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    InkStroke

    struct · ferroui-controls-inking · v0.5.0

    struct InkStroke
    

    One editable stroke identity with immutable raw device samples. Attributes are copied on construction. Geometry is cached until attributes or the point transform change; selection does not invalidate tessellation.

    View source

    Members

    MAX_RENDERED_VERTICES

    const MAX_RENDERED_VERTICES: usize
    

    Conservative maximum contour vertices reserved by one stroke. This accounts for curve subdivision and the most detailed supported nib.

    Source

    new

    fn new(points: Vec<InkPoint>, attributes: InkDrawingAttributes) -> Result<Rc<Self>, InkError>
    

    Source

    id

    fn id(self: &Self) -> u32
    

    Source

    ink_points

    fn ink_points(self: &Self) -> &[InkPoint]
    

    Source

    get_ink_points

    fn get_ink_points(self: &Self) -> &[InkPoint]
    

    Source

    drawing_attributes

    fn drawing_attributes(self: &Self) -> InkDrawingAttributes
    

    Source

    set_drawing_attributes

    fn set_drawing_attributes(self: &Self, value: InkDrawingAttributes) -> Result<(), InkError>
    

    Source

    selected

    fn selected(self: &Self) -> bool
    

    Source

    set_selected

    fn set_selected(self: &Self, value: bool)
    

    Source

    point_transform

    fn point_transform(self: &Self) -> Matrix
    

    Source

    set_point_transform

    fn set_point_transform(self: &Self, value: Matrix) -> Result<(), InkError>
    

    Source

    clone_stroke

    fn clone_stroke(self: &Self) -> Result<Rc<Self>, InkError>
    

    A new stroke identity, with the same samples, attributes and transform.

    Source

    changed

    fn changed(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
    

    Source

    rendering_points

    fn rendering_points(self: &Self) -> Rc<Vec<InkPoint>>
    

    Smoothed local-space samples, cached across redraws. Cubic Hermite interpolation is limited to the local convex range to avoid overshoot around sharp corners and repeated samples. Input telemetry is retained.

    Source

    outline_polygons

    fn outline_polygons(self: &Self) -> Rc<Vec<Vec<Point>>>
    

    All contours of a stroke, in transformed coordinates and consistently wound. Fill them together using nonzero winding in ONE geometry draw. This unions overlapping segments before compositing, which is essential for highlighters. Elliptic nibs are polygonized to 32 vertices.

    Source

    bounding_rect

    fn bounding_rect(self: &Self) -> Rect
    

    Analytic axis-aligned nib bounds, including rotation, shear, pressure, pencil tilt and stroke transforms. Bounds enclose the flattened curve.

    Source

    hit_test_segment

    fn hit_test_segment(self: &Self, from: Point, to: Point, radius: f64) -> bool
    

    Swept circular eraser against every stroke segment (including sparse samples), rather than testing only the sampled input points.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • IUnknownImpl
    • MarkupTyped
    • PartialEq
    • Debug
    • Drop

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.