Skip to main content

Flatland2SynchronousProxy

Struct Flatland2SynchronousProxy 

Source
pub struct Flatland2SynchronousProxy { /* private fields */ }

Implementations§

Source§

impl Flatland2SynchronousProxy

Source

pub fn new(channel: Channel) -> Self

Source

pub fn into_channel(self) -> Channel

Source

pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<Flatland2Event, Error>

Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.

Source

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:

  1. Create a Layer using [CreateLayer].
  2. Set properties on the Layer via [SetLayerProperties], including the composition mode.
  3. For an image layer, associate an Image with the Layer via [SetLayerImage].
  4. Add the Layer to a LayerStack via [SetStackLayers].
  5. Set the LayerStack as the content of a node via [SetTransformContent].

layer_id must satisfy the identifier rules documented on LayerId.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn release_layer_stack(&self, stack_id: &LayerStackId) -> Result<(), Error>

Releases the layer stack with the specified stack_id.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn release_viewport2( &self, viewport_id: &ViewportId, ___deadline: MonotonicInstant, ) -> Result<ViewportCreationToken, Error>

Releases a Viewport from the scene.

Source

pub fn set_viewport_properties2( &self, viewport_id: &ViewportId, properties: &ViewportProperties, ) -> Result<(), Error>

Sets the properties of a Viewport.

Source

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 Debug for Flatland2SynchronousProxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Channel> for Flatland2SynchronousProxy

Available on Fuchsia only.
Source§

fn from(value: Channel) -> Self

Converts to this type from the input type.
Source§

impl From<Flatland2SynchronousProxy> for NullableHandle

Available on Fuchsia only.
Source§

fn from(value: Flatland2SynchronousProxy) -> Self

Converts to this type from the input type.
Source§

impl FromClient for Flatland2SynchronousProxy

Available on Fuchsia only.
Source§

type Protocol = Flatland2Marker

The protocol.
Source§

fn from_client(value: ClientEnd<Flatland2Marker>) -> Self

Converts from a client.
Source§

impl SynchronousProxy for Flatland2SynchronousProxy

Available on Fuchsia only.
Source§

type Proxy = Flatland2Proxy

The async proxy for the same protocol.
Source§

type Protocol = Flatland2Marker

The protocol which this Proxy controls.
Source§

fn from_channel(inner: Channel) -> Self

Create a proxy over the given channel.
Source§

fn into_channel(self) -> Channel

Convert the proxy back into a channel.
Source§

fn as_channel(&self) -> &Channel

Get a reference to the proxy’s underlying channel. Read more
Source§

fn is_closed(&self) -> Result<bool, Status>

Returns true if the proxy has received the PEER_CLOSED signal. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.