# DrawingImage

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-drawingimage/

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

```rust
struct DrawingImage
```

An image that uses a [`Drawing`](/docs/0.5.0/api/ferroui-base/media/struct-drawing/) for content.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`drawing_property`](#function-drawing_property)
- [`viewbox_property`](#function-viewbox_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`with_drawing`](#function-with_drawing)
- [`invalidated`](#function-invalidated)
- [`raise_invalidated`](#function-raise_invalidated)
- [`drawing`](#function-drawing)
- [`set_drawing`](#function-set_drawing)
- [`viewbox`](#function-viewbox)
- [`set_viewbox`](#function-set_viewbox)
- [`size`](#function-size)
- [`draw`](#function-draw)

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

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

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

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<DrawingImage>
```

Returns a strong reference to this object.

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

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

### drawing_property

```rust
fn drawing_property() -> &'static StyledProperty<Option<Ref<Drawing>>>
```

Defines the `Drawing` property.

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

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

### viewbox_property

```rust
fn viewbox_property() -> &'static StyledProperty<Option<Rect>>
```

Defines the `Viewbox` property.

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

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

### construct

```rust
fn construct() -> Self
```

Creates the class data.

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

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

### new

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



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

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

### with_drawing

```rust
fn with_drawing(drawing: impl Into<Nullable<Drawing>>) -> Ref<Self>
```

Creates an image showing `drawing`.

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

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

### invalidated

```rust
fn invalidated(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
```

Raised when the image changes. Dropping the returned guard removes the
handler; `Subscription::detach` keeps it for the life of the image.

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

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

### raise_invalidated

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

Raises the invalidated notification.

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

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

### drawing

```rust
fn drawing(self: &Self) -> Option<Ref<Drawing>>
```

The drawing content.

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

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

### set_drawing

```rust
fn set_drawing(self: &Self, value: impl Into<Nullable<Drawing>>)
```



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

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

### viewbox

```rust
fn viewbox(self: &Self) -> Option<Rect>
```

A rectangular region of the drawing, in device independent pixels, to
display when rendering this image.

This value can be used to display only part of the drawing, or to
surround it with empty space. If `None`, the bounds of the drawing
are used.

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

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

### set_viewbox

```rust
fn set_viewbox(self: &Self, value: Option<Rect>)
```



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

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

### size

```rust
fn size(self: &Self) -> Size
```

The size of the image, in device independent pixels.

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

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

### draw

```rust
fn draw(self: &Self, context: &mut DrawingContext<'_>, source_rect: Rect, dest_rect: Rect)
```

Draws the part of the drawing inside `source_rect` into `dest_rect`.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<DrawingImage>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`IAffectsRender`](/docs/0.5.0/api/ferroui-base/media/trait-iaffectsrender/)

## Availability

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