fn init(&mut self, renderer: &mut crate::render::Renderer, _theme: &crate::prelude::Theme) {
        if self.resource == "" {
            panic!("Image `{}` was never assigned a resource. Use `.resource('resource_alias')` to assign this.", self.id);
        }

        let (width, height) = renderer.texture_map.get_resource_dimensions(&self.resource);
        
        let mut scale_factor: f32 = 1.0;
        if let Some(width_constraint) = self.width_constraint {
            scale_factor = width_constraint as f32 / width as f32;
        }
        if let Some(height_constraint) = self.height_constraint {
            scale_factor = height_constraint as f32 / width as f32;
        }

        self.bounds.width = (width as f32 * scale_factor).round() as _;
        self.bounds.height = (height as f32 * scale_factor).round() as _;
    }
// TODO: Do something about setting both a width and a height constraint
Do something about setting both a width and a height constraint
Do something about setting both a width and a height constraint
fn init(&mut self, renderer: &mut crate::render::Renderer, _theme: &crate::prelude::Theme) {
        if self.resource == "" {
            panic!("Image `{}` was never assigned a resource. Use `.resource('resource_alias')` to assign this.", self.id);
        }
        let (width, height) = renderer.texture_map.get_resource_dimensions(&self.resource);
        let mut scale_factor: f32 = 1.0;
        if let Some(width_constraint) = self.width_constraint {
            scale_factor = width_constraint as f32 / width as f32;
        }
        if let Some(height_constraint) = self.height_constraint {
            scale_factor = height_constraint as f32 / width as f32;
        }
        self.bounds.width = (width as f32 * scale_factor).round() as _;
        self.bounds.height = (height as f32 * scale_factor).round() as _;
    }
fn init ( & mut self , renderer : & mut crate :: render :: Renderer , _theme : & crate :: prelude :: Theme ) { if self . resource == " " { panic ! ( " " self id ) ; } let ( width , height ) = renderer . texture_map . get_resource_dimensions ( & self . resource ) ; let mut scale_factor : f32 = 1.0 ; if let Some ( width_constraint ) = self . width_constraint { scale_factor = width_constraint as f32 / width as f32 ; } if let Some ( height_constraint ) = self . height_constraint { scale_factor = height_constraint as f32 / width as f32 ; } self . bounds . width = ( width as f32 * scale_factor ) . round ( ) as _ ; self . bounds . height = ( height as f32 * scale_factor ) . round ( ) as _ ; }
TODO: Do something about setting both a width and a height constraint
TODO : Do something about setting both a width and a height constraint
&mut self
renderer
&mut crate::render::Renderer
_theme
&crate::prelude::Theme
&mut self
renderer
&mut crate::render::Renderer
_theme
&crate::prelude::Theme