# IPen

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/trait-ipen/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait IPen: 'static
```

Describes how a stroke is drawn.

Implemented by [`ImmutablePen`](/docs/0.5.0/api/ferroui-base/media/immutable/struct-immutablepen/) and, through an adapter, by handles ([`Ref`](/docs/0.5.0/api/ferroui-base/struct-ref/)) of [`Pen`](/docs/0.5.0/api/ferroui-base/media/struct-pen/).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L11)

## Members

- [`brush`](#function-brush)
- [`dash_style`](#function-dash_style)
- [`line_cap`](#function-line_cap)
- [`line_join`](#function-line_join)
- [`miter_limit`](#function-miter_limit)
- [`thickness`](#function-thickness)
- [`as_any`](#function-as_any)
- [`as_immutable_pen`](#function-as_immutable_pen)
- [`as_object`](#function-as_object)
- [`into_immutable_pen`](#function-into_immutable_pen)
- [`to_shared`](#function-to_shared)
- [`equals`](#function-equals)

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

### brush

```rust
fn brush(self: &Self) -> Option<Rc<dyn IBrush>>
```

The brush used to draw the stroke.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L13)

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

### dash_style

```rust
fn dash_style(self: &Self) -> Option<Rc<dyn IDashStyle>>
```

The style of dashed lines drawn with the pen.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L16)

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

### line_cap

```rust
fn line_cap(self: &Self) -> PenLineCap
```

The type of shape to use on both ends of a line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L19)

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

### line_join

```rust
fn line_join(self: &Self) -> PenLineJoin
```

A value describing how to join consecutive line or curve segments.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L22)

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

### miter_limit

```rust
fn miter_limit(self: &Self) -> f64
```

The limit of the ratio of the miter length to half this pen's
thickness.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L26)

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

### thickness

```rust
fn thickness(self: &Self) -> f64
```

The stroke thickness.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L29)

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

### as_any

```rust
fn as_any(self: &Self) -> &dyn Any
```

The implementing value, for downcasts to `ImmutablePen`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L32)

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

### as_immutable_pen

```rust
fn as_immutable_pen(self: &Self) -> Option<&ImmutablePen>
```

The pen viewed as an `ImmutablePen`, when it is one (the `is
ImmutablePen` test of upstream, which a class deriving from it
passes).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L37)

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

### as_object

```rust
fn as_object(self: &Self) -> Option<&FerroObject>
```

The object behind the pen when it is a mutable `Pen`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L42)

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

### into_immutable_pen

```rust
fn into_immutable_pen(self: Rc<Self>) -> Rc<ImmutablePen>
```

Converts the pen to an immutable pen; an immutable pen returns itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L56)

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

### to_shared

```rust
fn to_shared(self: &Self) -> Option<crate::media::SharedPen>
```

The form of the pen that is sent to the render thread, when the
type keeps one: see `SharedPen`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L60)

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

### equals

```rust
fn equals(self: &Self, other: &dyn IPen) -> bool
```

Whether the pen equals `other`. Mutable pens compare by reference,
immutable ones structurally (against any pen).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/i_pen.rs#L72)

## Trait implementations

- [`IPen`](/docs/0.5.0/api/ferroui-base/media/trait-ipen/)

## Availability

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