class LayerProperties

Defined at line 4705 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/cpp/fidl/fuchsia.ui.composition/cpp/natural_types.h

Stateful properties associated with a Layer.

All fields are sticky: [`SetLayerProperties`] merges the provided table into the

layer's stored properties, and stored values persist across [`SetLayerImage`] calls

and across composition mode changes. Fields not used by the current composition mode

keep their values, and take effect again when a mode that uses them is re-entered.

Nothing is cleared implicitly; [`ResetLayer`] is the only operation that forgets

stored properties.

**Hints (Safety and Performance Semantics)**:

Hints (such as [`hint_damage_rects`] and [`hint_visible_rects`]) are optional

optimization details provided by the client.

* **Ignorable by Design**: The implementation is free to ignore these hints. If ignored,

rendering remains fully correct, though possibly less optimal.

* **Correct Hints**: Yield the identical visual result but may improve performance (e.g.,

by allowing composition shortcuts or partial updates).

* **Incorrect Hints**: May result in rendering artifacts, stale regions, or incorrect

pixels on the display, as the implementation might optimize based on false assumptions.

Public Methods

void LayerProperties (Storage_ storage)
void LayerProperties ()

Defined at line 4710 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/cpp/fidl/fuchsia.ui.composition/cpp/natural_types.h

void LayerProperties (LayerProperties && )

Defined at line 4711 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/cpp/fidl/fuchsia.ui.composition/cpp/natural_types.h

void LayerProperties (const LayerProperties & other)
const std::optional< ::fuchsia_math::RectU> & display_rect ()

The rectangle where the layer content will be displayed in its local coordinate space.

For image layers, visual properties are applied in the following order:

1. **Sample**: The region specified by `sample_rect` is extracted from the image.

2. **Transform**: The sampled region is flipped and rotated as specified by `transform`.

3. **Scale/Fit**: Transformed content is implicitly scaled to fit the `display_rect`.

Hardware image scaling is requested implicitly when the dimensions of the transformed

`sample_rect` differ from the extent of the `display_rect`. Not all display hardware supports

scaling, or may have limitations.

The dimensions of `display_rect` must account for image dimension changes caused by rotations

to avoid implicit scaling or distortion. For example, rotating a 600x300 pixel region

by 90 degrees would require specifying 300x600 dimensions here to maintain the aspect ratio.

**Note**: This rectangle is specified in the local space of the LayerStack (or the Transform

the LayerStack is attached to). Any scaling applied by parent transforms in the Flatland scene

graph will further affect the final size on the physical display.

Default: (0,0,0,0). The layer will not be visible until a rectangle with non-zero

width and height is set.

::std::optional< ::fuchsia_math::RectU> & display_rect ()

The rectangle where the layer content will be displayed in its local coordinate space.

For image layers, visual properties are applied in the following order:

1. **Sample**: The region specified by `sample_rect` is extracted from the image.

2. **Transform**: The sampled region is flipped and rotated as specified by `transform`.

3. **Scale/Fit**: Transformed content is implicitly scaled to fit the `display_rect`.

Hardware image scaling is requested implicitly when the dimensions of the transformed

`sample_rect` differ from the extent of the `display_rect`. Not all display hardware supports

scaling, or may have limitations.

The dimensions of `display_rect` must account for image dimension changes caused by rotations

to avoid implicit scaling or distortion. For example, rotating a 600x300 pixel region

by 90 degrees would require specifying 300x600 dimensions here to maintain the aspect ratio.

**Note**: This rectangle is specified in the local space of the LayerStack (or the Transform

the LayerStack is attached to). Any scaling applied by parent transforms in the Flatland scene

graph will further affect the final size on the physical display.

Default: (0,0,0,0). The layer will not be visible until a rectangle with non-zero

width and height is set.

LayerProperties & display_rect (std::optional< ::fuchsia_math::RectU> value)

The rectangle where the layer content will be displayed in its local coordinate space.

For image layers, visual properties are applied in the following order:

1. **Sample**: The region specified by `sample_rect` is extracted from the image.

