# CompositionLight

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

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

```rust
struct CompositionLight
```

A light (WinUI `Microsoft.UI.Composition.CompositionLight`): it lights
the visuals of `targets` and their subtrees, minus the
visuals of `exclusions_from_targets`
and their subtrees, while it `is_enabled`. A visual
that some enabled light reaches shows its content multiplied by the sum
of the lights that reach it, so it is dark where none of them shines.

Deviation (winui-composition.md): the lighting is a light map drawn over
the content of each lit visual, see `server::LitContent`.

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

## Members

- [`compositor`](#function-compositor)
- [`object`](#function-object)
- [`is_disposed`](#function-is_disposed)
- [`dispose`](#function-dispose)
- [`type_name`](#function-type_name)
- [`targets`](#function-targets)
- [`exclusions_from_targets`](#function-exclusions_from_targets)
- [`set_xaml_binding`](#function-set_xaml_binding)
- [`xaml_id`](#function-xaml_id)
- [`is_enabled`](#function-is_enabled)
- [`set_is_enabled`](#function-set_is_enabled)

<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_light.rs#L188)

<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_light.rs#L193)

<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_light.rs#L202)

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

### dispose

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

Disposes the light and its two collections: the visuals it lit are
drawn without it from the next frame.

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

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

### type_name

```rust
fn type_name(self: &Self) -> &'static str
```

The name of the concrete class, for messages.

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

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

### targets

```rust
fn targets(self: &Self) -> &Rc<VisualUnorderedCollection>
```

`Targets`: the visuals the light lights, with their subtrees.

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

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

### exclusions_from_targets

```rust
fn exclusions_from_targets(self: &Self) -> &Rc<VisualUnorderedCollection>
```

`ExclusionsFromTargets`: the visuals, with their subtrees, the light
does not light although they are in the subtree of a target.

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

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

### set_xaml_binding

```rust
fn set_xaml_binding(self: &Self, id: Option<String>, scope: Option<Rc<CompositionVisual>>)
```

Binds the light to a XAML light (`XamlLight.CompositionLight`): the
light then also lights the XAML brushes that target the id `id`
(`XamlLight.AddTargetBrush`) where they are drawn in the subtree of
`scope`, the visual of the element whose `Lights` holds the XAML
light. `None` unbinds it. Called by `XamlLight`.

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

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

### xaml_id

```rust
fn xaml_id(self: &Self) -> Option<String>
```

The id of the XAML light the light is bound to, if any.

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

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

### is_enabled

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

`IsEnabled` (default `true`): a disabled light lights nothing, and
the visuals it targets are drawn as if it did not exist.

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

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

### set_is_enabled

```rust
fn set_is_enabled(self: &Self, value: bool)
```



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

## 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`
- `CompositionLightHooks`
- `AmbientLightHooks`
- `DistantLightHooks`
- `PointLightHooks`
- `SpotLightHooks`
- `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/).
