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.
Members
MAX_RENDERED_VERTICESnewlenis_emptyget_strokesget_stroke_by_idadd_strokeadd_strokesclearbounding_rectdelete_selectedmove_selectedselect_with_lineselect_with_poly_lineeraseremove_strokeschangedsavesave_with_limitsset_platform_servicesplatform_servicessave_asyncsave_with_format_asyncloadload_with_limitsload_asynccopy_selectedpastecan_pastecopy_selected_to_clipboardcan_paste_from_clipboardpaste_from_clipboard
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.
new
fn new() -> Rc<Self>
len
fn len(self: &Self) -> usize
is_empty
fn is_empty(self: &Self) -> bool
get_strokes
fn get_strokes(self: &Self) -> Vec<Rc<InkStroke>>
get_stroke_by_id
fn get_stroke_by_id(self: &Self, id: u32) -> Option<Rc<InkStroke>>
add_stroke
fn add_stroke(self: &Self, stroke: Rc<InkStroke>) -> Result<(), InkError>
add_strokes
fn add_strokes(self: &Self, strokes: impl IntoIterator<Item = Rc<InkStroke>>) -> Result<(), InkError>
clear
fn clear(self: &Self)
bounding_rect
fn bounding_rect(self: &Self) -> Rect
delete_selected
fn delete_selected(self: &Self) -> Rect
Deletes the selected strokes and returns their former bounds.
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.
select_with_line
fn select_with_line(self: &Self, from: Point, to: Point) -> Rect
select_with_poly_line
fn select_with_poly_line(self: &Self, points: impl AsRef<[Point]>) -> Rect
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.
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.
changed
fn changed(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
save
fn save(self: &Self) -> Result<Vec<u8>, InkError>
Saves the versioned native FerroUI ink format (not Windows ISF).
save_with_limits
fn save_with_limits(self: &Self, limits: InkPersistenceLimits) -> Result<Vec<u8>, InkError>
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.
platform_services
fn platform_services(self: &Self) -> Option<Rc<dyn IInkPlatformServices>>
save_async
fn save_async(self: &Self) -> InkServiceFuture<Vec<u8>>
save_with_format_async
fn save_with_format_async(self: &Self, format: InkPersistenceFormat) -> InkServiceFuture<Vec<u8>>
load
fn load(self: &Self, data: &[u8]) -> Result<(), InkError>
Replaces this collection only after the complete document validates.
load_with_limits
fn load_with_limits(self: &Self, data: &[u8], limits: InkPersistenceLimits) -> Result<(), InkError>
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.
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.
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.
can_paste
fn can_paste(data: &[u8]) -> bool
copy_selected_to_clipboard
fn copy_selected_to_clipboard(self: &Self) -> Result<(), InkError>
can_paste_from_clipboard
fn can_paste_from_clipboard(self: &Self) -> Result<bool, InkError>
paste_from_clipboard
fn paste_from_clipboard(self: &Self, position: Point) -> Result<Rect, InkError>
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.