pub struct Flatland2Proxy { /* private fields */ }Implementations§
Source§impl Flatland2Proxy
impl Flatland2Proxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.ui.composition/Flatland2.
Sourcepub fn take_event_stream(&self) -> Flatland2EventStream
pub fn take_event_stream(&self) -> Flatland2EventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn create_layer(&self, layer_id: &LayerId) -> Result<(), Error>
pub fn create_layer(&self, layer_id: &LayerId) -> Result<(), Error>
A Layer is a type of Content that composites either a single Image or a solid
color. It separates visual properties (such as size, flip, opacity, and blending)
from the raw pixel data.
Unlike typical Content items which represent a static visual resource, a Layer is designed
to be a dynamic container for an image sequence. Typical usage involves setting the layer’s
visual properties and image metadata infrequently, and then rapidly swapping the active
Image (e.g. on every frame) with another image of matching metadata.
This separation allows a single Image resource to be reused across multiple layers with
different visual configurations simultaneously.
To use a Layer:
- Create a
Layerusing [CreateLayer]. - Set properties on the
Layervia [SetLayerProperties], including the composition mode. - For an image layer, associate an
Imagewith theLayervia [SetLayerImage]. - Add the
Layerto aLayerStackvia [SetStackLayers]. - Set the
LayerStackas the content of a node via [SetTransformContent].
layer_id must satisfy the identifier rules documented on LayerId.
Sourcepub fn release_layer(&self, layer_id: &LayerId) -> Result<(), Error>
pub fn release_layer(&self, layer_id: &LayerId) -> Result<(), Error>
Released Layers will be garbage collected by the system once they are no longer necessary for rendering. For Layers, this means:
- the Layer is no longer referenced by any LayerStack, and
- any pending rendering that references the Layer is complete.
layer_id must refer to a valid, unreleased Layer.
Sourcepub fn set_layer_image(
&self,
layer_id: &LayerId,
image_id: &ImageId,
acquire_fence: Option<WaitFence>,
release_fence: Option<SignalFence>,
) -> Result<(), Error>
pub fn set_layer_image( &self, layer_id: &LayerId, image_id: &ImageId, acquire_fence: Option<WaitFence>, release_fence: Option<SignalFence>, ) -> Result<(), Error>
Associates an Image with the Layer.
The binding is legal in any composition mode, and is sticky: it survives composition
mode changes, and is replaced only by a later [SetLayerImage] call (or cleared by
[ResetLayer]). The image is displayed only while the layer’s composition mode is
IMAGE.
The bound image must be large enough for the layer’s stored sample_rect; this is
checked at [fuchsia.ui.composition/Flatland.Present], not here. See
[LayerProperties.sample_rect].
layer_id must refer to a valid, unreleased Layer.
image_id must refer to a valid, unreleased Image.
acquire_fence is an optional fence that must be signaled before the image is displayed.
release_fence is an optional fence, signaled by Scenic when this binding no
longer references the image. It is per-binding, not per-image: an image bound to
several layers has one such fence per binding, and the image is safe to write only
once every one of them has signaled.
A binding is ended by:
- being superseded by a later [
SetLayerImage] on the same layer - [
ResetLayer] - the layer ref-count reaching zero, either via [
ReleaseLayer] or by being released by a layer stack - destruction of the session, which ends every binding it holds
For a binding ended while the session is alive, Scenic signals at the first frame
retire after that point. Bindings that never reached the screen (e.g. one superseded
within a single batch, or one lost when several
[fuchsia.ui.composition/Flatland.Present] calls are squashed into a single
frame) signal at that same retire rather than immediately. The signal is
therefore conservative by at most one frame; it is never early.
Sourcepub fn set_layer_properties(
&self,
layer_id: &LayerId,
properties: &LayerProperties,
) -> Result<(), Error>
pub fn set_layer_properties( &self, layer_id: &LayerId, properties: &LayerProperties, ) -> Result<(), Error>
Sets properties of the Layer.
The provided properties table is merged into the layer’s stored properties: fields
which are unset in properties retain their previously stored values. Stored
properties are sticky; see LayerProperties for the full persistence semantics.
Values are stored as given; validation which depends on other state (notably
sample_rect against the bound image) happens at
[fuchsia.ui.composition/Flatland.Present]. See [LayerProperties.sample_rect].
layer_id must refer to a valid, unreleased Layer.
Sourcepub fn reset_layer(&self, layer_id: &LayerId) -> Result<(), Error>
pub fn reset_layer(&self, layer_id: &LayerId) -> Result<(), Error>
Unbinds any Image bound to the layer and clears every stored LayerProperties
field, returning the layer to its freshly-created state (composition mode
INVISIBLE, all properties at their documented defaults). This is the only
operation which forgets stored layer properties.
layer_id must refer to a valid, unreleased Layer.
Sourcepub fn create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
pub fn create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
Creates a new layer stack with the specified stack_id.
stack_id must satisfy the identifier rules documented on LayerId.
Sourcepub fn release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
pub fn release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
Releases the layer stack with the specified stack_id.
Sourcepub fn set_stack_layers(
&self,
stack_id: &LayerStackId,
layers: &[LayerId],
) -> Result<(), Error>
pub fn set_stack_layers( &self, stack_id: &LayerStackId, layers: &[LayerId], ) -> Result<(), Error>
Sets the layers in the stack. The order of layers in the vector determines their Z-order, with the first element being the back-most and the last element being the front-most.
stack_id must refer to a valid, unreleased LayerStack. Each element of layers
must refer to a valid, unreleased Layer. Duplicate layers within layers are
disallowed.
Sourcepub fn create_image2(
&self,
image_id: &ImageId,
import_token: BufferCollectionImportToken,
vmo_index: u32,
properties: &ImageProperties,
) -> Result<(), Error>
pub fn create_image2( &self, image_id: &ImageId, import_token: BufferCollectionImportToken, vmo_index: u32, properties: &ImageProperties, ) -> Result<(), Error>
Creates an Image resource.
image_id must satisfy the identifier rules documented on LayerId.
Sourcepub fn release_image2(&self, image_id: &ImageId) -> Result<(), Error>
pub fn release_image2(&self, image_id: &ImageId) -> Result<(), Error>
Released Images will be garbage collected by the system once they are no longer necessary for rendering. For Images, this means:
- the Image is no longer bound to any Layer, and
- any pending rendering that references the Image is complete.
The image_id value is freed for reuse immediately by the client (identifier uniqueness
is instantaneous).
Note: Per-binding release fences (passed to SetLayerImage) are unaffected by this call.
They track the lifecycle of individual layer bindings, not the client’s image_id.
image_id must refer to a valid, unreleased Image.
Sourcepub fn create_viewport2(
&self,
viewport_id: &ViewportId,
token: ViewportCreationToken,
properties: &ViewportProperties,
child_view_watcher: ServerEnd<ChildViewWatcherMarker>,
) -> Result<(), Error>
pub fn create_viewport2( &self, viewport_id: &ViewportId, token: ViewportCreationToken, properties: &ViewportProperties, child_view_watcher: ServerEnd<ChildViewWatcherMarker>, ) -> Result<(), Error>
Creates a Viewport resource.
viewport_id must satisfy the identifier rules documented on LayerId.
Sourcepub fn release_viewport2(
&self,
viewport_id: &ViewportId,
) -> QueryResponseFut<ViewportCreationToken, DefaultFuchsiaResourceDialect> ⓘ
pub fn release_viewport2( &self, viewport_id: &ViewportId, ) -> QueryResponseFut<ViewportCreationToken, DefaultFuchsiaResourceDialect> ⓘ
Releases a Viewport from the scene.
Sourcepub fn set_viewport_properties2(
&self,
viewport_id: &ViewportId,
properties: &ViewportProperties,
) -> Result<(), Error>
pub fn set_viewport_properties2( &self, viewport_id: &ViewportId, properties: &ViewportProperties, ) -> Result<(), Error>
Sets the properties of a Viewport.
Sourcepub fn set_transform_content(
&self,
transform_id: &TransformId,
content: Option<&TransformContent>,
) -> Result<(), Error>
pub fn set_transform_content( &self, transform_id: &TransformId, content: Option<&TransformContent>, ) -> Result<(), Error>
Sets (or clears) the content of a Transform.
The same content may be attached to more than one Transform; each attachment composites that content again under its own Transform’s matrix, clip, and opacity, so a single LayerStack or Viewport can appear repeatedly in a scene without the client duplicating the underlying resources.
A Transform’s content can be cleared by not providing the optional content.
If content is set, it must refer to a valid, unreleased LayerStack or Viewport.
Unlike classic [Flatland.SetContent], a zero id does not clear the content.
Trait Implementations§
Source§impl Clone for Flatland2Proxy
impl Clone for Flatland2Proxy
Source§fn clone(&self) -> Flatland2Proxy
fn clone(&self) -> Flatland2Proxy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Flatland2Proxy
impl Debug for Flatland2Proxy
Source§impl Flatland2ProxyInterface for Flatland2Proxy
impl Flatland2ProxyInterface for Flatland2Proxy
type ReleaseViewport2ResponseFut = QueryResponseFut<ViewportCreationToken>
fn create_layer(&self, layer_id: &LayerId) -> Result<(), Error>
fn release_layer(&self, layer_id: &LayerId) -> Result<(), Error>
fn set_layer_image( &self, layer_id: &LayerId, image_id: &ImageId, acquire_fence: Option<WaitFence>, release_fence: Option<SignalFence>, ) -> Result<(), Error>
fn set_layer_properties( &self, layer_id: &LayerId, properties: &LayerProperties, ) -> Result<(), Error>
fn reset_layer(&self, layer_id: &LayerId) -> Result<(), Error>
fn create_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
fn release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>
fn set_stack_layers( &self, stack_id: &LayerStackId, layers: &[LayerId], ) -> Result<(), Error>
fn create_image2( &self, image_id: &ImageId, import_token: BufferCollectionImportToken, vmo_index: u32, properties: &ImageProperties, ) -> Result<(), Error>
fn release_image2(&self, image_id: &ImageId) -> Result<(), Error>
fn create_viewport2( &self, viewport_id: &ViewportId, token: ViewportCreationToken, properties: &ViewportProperties, child_view_watcher: ServerEnd<ChildViewWatcherMarker>, ) -> Result<(), Error>
fn release_viewport2( &self, viewport_id: &ViewportId, ) -> Self::ReleaseViewport2ResponseFut
fn set_viewport_properties2( &self, viewport_id: &ViewportId, properties: &ViewportProperties, ) -> Result<(), Error>
fn set_transform_content( &self, transform_id: &TransformId, content: Option<&TransformContent>, ) -> Result<(), Error>
Source§impl Proxy for Flatland2Proxy
impl Proxy for Flatland2Proxy
Source§type Protocol = Flatland2Marker
type Protocol = Flatland2Marker
Proxy controls.