2. **Transform**: The sampled region is flipped and rotated as specified by `transform`.

3. **Scale/Fit**: Transformed content is implicitly scaled to fit the `display_rect`.

Hardware image scaling is requested implicitly when the dimensions of the transformed

`sample_rect` differ from the extent of the `display_rect`. Not all display hardware supports

scaling, or may have limitations.

The dimensions of `display_rect` must account for image dimension changes caused by rotations

to avoid implicit scaling or distortion. For example, rotating a 600x300 pixel region

by 90 degrees would require specifying 300x600 dimensions here to maintain the aspect ratio.

**Note**: This rectangle is specified in the local space of the LayerStack (or the Transform

the LayerStack is attached to). Any scaling applied by parent transforms in the Flatland scene

graph will further affect the final size on the physical display.

Default: (0,0,0,0). The layer will not be visible until a rectangle with non-zero

width and height is set.

const std::optional<float> & opacity ()

The opacity of the layer, in the range [0..1].

Multiplies with opacity inherited from `Transform`s above the layer's `LayerStack`

(see [`fuchsia.ui.composition/Flatland.SetOpacity`]) to give the layer's *effective

opacity*. The layer renders as if its content's own alpha (image pixels' alpha, or

`color.alpha` for a solid-color layer) were scaled by the effective opacity; since

this requires blending, a `REPLACE` layer with effective opacity below 1.0 renders

as `PREMULTIPLIED_ALPHA` (see [`blend_mode`]). A layer with effective opacity 0.0

is invisible.

Default: 1.0 (the content's own alpha applies unmodified).

::std::optional<float> & opacity ()

The opacity of the layer, in the range [0..1].

Multiplies with opacity inherited from `Transform`s above the layer's `LayerStack`

(see [`fuchsia.ui.composition/Flatland.SetOpacity`]) to give the layer's *effective

opacity*. The layer renders as if its content's own alpha (image pixels' alpha, or

`color.alpha` for a solid-color layer) were scaled by the effective opacity; since

this requires blending, a `REPLACE` layer with effective opacity below 1.0 renders

as `PREMULTIPLIED_ALPHA` (see [`blend_mode`]). A layer with effective opacity 0.0

is invisible.

Default: 1.0 (the content's own alpha applies unmodified).

LayerProperties & opacity (std::optional<float> value)

The opacity of the layer, in the range [0..1].

Multiplies with opacity inherited from `Transform`s above the layer's `LayerStack`

(see [`fuchsia.ui.composition/Flatland.SetOpacity`]) to give the layer's *effective

opacity*. The layer renders as if its content's own alpha (image pixels' alpha, or

`color.alpha` for a solid-color layer) were scaled by the effective opacity; since

this requires blending, a `REPLACE` layer with effective opacity below 1.0 renders

as `PREMULTIPLIED_ALPHA` (see [`blend_mode`]). A layer with effective opacity 0.0

is invisible.

Default: 1.0 (the content's own alpha applies unmodified).

const std::optional< ::fuchsia_ui_composition::BlendMode2> & blend_mode ()

The blend mode used to composite the layer over the content beneath it.

`REPLACE` is honored only while the layer's effective opacity is 1.0 (see [`opacity`]);

at lower effective opacity the layer renders as `PREMULTIPLIED_ALPHA`, so that opacity

always fades the layer. To write exact sub-unity alpha values into the output (e.g.

punching a hole for an underlay), author them in the content itself (the image's own

pixels, or `color.alpha` for a solid-color layer) and leave `opacity` at 1.0.

`STRAIGHT_ALPHA` names a content *encoding*, and is meaningful for image

content. A solid-color layer's encoding is fixed by the API (`color` is straight

RGBA regardless of `blend_mode`), so for solid-color content `STRAIGHT_ALPHA` is

accepted and composites identically to `PREMULTIPLIED_ALPHA`.

Default: `BlendMode2.REPLACE`.

::std::optional< ::fuchsia_ui_composition::BlendMode2> & blend_mode ()

The blend mode used to composite the layer over the content beneath it.

