# VisualImpl

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

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

```rust
trait VisualImpl: StyledElementImpl + $crate::Upcast<Visual>
```

The overridable members introduced by the class.

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

## Members

- [`render`](#function-render)
- [`on_attached_to_visual_tree_core`](#function-on_attached_to_visual_tree_core)
- [`on_detached_from_visual_tree_core`](#function-on_detached_from_visual_tree_core)
- [`on_attached_to_visual_tree`](#function-on_attached_to_visual_tree)
- [`on_detached_from_visual_tree`](#function-on_detached_from_visual_tree)
- [`on_visual_parent_changed`](#function-on_visual_parent_changed)
- [`bypass_flow_direction_policies`](#function-bypass_flow_direction_policies)
- [`invalidate_mirror_transform`](#function-invalidate_mirror_transform)
- [`clip_to_bounds_radius`](#function-clip_to_bounds_radius)
- [`custom_hit_test`](#function-custom_hit_test)
- [`custom_hit_test_geometry`](#function-custom_hit_test_geometry)
- [`ensure_initialized_for_visual_brush`](#function-ensure_initialized_for_visual_brush)
- [`detach_from_compositor`](#function-detach_from_compositor)
- [`synchronize_composition_child_visuals`](#function-synchronize_composition_child_visuals)
- [`synchronize_composition_properties`](#function-synchronize_composition_properties)
- [`requires_composition_visual`](#function-requires_composition_visual)

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

### render

```rust
fn render(this: &Self, context: &mut DrawingContext<'_>)
```

Renders the visual to a drawing context.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### on_attached_to_visual_tree_core

```rust
fn on_attached_to_visual_tree_core(this: &Self, e: &VisualTreeAttachmentEventArgs)
```

Calls the `on_attached_to_visual_tree` method for this control and
all of its visual descendants.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### on_detached_from_visual_tree_core

```rust
fn on_detached_from_visual_tree_core(this: &Self, e: &VisualTreeAttachmentEventArgs)
```

Calls the `on_detached_from_visual_tree` method for this control
and all of its visual descendants.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### on_attached_to_visual_tree

```rust
fn on_attached_to_visual_tree(this: &Self, e: &VisualTreeAttachmentEventArgs)
```

Called when the control is added to a rooted visual tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### on_detached_from_visual_tree

```rust
fn on_detached_from_visual_tree(this: &Self, e: &VisualTreeAttachmentEventArgs)
```

Called when the control is removed from a rooted visual tree.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### on_visual_parent_changed

```rust
fn on_visual_parent_changed(this: &Self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>)
```

Called when the control's visual parent changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### bypass_flow_direction_policies

```rust
fn bypass_flow_direction_policies(this: &Self) -> bool
```

Whether the control ignores the flow direction policies, i.e. is
never mirrored.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### invalidate_mirror_transform

```rust
fn invalidate_mirror_transform(this: &Self)
```

Computes the `has_mirror_transform` value according to the flow
direction of this visual and its parent.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### clip_to_bounds_radius

```rust
fn clip_to_bounds_radius(this: &Self) -> Option<crate::CornerRadius>
```

The corner radius the visual clips its content with when
`clip_to_bounds` is set; `None` for a plain rectangular clip.
(Upstream: the `IVisualWithRoundRectClip` interface.)

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### custom_hit_test

```rust
fn custom_hit_test(this: &Self, point: crate::Point) -> Option<bool>
```

The custom hit test of the visual at a point in its own
coordinates; `None` when the visual has none and is hit by what
it occupies or draws. (Upstream: the `ICustomHitTest` interface;
a class implementing it overrides this and the geometry form.)

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### custom_hit_test_geometry

```rust
fn custom_hit_test_geometry(this: &Self, geometry: &Ref<crate::media::Geometry>) -> Option<crate::media::IntersectionResult>
```

The custom hit test of the visual against a geometry in its own
coordinates; `None` when the visual has none.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### ensure_initialized_for_visual_brush

```rust
fn ensure_initialized_for_visual_brush(this: &Self)
```

Ensures that the visual is ready to use as the visual in a
visual brush. (Upstream: the `IVisualBrushInitialize` interface;
a class implementing it overrides this.)

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### detach_from_compositor

```rust
fn detach_from_compositor(this: &Self)
```

Releases the composition visual of the visual.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### synchronize_composition_child_visuals

```rust
fn synchronize_composition_child_visuals(this: &Self)
```

Makes the children of the composition visual match the visual
children (in Z order) and the child composition visual.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### synchronize_composition_properties

```rust
fn synchronize_composition_properties(this: &Self)
```

Copies the properties of the visual to its composition visual.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

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

### requires_composition_visual

```rust
fn requires_composition_visual(this: &Self) -> bool
```

Whether the visual has a composition visual of its own whatever it draws: a class
whose `create_composition_visual` makes a
composition visual that shows something itself says so here. Any other visual gets
its composition visual once it sets something the compositor applies, or is asked
for it (docs/porting/desktop-performance.md, section 9.41); until then what it draws
is an item of the composition visual of the nearest visual above it that has one
(section 9.42).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/visual.rs#L189)

## Trait implementations

- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)

## Availability

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