fn draw_image_button(
        &self,
        ctx: &CanvasRenderingContext2d,
        img: &HtmlImageElement,
    ) -> Result<(), JsValue> {
        ctx.begin_path();
        ctx.set_fill_style(&JsValue::from_str("#222222"));
        ctx.rect(
            self.rect.x(),
            self.rect.y() - self.h() * 0.05,
            self.rect.w(),
            self.rect.h() + self.h() * 0.1,
        );
        ctx.fill();
        ctx.draw_image_with_html_image_element_and_dw_and_dh(
            img,
            self.rect.x(),
            self.rect.y(),
            self.rect.w(),
            self.rect.h(),
        )?;
        ctx.close_path();
        Ok(())
    }
/// Draw a button with image content
Draw a button with image content
Draw a button with image content
fn draw_image_button(
        &self,
        ctx: &CanvasRenderingContext2d,
        img: &HtmlImageElement,
    ) -> Result<(), JsValue> {
        ctx.begin_path();
        ctx.set_fill_style(&JsValue::from_str("#222222"));
        ctx.rect(
            self.rect.x(),
            self.rect.y() - self.h() * 0.05,
            self.rect.w(),
            self.rect.h() + self.h() * 0.1,
        );
        ctx.fill();
        ctx.draw_image_with_html_image_element_and_dw_and_dh(
            img,
            self.rect.x(),
            self.rect.y(),
            self.rect.w(),
            self.rect.h(),
        )?;
        ctx.close_path();
        Ok(())
    }
fn draw_image_button ( & self , ctx : & CanvasRenderingContext2d , img : & HtmlImageElement , ) -> Result < ( ) , JsValue > { ctx . begin_path ( ) ; ctx . set_fill_style ( & JsValue :: from_str ( " " ) ) ; ctx . rect ( self . rect . x ( ) , self . rect . y ( ) - self . h ( ) * 0.05 , self . rect . w ( ) , self . rect . h ( ) + self . h ( ) * 0.1 , ) ; ctx . fill ( ) ; ctx . draw_image_with_html_image_element_and_dw_and_dh ( img , self . rect . x ( ) , self . rect . y ( ) , self . rect . w ( ) , self . rect . h ( ) , ) ? ; ctx . close_path ( ) ; Ok ( ( ) ) }
Draw a button with image content
Draw a button with image content
&self
ctx
&CanvasRenderingContext2d
img
&HtmlImageElement
&self
ctx
&CanvasRenderingContext2d
img
&HtmlImageElement