pub fn create_image(
        &self,
        filename: &str,
    ) -> std::result::Result<Image, Box<dyn std::error::Error>> {
        let filename = std::ffi::CString::new(filename).unwrap();
        let handle = unsafe { sys::nvgCreateImage(self.ctx, filename.as_ptr(), 0) };
        match handle {
            -1 => Err(Box::new(std::io::Error::new(
                std::io::ErrorKind::Other,
                "unable to load image",
            ))),
            _ => Ok(Image {
                ctx: self.ctx,
                handle,
            }),
        }
    }
/// NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
/// In addition you can upload your own image. The image loading is provided by stb_image.
NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
In addition you can upload your own image. The image loading is provided by stb_image.
NanoVG allows you to load jpg png psd tga pic and gif files to be used for rendering . In addition you can upload your own image . The image loading is provided by stb_image .
pub fn create_image(
        &self,
        filename: &str,
    ) -> std::result::Result<Image, Box<dyn std::error::Error>> {
        let filename = std::ffi::CString::new(filename).unwrap();
        let handle = unsafe { sys::nvgCreateImage(self.ctx, filename.as_ptr(), 0) };
        match handle {
            -1 => Err(Box::new(std::io::Error::new(
                std::io::ErrorKind::Other,
                "unable to load image",
            ))),
            _ => Ok(Image {
                ctx: self.ctx,
                handle,
            }),
        }
    }
pub fn create_image ( & self , filename : & str , ) -> std :: result :: Result < Image , Box < dyn std :: error :: Error > > { let filename = std :: ffi :: CString :: new ( filename ) . unwrap ( ) ; let handle = unsafe { sys :: nvgCreateImage ( self . ctx , filename . as_ptr ( ) , 0 ) } ; match handle { - 1 => Err ( Box :: new ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " , ) ) ) , _ => Ok ( Image { ctx : self . ctx , handle , } ) , } }
NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
NanoVG allows you to load jpg png psd tga pic and gif files to be used for rendering .
&self
filename
&str