# InkStroke

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

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

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

## Members

- [`MAX_RENDERED_VERTICES`](#assoc_const-max_rendered_vertices)
- [`new`](#function-new)
- [`id`](#function-id)
- [`ink_points`](#function-ink_points)
- [`get_ink_points`](#function-get_ink_points)
- [`drawing_attributes`](#function-drawing_attributes)
- [`set_drawing_attributes`](#function-set_drawing_attributes)
- [`selected`](#function-selected)
- [`set_selected`](#function-set_selected)
- [`point_transform`](#function-point_transform)
- [`set_point_transform`](#function-set_point_transform)
- [`clone_stroke`](#function-clone_stroke)
- [`changed`](#function-changed)
- [`rendering_points`](#function-rendering_points)
- [`outline_polygons`](#function-outline_polygons)
- [`bounding_rect`](#function-bounding_rect)
- [`hit_test_segment`](#function-hit_test_segment)

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

### MAX_RENDERED_VERTICES

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

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

### new

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



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

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

### id

```rust
fn id(self: &Self) -> u32
```



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

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

### ink_points

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



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

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

### get_ink_points

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



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

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

### drawing_attributes

```rust
fn drawing_attributes(self: &Self) -> InkDrawingAttributes
```



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

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

### set_drawing_attributes

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



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

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

### selected

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



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

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

### set_selected

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



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

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

### point_transform

```rust
fn point_transform(self: &Self) -> Matrix
```



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

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

### set_point_transform

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



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

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

### clone_stroke

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

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

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

<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.rs#L212)

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

### rendering_points

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

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

### outline_polygons

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

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

### bounding_rect

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

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

### hit_test_segment

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

## 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/).
