# InkStrokeContainer

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-inking/struct-inkstrokecontainer/

**struct** · [`ferroui-controls-inking`](/docs/0.5.0/api/ferroui-controls-inking/) · v0.5.0

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L23)

## Members

- [`MAX_RENDERED_VERTICES`](#assoc_const-max_rendered_vertices)
- [`new`](#function-new)
- [`len`](#function-len)
- [`is_empty`](#function-is_empty)
- [`get_strokes`](#function-get_strokes)
- [`get_stroke_by_id`](#function-get_stroke_by_id)
- [`add_stroke`](#function-add_stroke)
- [`add_strokes`](#function-add_strokes)
- [`clear`](#function-clear)
- [`bounding_rect`](#function-bounding_rect)
- [`delete_selected`](#function-delete_selected)
- [`move_selected`](#function-move_selected)
- [`select_with_line`](#function-select_with_line)
- [`select_with_poly_line`](#function-select_with_poly_line)
- [`erase`](#function-erase)
- [`remove_strokes`](#function-remove_strokes)
- [`changed`](#function-changed)
- [`save`](#function-save)
- [`save_with_limits`](#function-save_with_limits)
- [`set_platform_services`](#function-set_platform_services)
- [`platform_services`](#function-platform_services)
- [`save_async`](#function-save_async)
- [`save_with_format_async`](#function-save_with_format_async)
- [`load`](#function-load)
- [`load_with_limits`](#function-load_with_limits)
- [`load_async`](#function-load_async)
- [`copy_selected`](#function-copy_selected)
- [`paste`](#function-paste)
- [`can_paste`](#function-can_paste)
- [`copy_selected_to_clipboard`](#function-copy_selected_to_clipboard)
- [`can_paste_from_clipboard`](#function-can_paste_from_clipboard)
- [`paste_from_clipboard`](#function-paste_from_clipboard)

<a id="assoc_const-max_rendered_vertices"></a>

### MAX_RENDERED_VERTICES

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L50)

<a id="function-new"></a>

### new

```rust
fn new() -> Rc<Self>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L52)

<a id="function-len"></a>

### len

```rust
fn len(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L62)

<a id="function-is_empty"></a>

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L65)

<a id="function-get_strokes"></a>

### get_strokes

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L68)

<a id="function-get_stroke_by_id"></a>

### get_stroke_by_id

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L71)

<a id="function-add_stroke"></a>

### add_stroke

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L74)

<a id="function-add_strokes"></a>

### add_strokes

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L77)

<a id="function-clear"></a>

### clear

```rust
fn clear(self: &Self)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L147)

<a id="function-bounding_rect"></a>

### bounding_rect

```rust
fn bounding_rect(self: &Self) -> Rect
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L157)

<a id="function-delete_selected"></a>

### delete_selected

```rust
fn delete_selected(self: &Self) -> Rect
```

Deletes the selected strokes and returns their former bounds.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L162)

<a id="function-move_selected"></a>

### move_selected

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L175)

<a id="function-select_with_line"></a>

### select_with_line

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L204)

<a id="function-select_with_poly_line"></a>

### select_with_poly_line

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L217)

<a id="function-erase"></a>

### erase

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L235)

<a id="function-remove_strokes"></a>

### remove_strokes

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L257)

<a id="function-changed"></a>

### changed

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L295)

<a id="function-save"></a>

### save

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L315)

<a id="function-save_with_limits"></a>

### save_with_limits

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L318)

<a id="function-set_platform_services"></a>

### set_platform_services

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L323)

<a id="function-platform_services"></a>

### platform_services

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L329)

<a id="function-save_async"></a>

### save_async

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L332)

<a id="function-save_with_format_async"></a>

### save_with_format_async

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L335)

<a id="function-load"></a>

### load

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

Replaces this collection only after the complete document validates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L357)

<a id="function-load_with_limits"></a>

### load_with_limits

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L360)

<a id="function-load_async"></a>

### load_async

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L370)

<a id="function-copy_selected"></a>

### copy_selected

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L392)

<a id="function-paste"></a>

### paste

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L402)

<a id="function-can_paste"></a>

### can_paste

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L423)

<a id="function-copy_selected_to_clipboard"></a>

### copy_selected_to_clipboard

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L427)

<a id="function-can_paste_from_clipboard"></a>

### can_paste_from_clipboard

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L438)

<a id="function-paste_from_clipboard"></a>

### paste_from_clipboard

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.Inking/ink_stroke_container.rs#L444)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `IUnknownImpl`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- `PartialEq`
- `Debug`
- `Drop`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
