FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    InkStrokeContainer

    struct · ferroui-controls-inking · v0.5.0

    struct InkStrokeContainer
    

    UI-thread-affine stroke collection with stable identities and notifying mutation. No collection borrow is held while user callbacks are invoked.

    View source

    Members

    MAX_RENDERED_VERTICES

    const MAX_RENDERED_VERTICES: usize
    

    Maximum aggregate conservative contour-vertex reservation. Attribute edits cannot increase the reservation made when a stroke is admitted. Point storage is at most 64 MiB; vector and backend caches are extra.

    Source

    new

    fn new() -> Rc<Self>
    

    Source

    len

    fn len(self: &Self) -> usize
    

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    get_strokes

    fn get_strokes(self: &Self) -> Vec<Rc<InkStroke>>
    

    Source

    get_stroke_by_id

    fn get_stroke_by_id(self: &Self, id: u32) -> Option<Rc<InkStroke>>
    

    Source

    add_stroke

    fn add_stroke(self: &Self, stroke: Rc<InkStroke>) -> Result<(), InkError>
    

    Source

    add_strokes

    fn add_strokes(self: &Self, strokes: impl IntoIterator<Item = Rc<InkStroke>>) -> Result<(), InkError>
    

    Source

    clear

    fn clear(self: &Self)
    

    Source

    bounding_rect

    fn bounding_rect(self: &Self) -> Rect
    

    Source

    delete_selected

    fn delete_selected(self: &Self) -> Rect
    

    Deletes the selected strokes and returns their former bounds.

    Source

    move_selected

    fn move_selected(self: &Self, translation: Point) -> Result<Rect, InkError>
    

    Moves a snapshot of the selection. All transforms are validated before the first mutation and the collection emits one change notification.

    Source

    select_with_line

    fn select_with_line(self: &Self, from: Point, to: Point) -> Rect
    

    Source

    select_with_poly_line

    fn select_with_poly_line(self: &Self, points: impl AsRef<[Point]>) -> Rect
    

    Source

    erase

    fn erase(self: &Self, from: Point, to: Point, radius: f64) -> Result<Vec<Rc<InkStroke>>, InkError>
    

    Erases whole strokes touched by the swept eraser. The returned snapshot retains the erased strokes for an undo record or StrokesErased event.

    Source

    remove_strokes

    fn remove_strokes(self: &Self, strokes: &[Rc<InkStroke>])
    

    Removes these exact stroke instances. Serialized IDs may occur in different documents, so an unrelated instance with the same ID does not remove the stroke held by this collection.

    Source

    changed

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

    Source

    save

    fn save(self: &Self) -> Result<Vec<u8>, InkError>
    

    Saves the versioned native FerroUI ink format (not Windows ISF).

    Source

    save_with_limits

    fn save_with_limits(self: &Self, limits: InkPersistenceLimits) -> Result<Vec<u8>, InkError>
    

    Source

    set_platform_services

    fn set_platform_services(self: &Self, value: Option<Rc<dyn IInkPlatformServices>>)
    

    Attaches an OS interoperability adapter. Drawing remains portable; native persistence and clipboard operations use this service only.

    Source

    platform_services

    fn platform_services(self: &Self) -> Option<Rc<dyn IInkPlatformServices>>
    

    Source

    save_async

    fn save_async(self: &Self) -> InkServiceFuture<Vec<u8>>
    

    Source

    save_with_format_async

    fn save_with_format_async(self: &Self, format: InkPersistenceFormat) -> InkServiceFuture<Vec<u8>>
    

    Source

    load

    fn load(self: &Self, data: &[u8]) -> Result<(), InkError>
    

    Replaces this collection only after the complete document validates.

    Source

    load_with_limits

    fn load_with_limits(self: &Self, data: &[u8], limits: InkPersistenceLimits) -> Result<(), InkError>
    

    Source

    load_async

    fn load_async(self: &Self, data: Vec<u8>) -> InkServiceFuture<()>
    

    Auto-detects native portable ink; other representations are delegated to the attached OS service. The old document survives all decode failures.

    Source

    copy_selected

    fn copy_selected(self: &Self) -> Result<Vec<u8>, InkError>
    

    Produces a portable clipboard payload. Platform clipboard adapters own transport; this method never accesses a process-global clipboard.

    Source

    paste

    fn paste(self: &Self, data: &[u8], position: Point) -> Result<Rect, InkError>
    

    Imports clipboard data with fresh stroke IDs and places its bounding rectangle at position. Existing selection is cleared on success only.

    Source

    can_paste

    fn can_paste(data: &[u8]) -> bool
    

    Source

    copy_selected_to_clipboard

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

    Source

    can_paste_from_clipboard

    fn can_paste_from_clipboard(self: &Self) -> Result<bool, InkError>
    

    Source

    paste_from_clipboard

    fn paste_from_clipboard(self: &Self, position: Point) -> Result<Rect, InkError>
    

    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.