Struct irondash_texture::Texture
source · 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>
impl<Type> Texture<Type>
sourcepub fn id(&self) -> i64
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.
sourcepub fn mark_frame_available(&self) -> Result<()>
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.
sourcepub fn into_sendable_texture(self) -> Arc<SendableTexture<Type>>
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>
impl<Type: PlatformTextureWithProvider> Texture<Type>
sourcepub fn new_with_provider(
engine_handle: i64,
payload_provider: Arc<dyn PayloadProvider<Type>>
) -> Result<Self>
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>
impl<Type: PlatformTextureWithoutProvider> Texture<Type>
sourcepub fn new(engine_handle: i64) -> Result<Self>
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();