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.
Members
MAX_RENDERED_VERTICESnewidink_pointsget_ink_pointsdrawing_attributesset_drawing_attributesselectedset_selectedpoint_transformset_point_transformclone_strokechangedrendering_pointsoutline_polygonsbounding_recthit_test_segment
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.
new
fn new(points: Vec<InkPoint>, attributes: InkDrawingAttributes) -> Result<Rc<Self>, InkError>
id
fn id(self: &Self) -> u32
ink_points
fn ink_points(self: &Self) -> &[InkPoint]
get_ink_points
fn get_ink_points(self: &Self) -> &[InkPoint]
drawing_attributes
fn drawing_attributes(self: &Self) -> InkDrawingAttributes
set_drawing_attributes
fn set_drawing_attributes(self: &Self, value: InkDrawingAttributes) -> Result<(), InkError>
selected
fn selected(self: &Self) -> bool
set_selected
fn set_selected(self: &Self, value: bool)
point_transform
fn point_transform(self: &Self) -> Matrix
set_point_transform
fn set_point_transform(self: &Self, value: Matrix) -> Result<(), InkError>
clone_stroke
fn clone_stroke(self: &Self) -> Result<Rc<Self>, InkError>
A new stroke identity, with the same samples, attributes and transform.
changed
fn changed(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
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.
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.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherIUnknownImplMarkupTypedPartialEqDebugDrop
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.