zng_app::render

Trait Img

source
pub trait Img {
    // Required methods
    fn renderer_id(&self, renderer: &ViewRenderer) -> ImageTextureId;
    fn size(&self) -> PxSize;

    // Provided method
    fn alpha_type(&self) -> AlphaType { ... }
}
Expand description

A loaded or loading image.

This trait is an interface for the renderer into the image API used in the application.

The ideal image format is BGRA with pre-multiplied alpha.

Required Methods§

source

fn renderer_id(&self, renderer: &ViewRenderer) -> ImageTextureId

Gets the image ID in the renderer namespace.

The image must be loaded asynchronously by self and does not need to be loaded yet when the key is returned.

source

fn size(&self) -> PxSize

Image pixel size.

Provided Methods§

source

fn alpha_type(&self) -> AlphaType

Returns a value that indicates if the image is already pre-multiplied.

The faster option is pre-multiplied, that is also the default return value.

Implementors§