# ElementComposition

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

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

```rust
struct ElementComposition
```

Access to the composition visuals of the visuals of the visual tree.

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

## Members

- [`get_element_visual`](#function-get_element_visual)
- [`set_element_child_visual`](#function-set_element_child_visual)
- [`get_element_child_visual`](#function-get_element_child_visual)
- [`set_is_translation_enabled`](#function-set_is_translation_enabled)
- [`is_translation_enabled`](#function-is_translation_enabled)

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

### get_element_visual

```rust
fn get_element_visual(visual: &Visual) -> Option<Rc<CompositionVisual>>
```

Gets the composition visual of a visual; `None` while the visual is
not attached to a compositor.

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

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

### set_element_child_visual

```rust
fn set_element_child_visual(visual: &Visual, composition_visual: Option<Rc<CompositionVisual>>)
```

Sets a composition visual that is shown as the last child of the
composition visual of `visual`.

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

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

### get_element_child_visual

```rust
fn get_element_child_visual(visual: &Visual) -> Option<Rc<CompositionVisual>>
```

Gets the composition visual set with
`set_element_child_visual`.

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

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

### set_is_translation_enabled

```rust
fn set_is_translation_enabled(visual: &Visual, value: bool)
```

`ElementCompositionPreview.SetIsTranslationEnabled`. Every composition visual has a
`Translation` property applied after its other transforms, so translation is always
enabled; the request is recorded and changes nothing else.

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

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

### is_translation_enabled

```rust
fn is_translation_enabled(visual: &Visual) -> bool
```

Whether `set_is_translation_enabled` was called with
`true` for `visual`.

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

## 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`

## Availability

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