pub struct Texture<Type> { /* private fields */ }
Expand description

Native texture.

Type parameters specifies the payload type of the texture. It can be BoxedPixelData, which is supported on all platforms, or one of the platform specific types such as BoxedIOSurface, BoxedGLTexture or BoxedTextureDescriptor.

Implementations§

source§

impl<Type> Texture<Type>

source

pub fn id(&self) -> i64

Returns identifier of the texture. This needs to be passed to Dart and used to create a Flutter Texture widget.

source

pub fn mark_frame_available(&self) -> Result<()>

Informs Flutter that new texture frame is available. This will make Flutter request new texture payload from provider during next frame rasterization.

source

pub fn into_sendable_texture(self) -> Arc<SendableTexture<Type>>

Converts Texture to a SendableTexture. SendableTexture can be sent between threads and update the content on any thread.

source§

impl<Type: PlatformTextureWithProvider> Texture<Type>

source

pub fn new_with_provider( engine_handle: i64, payload_provider: Arc<dyn PayloadProvider<Type>> ) -> Result<Self>

Creates new texture for given engine with specified payload provider.

Creating PixelData backed texture is supported on all platforms:

// Assume MyPixelDataProvider implements PayloadProvider<BoxedPixelData>
let provider = Arc::new(MyPixelDataProvider::new());

let texture = Texture::new_with_provider(engine_handle, provider)?;

// This will cause flutter to request a PixelData during next
// frame rasterization.
texture.mark_frame_available()?;
source§

impl<Type: PlatformTextureWithoutProvider> Texture<Type>

source

pub fn new(engine_handle: i64) -> Result<Self>

Creates new texture for given engine without payload. This is used on Android where instead of providing payload to the texture, you work directly with underlying surface or native window.

let texture = Texture::<NativeWindow>::new(engine_handle)?;
let native_window = texture.get();
source

pub fn get(&self) -> Type

Auto Trait Implementations§

§

impl<Type> RefUnwindSafe for Texture<Type>

§

impl<Type> !Send for Texture<Type>

§

impl<Type> !Sync for Texture<Type>

§

impl<Type> Unpin for Texture<Type>

§

impl<Type> UnwindSafe for Texture<Type>

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> 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.

source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.