Loader

Trait Loader 

Source
pub trait Loader:
    Debug
    + Send
    + Sync {
    // Required methods
    fn preload(
        &self,
        size: Size,
        dpi: f32,
    ) -> Result<(Vec<u8>, Size2D<u32, Pixel>), Error>;
    fn load(
        &self,
        driver: &Driver,
        data: (Vec<u8>, Size2D<u32, Pixel>),
        resize: bool,
    ) -> Result<(Region, Size), Error>;
}

Required Methods§

Source

fn preload( &self, size: Size, dpi: f32, ) -> Result<(Vec<u8>, Size2D<u32, Pixel>), Error>

The preload function does most of the work, loading the image into a byte buffer of a given width and height

Source

fn load( &self, driver: &Driver, data: (Vec<u8>, Size2D<u32, Pixel>), resize: bool, ) -> Result<(Region, Size), Error>

The load function simply consumes the byte buffer and loads it into the atlas.

Implementations on Foreign Types§

Source§

impl Loader for DynamicImage

Source§

fn preload( &self, size: Size, _: f32, ) -> Result<(Vec<u8>, Size2D<u32, Pixel>), Error>

Source§

fn load( &self, driver: &Driver, data: (Vec<u8>, Size2D<u32, Pixel>), resize: bool, ) -> Result<(Region, Size), Error>

Source§

impl Loader for Image

Source§

fn preload( &self, size: Size, _: f32, ) -> Result<(Vec<u8>, Size2D<u32, Pixel>), Error>

Source§

fn load( &self, driver: &Driver, data: (Vec<u8>, Size2D<u32, Pixel>), resize: bool, ) -> Result<(Region, Size), Error>

Implementors§