Skip to main content

MetalPlatformSurface

Struct MetalPlatformSurface 

Source
pub struct MetalPlatformSurface { /* private fields */ }
Expand description

The Metal render surface of a top-level.

The surface is shared with the thread that renders (IPlatformRenderSurface: Send + Sync). What it holds of the native side is the native top-level, which only the UI thread may use (see SurfaceTopLevel): the render target is created on the UI thread, as in the reference, and the native side refuses anything else (TopLevelImpl::CreateMetalRenderTarget in native/FerroUI.Native/src/OSX/TopLevelImpl.mm returns COR_E_INVALIDOPERATION off the main thread).

Trait Implementations§

Source§

impl IMetalPlatformSurface for MetalPlatformSurface

Source§

fn create_metal_render_target( &self, device: Rc<dyn IMetalDevice>, ) -> Rc<dyn IMetalPlatformSurfaceRenderTarget>

§Panics

Panics when called off the UI thread or when the top-level is disposed (the render target is not ready) and when device is not a device of this backend.

Source§

impl IPlatformRenderSurface for MetalPlatformSurface

Source§

fn is_ready(&self) -> bool

Deviation (DEVIATIONS.md, Native backend): the reference throws RenderTargetNotReadyException from CreateMetalRenderTarget off the UI thread and the composition target catches it; here the surface answers that it is not ready, which the composition target treats the same way, without a panic to catch.

Source§

fn try_get_surface_kind(&self, kind: TypeId) -> Option<Rc<dyn Any>>

The surface viewed as a surface kind defined outside this crate: for TypeId::of::<dyn IFoo>() the result holds an Rc<dyn IFoo>.
Source§

fn as_any(&self) -> &dyn Any

Lets the backend recover the concrete surface type.
Source§

fn as_framebuffer_surface(&self) -> Option<&dyn IFramebufferPlatformSurface>

The surface as a framebuffer surface, if it is one.
Source§

fn text_rendering_parameters(&self) -> Option<PlatformTextRenderingParameters>

The text rendering settings of the platform for this surface, when the platform knows them: the render backend asks for them every frame (they follow the settings of the system and the display the surface is on). A backend asks every surface of a top-level and takes the first answer; None from all of them gives the defaults of the backend (docs/porting/text-rendering.md).

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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.

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.