Skip to main content

SlideReader

Trait SlideReader 

Source
pub trait SlideReader:
    Send
    + Sync
    + 'static {
    // Required methods
    fn info(&self) -> SlideInfo;
    fn read_region(
        &self,
        region: &SlideRegion,
        out: &mut [u8],
    ) -> Result<(), String>;

    // Provided method
    fn read_associated_image(&self, name: &str) -> Result<Image, String> { ... }
}
Expand description

One slide opened by Plugin::open_slide.

eov reads regions from its render workers, several threads at once on the same reader, so it is Send + Sync: guard non-thread-safe decoders with a lock of your own. Every call runs inside catch_unwind; a panic fails the call and stops the plugin, an Err fails only that read (the tile shows as missing and is tried again later).

Required Methods§

Source

fn info(&self) -> SlideInfo

The slide’s metadata, asked for once right after opening. eov checks it (SlideInfo::validate) and refuses slides it cannot use.

Source

fn read_region( &self, region: &SlideRegion, out: &mut [u8], ) -> Result<(), String>

Fills out with the pixels of region, which lies inside its level (in pixels of that level, see SlideRegion): width·height·4 bytes of RGBA with straight alpha, rows top to bottom. out arrives transparent; leave pixels without image data as they are.

Provided Methods§

Source

fn read_associated_image(&self, name: &str) -> Result<Image, String>

Decodes an associated image listed in SlideInfo::associated_images at the size listed there, as RGBA with straight alpha.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§