pub fn create(mut self, data: &mut [u8]) -> Result<()> {
        if data.len()
            < VtfFile::compute_image_size(self.width, self.height, 1, 1, ImageFormat::Rgba8888)
                as usize
        {
            return Err(Error::InvalidLength);
        }
        unsafe {
            ffi_try!(ffi::vlImageCreateSingle(
                self.width,
                self.height,
                data.as_mut_ptr(),
                &mut self.options
            ));
        }
        Ok(())
    }
/// Create a single frame image from `data`.
/// Data needs to be `mut` because some creation options are applied in place.
///
/// # Errors
///
/// Returns `Err` if `data` has the wrong length or the image creation fails.
Create a single frame image from `data`.
Data needs to be `mut` because some creation options are applied in place.
Create a single frame image from ` data ` . Data needs to be ` mut ` because some creation options are applied in place .
pub fn create(mut self, data: &mut [u8]) -> Result<()> {
        if data.len()
            < VtfFile::compute_image_size(self.width, self.height, 1, 1, ImageFormat::Rgba8888)
                as usize
        {
            return Err(Error::InvalidLength);
        }
        unsafe {
            ffi_try!(ffi::vlImageCreateSingle(
                self.width,
                self.height,
                data.as_mut_ptr(),
                &mut self.options
            ));
        }
        Ok(())
    }
pub fn create ( mut self , data : & mut [ u8 ] ) -> Result < ( ) > { if data . len ( ) < VtfFile :: compute_image_size ( self . width , self . height , 1 , 1 , ImageFormat :: Rgba8888 ) as usize { return Err ( Error :: InvalidLength ) ; } unsafe { ffi_try ! ( ffi vlImageCreateSingle ( self width self height data as_mut_ptr ( ) mut self options ) ) ; } Ok ( ( ) ) }
Create a single frame image from `data`.
Create a single frame image from ` data ` .
mut self
data
&mut [u8]
mut self
data
&mut [u8]
errors
Returns `Err` if `data` has the wrong length or the image creation fails.
Returns ` Err ` if ` data ` has the wrong length or the image creation fails .