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

Available on crate features avif or bmp or dds or exr or ff or gif or hdr or ico or pnm or qoi or tga or tiff or webp only.
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

Available on crate features png or jpeg only.
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§