class LayerProperties
Defined at line 4068 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.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 Members
static const fidl_type_t * FidlType
Public Methods
bool IsEmpty ()
Returns whether no field is set.
void LayerProperties ()
void LayerProperties (LayerProperties && other)
const ::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.
Defined at line 4095 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_display_rect ()
Defined at line 4099 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::math::RectU * mutable_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.
Defined at line 4124 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_display_rect ()
Defined at line 4132 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const 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).
Defined at line 4151 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_opacity ()
Defined at line 4155 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
float * mutable_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).
Defined at line 4170 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_opacity ()
Defined at line 4178 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::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`.
Defined at line 4200 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_blend_mode ()
Defined at line 4204 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::ui::composition::BlendMode2 * mutable_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`.
Defined at line 4222 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_blend_mode ()
Defined at line 4230 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::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).
Defined at line 4242 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_color ()
Defined at line 4246 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::ui::composition::ColorRgba * mutable_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).
Defined at line 4254 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_color ()
Defined at line 4262 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::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`.
Defined at line 4283 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_sample_rect ()
Defined at line 4287 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::math::RectF * mutable_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`.
Defined at line 4304 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_sample_rect ()
Defined at line 4312 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_transform ()
Defined at line 4327 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::ui::composition::FlipThenRotate * mutable_transform ()
Specifies image transform.
Default: No transformation (identity).
Defined at line 4334 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_transform ()
Defined at line 4342 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::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.
Defined at line 4356 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_hint_damage_rects ()
Defined at line 4360 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::std::vector< ::fuchsia::math::RectU> * mutable_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.
Defined at line 4370 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_hint_damage_rects ()
Defined at line 4378 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::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.
Defined at line 4392 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_hint_visible_rects ()
Defined at line 4396 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::std::vector< ::fuchsia::math::RectU> * mutable_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.
Defined at line 4406 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_hint_visible_rects ()
Defined at line 4414 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
const ::fuchsia::ui::composition::CompositionMode & composition_mode ()
Selects which of the property groups above is in effect; see [`CompositionMode`].
Default: `CompositionMode.INVISIBLE`.
Defined at line 4425 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
bool has_composition_mode ()
Defined at line 4429 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
::fuchsia::ui::composition::CompositionMode * mutable_composition_mode ()
Selects which of the property groups above is in effect; see [`CompositionMode`].
Default: `CompositionMode.INVISIBLE`.
Defined at line 4436 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void clear_composition_mode ()
Defined at line 4444 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
LayerProperties & set_display_rect (::fuchsia::math::RectU _value)
LayerProperties & set_opacity (float _value)
LayerProperties & set_blend_mode (::fuchsia::ui::composition::BlendMode2 _value)
LayerProperties & set_color (::fuchsia::ui::composition::ColorRgba _value)
LayerProperties & set_sample_rect (::fuchsia::math::RectF _value)
LayerProperties & set_transform (::fuchsia::ui::composition::FlipThenRotate _value)
LayerProperties & set_hint_damage_rects (::std::vector< ::fuchsia::math::RectU> _value)
LayerProperties & set_hint_visible_rects (::std::vector< ::fuchsia::math::RectU> _value)
LayerProperties & set_composition_mode (::fuchsia::ui::composition::CompositionMode _value)
const ::fuchsia::ui::composition::FlipThenRotate & transform ()
Specifies image transform.
Default: No transformation (identity).
Defined at line 4323 of file fidling/gen/sdk/fidl/fuchsia.ui.composition/fuchsia.ui.composition/hlcpp/fuchsia/ui/composition/cpp/fidl.h
void ~LayerProperties ()
LayerProperties & operator= (LayerProperties && other)
::std::unique_ptr<LayerProperties> New ()
void Encode (::fidl::Encoder *_encoder,size_t_offset,std::optional< ::fidl::HandleInformation>maybe_handle_info)
void Decode (::fidl::Decoder *_decoder,LayerProperties *_value,size_t_offset)
zx_status_t Clone (LayerProperties * _result)