/// Creates a new wl_buffer object backed by memory from params.
Creates a new wl_buffer object backed by memory from params.
Creates a new wl_buffer object backed by memory from params .
pub fn create(&mut self, width: i32, height: i32, format: u32) -> Result<Buffer, Error> {
        let image_size = Size { width, height };
        let has_alpha = SUPPORTED_PIXEL_FORMATS
            .iter()
            .find_map(
                |&(supported_format, has_alpha)| {
                    if supported_format == format {
                        Some(has_alpha)
                    } else {
                        None
                    }
                },
            )
            .unwrap_or(false);
        let raw_import_token = self.token.duplicate_handle(zx::Rights::SAME_RIGHTS)?;
        let import_token = composition::BufferCollectionImportToken { value: raw_import_token };
        Ok(Buffer::from_import_token(Rc::new(import_token), image_size, has_alpha))
    }
pub fn create ( & mut self , width : i32 , height : i32 , format : u32 ) -> Result < Buffer , Error > { let image_size = Size { width , height } ; let has_alpha = SUPPORTED_PIXEL_FORMATS . iter ( ) . find_map ( | & ( supported_format , has_alpha ) | { if supported_format == format { Some ( has_alpha ) } else { None } } , ) . unwrap_or ( false ) ; let raw_import_token = self . token . duplicate_handle ( zx :: Rights :: SAME_RIGHTS ) ? ; let import_token = composition :: BufferCollectionImportToken { value : raw_import_token } ; Ok ( Buffer :: from_import_token ( Rc :: new ( import_token ) , image_size , has_alpha ) ) }
Creates a new wl_buffer object backed by memory from params.
Creates a new wl_buffer object backed by memory from params .
&mut self
width
i32
height
i32
format
u32