`REPLACE` is honored only while the layer's effective opacity is 1.0 (see [`opacity`]);

at lower effective opacity the layer renders as `PREMULTIPLIED_ALPHA`, so that opacity

always fades the layer. To write exact sub-unity alpha values into the output (e.g.

punching a hole for an underlay), author them in the content itself (the image's own

pixels, or `color.alpha` for a solid-color layer) and leave `opacity` at 1.0.

`STRAIGHT_ALPHA` names a content *encoding*, and is meaningful for image

content. A solid-color layer's encoding is fixed by the API (`color` is straight

RGBA regardless of `blend_mode`), so for solid-color content `STRAIGHT_ALPHA` is

accepted and composites identically to `PREMULTIPLIED_ALPHA`.

Default: `BlendMode2.REPLACE`.

LayerProperties & blend_mode (std::optional< ::fuchsia_ui_composition::BlendMode2> value)

The blend mode used to composite the layer over the content beneath it.

`REPLACE` is honored only while the layer's effective opacity is 1.0 (see [`opacity`]);

at lower effective opacity the layer renders as `PREMULTIPLIED_ALPHA`, so that opacity

always fades the layer. To write exact sub-unity alpha values into the output (e.g.

punching a hole for an underlay), author them in the content itself (the image's own

pixels, or `color.alpha` for a solid-color layer) and leave `opacity` at 1.0.

`STRAIGHT_ALPHA` names a content *encoding*, and is meaningful for image

content. A solid-color layer's encoding is fixed by the API (`color` is straight

RGBA regardless of `blend_mode`), so for solid-color content `STRAIGHT_ALPHA` is

accepted and composites identically to `PREMULTIPLIED_ALPHA`.

Default: `BlendMode2.REPLACE`.

const std::optional< ::fuchsia_ui_composition::ColorRgba> & color ()

The color to fill the layer with, as straight (non-premultiplied) RGBA regardless

of `blend_mode`. The compositor performs any conversion needed for rendering.

Default: opaque white (1.0, 1.0, 1.0, 1.0).

::std::optional< ::fuchsia_ui_composition::ColorRgba> & color ()

The color to fill the layer with, as straight (non-premultiplied) RGBA regardless

of `blend_mode`. The compositor performs any conversion needed for rendering.

Default: opaque white (1.0, 1.0, 1.0, 1.0).

LayerProperties & color (std::optional< ::fuchsia_ui_composition::ColorRgba> value)

The color to fill the layer with, as straight (non-premultiplied) RGBA regardless

of `blend_mode`. The compositor performs any conversion needed for rendering.

Default: opaque white (1.0, 1.0, 1.0, 1.0).

LayerProperties & operator= (LayerProperties && )

Defined at line 4712 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/cpp/fidl/fuchsia.ui.composition/cpp/natural_types.h

LayerProperties & operator= (const LayerProperties & other)
bool operator== (const LayerProperties & other)
bool operator!= (const LayerProperties & other)
bool IsEmpty ()
const std::optional< ::fuchsia_math::RectF> & sample_rect ()

Describes the region inside the image to sample from, in unnormalized coordinates

(rect width/height match image width/height).

Default: (0,0,0,0), which is interpreted as the entire image region. A client can

reset to the full image by setting this field to (0,0,0,0).

Must lie within the bounds of the bound image. This is checked during

[`fuchsia.ui.composition/Flatland.Present`], and only for layers whose

`composition_mode` is `IMAGE`, so the order of calls within a batch does not

matter: a rect and an image of matching size may be set in either order, and a

rect set while no image is bound (or while another mode is in effect) is stored

without complaint. A violation at `Present` closes the connection with

`BAD_OPERATION`.

::std::optional< ::fuchsia_math::RectF> & sample_rect ()

Describes the region inside the image to sample from, in unnormalized coordinates

(rect width/height match image width/height).

Default: (0,0,0,0), which is interpreted as the entire image region. A client can

reset to the full image by setting this field to (0,0,0,0).

Must lie within the bounds of the bound image. This is checked during

[`fuchsia.ui.composition/Flatland.Present`], and only for layers whose

