pub trait ExternalImageHandler {
// Required methods
fn lock(
&mut self,
key: ExternalImageId,
channel_index: u8,
rendering: ImageRendering,
) -> ExternalImage<'_>;
fn unlock(&mut self, key: ExternalImageId, channel_index: u8);
}
Expand description
The interfaces that an application can implement to support providing external image buffers. When the application passes an external image to WR, it should keep that external image life time. People could check the epoch id in RenderNotifier at the client side to make sure that the external image is not used by WR. Then, do the clean up for that external image.
Required Methods§
Sourcefn lock(
&mut self,
key: ExternalImageId,
channel_index: u8,
rendering: ImageRendering,
) -> ExternalImage<'_>
fn lock( &mut self, key: ExternalImageId, channel_index: u8, rendering: ImageRendering, ) -> ExternalImage<'_>
Lock the external image. Then, WR could start to read the image content. The WR client should not change the image content until the unlock() call. Provide ImageRendering for NativeTexture external images.
Sourcefn unlock(&mut self, key: ExternalImageId, channel_index: u8)
fn unlock(&mut self, key: ExternalImageId, channel_index: u8)
Unlock the external image. WR should not read the image content after this call.