Trait zng_view::extensions::BlobExtension

source ·
pub trait BlobExtension: Send + Any {
    // Required methods
    fn create_blob_rasterizer(&mut self) -> Box<dyn AsyncBlobRasterizer>;
    fn create_similar(&self) -> Box<dyn BlobExtension>;
    fn add(&mut self, args: &BlobAddArgs);
    fn update(&mut self, args: &BlobUpdateArgs);
    fn delete(&mut self, key: BlobImageKey);
    fn enable_multithreading(&mut self, enable: bool);

    // Provided methods
    fn prepare_resources(&mut self, args: &mut BlobPrepareArgs<'_>) { ... }
    fn delete_font(&mut self, key: FontKey) { ... }
    fn delete_font_instance(&mut self, key: FontInstanceKey) { ... }
    fn clear_namespace(&mut self, namespace: IdNamespace) { ... }
}
Expand description

Represents a Webrender blob handler that can coexist with other blob handlers on the same renderer.

This API is very similar to Webrender’s BlobImageHandler, the only difference is that implementers are expected to detect and ignore requests targeting other blob extensions as multiple extensions may implement blob renderers.

See RendererConfigArgs::blobs for more details.

Required Methods§

source

fn create_blob_rasterizer(&mut self) -> Box<dyn AsyncBlobRasterizer>

Creates a snapshot of the current state of blob images in the handler.

source

fn create_similar(&self) -> Box<dyn BlobExtension>

New blob extension instance of the same type.

source

fn add(&mut self, args: &BlobAddArgs)

Register a blob image if the request addresses this extension.

source

fn update(&mut self, args: &BlobUpdateArgs)

Update a blob image if the request addresses this extension.

source

fn delete(&mut self, key: BlobImageKey)

Remove a blob image if the key was generated by this extension.

source

fn enable_multithreading(&mut self, enable: bool)

Sets if multi-threading is allowed.

The default is true, this method is only called on init if multithreading is disabled.

Provided Methods§

source

fn prepare_resources(&mut self, args: &mut BlobPrepareArgs<'_>)

Prepare resources that are not bundled in with the encoded request commands.

The extension must ignore requests not addressing it.

source

fn delete_font(&mut self, key: FontKey)

Cleanup any prepared resource for the font.

source

fn delete_font_instance(&mut self, key: FontInstanceKey)

Cleanup any prepared resource for the font instance.

source

fn clear_namespace(&mut self, namespace: IdNamespace)

Cleanup any state related with the namespace.

Implementors§