# CompositionVisualSurface

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/struct-compositionvisualsurface/

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

```rust
struct CompositionVisualSurface
```

A live image of the subtree of a visual, shown by a surface brush
(WinUI `Microsoft.UI.Composition.CompositionVisualSurface`).

The surface shows the area `(source_offset, source_size)` of
`source_visual`, in the coordinates of the source; a zero `source_size`
is the size of the source visual. The subtree is rendered as a bitmap
cache renders it: the visibility, opacity, transform and clip of the
source visual itself are ignored, so a hidden source still shows (the
connected animation hides its elements and shows them through visual
surfaces). Changes of the subtree are followed while the source is
attached to a composition target.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L23)

## Members

- [`compositor`](#function-compositor)
- [`object`](#function-object)
- [`is_disposed`](#function-is_disposed)
- [`dispose`](#function-dispose)
- [`source_visual`](#function-source_visual)
- [`set_source_visual`](#function-set_source_visual)
- [`source_offset`](#function-source_offset)
- [`set_source_offset`](#function-set_source_offset)
- [`source_size`](#function-source_size)
- [`set_source_size`](#function-set_source_size)
- [`freeze`](#function-freeze)

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

### compositor

```rust
fn compositor(self: &Self) -> &Rc<Compositor>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L44)

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

### object

```rust
fn object(self: &Self) -> &CompositionObject
```

The embedded `CompositionObject`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L49)

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

### is_disposed

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L58)

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

### dispose

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L62)

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

### source_visual

```rust
fn source_visual(self: &Self) -> Option<Rc<CompositionVisual>>
```

The visual whose subtree the surface shows.

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

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

### set_source_visual

```rust
fn set_source_visual(self: &Self, value: Option<Rc<CompositionVisual>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L76)

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

### source_offset

```rust
fn source_offset(self: &Self) -> Vector
```

The top left corner of the area shown, in the coordinates of the
source visual (WinUI `Vector2`; animatable as `SourceOffset`).

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

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

### set_source_offset

```rust
fn set_source_offset(self: &Self, value: Vector)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L86)

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

### source_size

```rust
fn source_size(self: &Self) -> Vector
```

The size of the area shown; zero for the size of the source visual
(WinUI `Vector2`; animatable as `SourceSize`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L92)

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

### set_source_size

```rust
fn set_source_size(self: &Self, value: Vector)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L96)

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

### freeze

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

Freezes the surface: the frame that applies the next batch renders
the source into an offscreen layer once, and the surface shows that
image from then on, whatever happens to the source.

Not a public member in WinUI, where the connected animation freezes
its snapshot surface internally. Best effort: the image is rendered
with the bounds of the source subtree as of the last rendered frame.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/composition_visual_surface.rs#L107)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `CompositionVisualSurfaceHooks`
- [`ICompositionSurface`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-icompositionsurface/)
- `IRegisterForSerialization`
- `ICompositionObjectHost`
- [`ICompositionObjectAnimations`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-icompositionobjectanimations/)
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)
- `ICompositionObject`
- `ICompositorSerializable`

## Availability

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