Skip to main content

Flatland2Proxy

Struct Flatland2Proxy 

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

Implementations§

Source§

impl Flatland2Proxy

Source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.ui.composition/Flatland2.

Source

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.

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, ) -> QueryResponseFut<ViewportCreationToken, DefaultFuchsiaResourceDialect>

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 Clone for Flatland2Proxy

Source§

fn clone(&self) -> Flatland2Proxy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Flatland2Proxy

Source§

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

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

impl Flatland2ProxyInterface for Flatland2Proxy

Source§

type ReleaseViewport2ResponseFut = QueryResponseFut<ViewportCreationToken>

Source§

fn create_layer(&self, layer_id: &LayerId) -> Result<(), Error>

Source§

fn release_layer(&self, layer_id: &LayerId) -> Result<(), Error>

Source§

fn set_layer_image( &self, layer_id: &LayerId, image_id: &ImageId, acquire_fence: Option<WaitFence>, release_fence: Option<SignalFence>, ) -> Result<(), Error>

Source§

fn set_layer_properties( &self, layer_id: &LayerId, properties: &LayerProperties, ) -> Result<(), Error>

Source§

fn reset_layer(&self, layer_id: &LayerId) -> Result<(), Error>

Source§

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

Source§

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

Source§

fn set_stack_layers( &self, stack_id: &LayerStackId, layers: &[LayerId], ) -> Result<(), Error>

Source§

fn create_image2( &self, image_id: &ImageId, import_token: BufferCollectionImportToken, vmo_index: u32, properties: &ImageProperties, ) -> Result<(), Error>

Source§

fn release_image2(&self, image_id: &ImageId) -> Result<(), Error>

Source§

fn create_viewport2( &self, viewport_id: &ViewportId, token: ViewportCreationToken, properties: &ViewportProperties, child_view_watcher: ServerEnd<ChildViewWatcherMarker>, ) -> Result<(), Error>

Source§

fn release_viewport2( &self, viewport_id: &ViewportId, ) -> Self::ReleaseViewport2ResponseFut

Source§

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

Source§

fn set_transform_content( &self, transform_id: &TransformId, content: Option<&TransformContent>, ) -> Result<(), Error>

Source§

impl Proxy for Flatland2Proxy

Source§

type Protocol = Flatland2Marker

The protocol which this Proxy controls.
Source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
Source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
Source§

fn as_channel(&self) -> &AsyncChannel

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

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
Source§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
Source§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> FromClient for T
where T: Proxy,

Source§

type Protocol = <T as Proxy>::Protocol

The protocol.
Source§

fn from_client(value: ClientEnd<<T as FromClient>::Protocol>) -> T

Converts from a client.
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> ProxyHasDomain for T
where T: Proxy,

Source§

fn domain(&self) -> ZirconClient

Get a “client” for this proxy. This is just an object which has methods for a few common handle creation operations.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.