`composition_mode` is `IMAGE`, so the order of calls within a batch does not

matter: a rect and an image of matching size may be set in either order, and a

rect set while no image is bound (or while another mode is in effect) is stored

without complaint. A violation at `Present` closes the connection with

`BAD_OPERATION`.

LayerProperties & sample_rect (std::optional< ::fuchsia_math::RectF> value)

Describes the region inside the image to sample from, in unnormalized coordinates

(rect width/height match image width/height).

Default: (0,0,0,0), which is interpreted as the entire image region. A client can

reset to the full image by setting this field to (0,0,0,0).

Must lie within the bounds of the bound image. This is checked during

[`fuchsia.ui.composition/Flatland.Present`], and only for layers whose

`composition_mode` is `IMAGE`, so the order of calls within a batch does not

matter: a rect and an image of matching size may be set in either order, and a

rect set while no image is bound (or while another mode is in effect) is stored

without complaint. A violation at `Present` closes the connection with

`BAD_OPERATION`.

const std::optional< ::fuchsia_ui_composition::FlipThenRotate> & transform ()

Specifies image transform.

Default: No transformation (identity).

::std::optional< ::fuchsia_ui_composition::FlipThenRotate> & transform ()

Specifies image transform.

Default: No transformation (identity).

LayerProperties & transform (std::optional< ::fuchsia_ui_composition::FlipThenRotate> value)

Specifies image transform.

Default: No transformation (identity).

const std::optional< ::std::vector< ::fuchsia_math::RectU>> & hint_damage_rects ()

A hint describing the region of the source image that has changed since the last frame.

Specified in the coordinate space of the source image (buffer).

Default: Empty vector (interpreted as the entire sample rect being damaged).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

::std::optional< ::std::vector< ::fuchsia_math::RectU>> & hint_damage_rects ()

A hint describing the region of the source image that has changed since the last frame.

Specified in the coordinate space of the source image (buffer).

Default: Empty vector (interpreted as the entire sample rect being damaged).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

LayerProperties & hint_damage_rects (std::optional< ::std::vector< ::fuchsia_math::RectU>> value)

A hint describing the region of the source image that has changed since the last frame.

Specified in the coordinate space of the source image (buffer).

Default: Empty vector (interpreted as the entire sample rect being damaged).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

const std::optional< ::std::vector< ::fuchsia_math::RectU>> & hint_visible_rects ()

A hint describing the visible region of the layer on the screen.

Specified in the local coordinate space of the Layer (matching `display_rect`).

Default: Empty vector (interpreted as the entire `display_rect` being visible).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

::std::optional< ::std::vector< ::fuchsia_math::RectU>> & hint_visible_rects ()

A hint describing the visible region of the layer on the screen.

Specified in the local coordinate space of the Layer (matching `display_rect`).

Default: Empty vector (interpreted as the entire `display_rect` being visible).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

LayerProperties & hint_visible_rects (std::optional< ::std::vector< ::fuchsia_math::RectU>> value)

A hint describing the visible region of the layer on the screen.

Specified in the local coordinate space of the Layer (matching `display_rect`).

Default: Empty vector (interpreted as the entire `display_rect` being visible).

Refer to [`LayerProperties`] for the general safety and performance semantics of hints.

const std::optional< ::fuchsia_ui_composition::CompositionMode> & composition_mode ()

Selects which of the property groups above is in effect; see [`CompositionMode`].

Default: `CompositionMode.INVISIBLE`.

::std::optional< ::fuchsia_ui_composition::CompositionMode> & composition_mode ()

Selects which of the property groups above is in effect; see [`CompositionMode`].

Default: `CompositionMode.INVISIBLE`.

LayerProperties & composition_mode (std::optional< ::fuchsia_ui_composition::CompositionMode> value)

Selects which of the property groups above is in effect; see [`CompositionMode`].

Default: `CompositionMode.INVISIBLE`.

void LayerProperties (::fidl::internal::DefaultConstructPossiblyInvalidObjectTag )

Friends

class MemberVisitor
class NaturalTableCodingTraits