/// Create an image from a pre-allocated buffer
Create an image from a pre-allocated buffer
Create an image from a pre - allocated buffer
pub fn image_create_from_buffer_native(
        &self,
        format: ImageFormat,
        width_pixels: i32,
        height_pixels: i32,
        stride_bytes: i32,
        buffer: *mut u8,
        buffer_size: usize,
        buffer_release_cb: Option<MemoryDestroyCallback>,
        buffer_release_cb_context: *mut (),
    ) -> Result<Image, Error> {
        let mut handle: k4a_image_t = ptr::null_mut();
        Error::from_k4a_result_t(unsafe {
            (self.api().funcs.k4a_image_create_from_buffer)(
                format.into(),
                width_pixels,
                height_pixels,
                stride_bytes,
                buffer,
                buffer_size,
                std::mem::transmute(buffer_release_cb),
                buffer_release_cb_context as _,
                &mut handle,
            )
        })
        .to_result_fn(|| Image::from_handle(&self.api, handle))
    }
pub fn image_create_from_buffer_native ( & self , format : ImageFormat , width_pixels : i32 , height_pixels : i32 , stride_bytes : i32 , buffer : * mut u8 , buffer_size : usize , buffer_release_cb : Option < MemoryDestroyCallback > , buffer_release_cb_context : * mut ( ) , ) -> Result < Image , Error > { let mut handle : k4a_image_t = ptr :: null_mut ( ) ; Error :: from_k4a_result_t ( unsafe { ( self . api ( ) . funcs . k4a_image_create_from_buffer ) ( format . into ( ) , width_pixels , height_pixels , stride_bytes , buffer , buffer_size , std :: mem :: transmute ( buffer_release_cb ) , buffer_release_cb_context as _ , & mut handle , ) } ) . to_result_fn ( | | Image :: from_handle ( & self . api , handle ) ) }
Create an image from a pre-allocated buffer
Create an image from a pre - allocated buffer
&self
format
ImageFormat
width_pixels
i32
height_pixels
i32
stride_bytes
i32
buffer
*mut u8
buffer_size
usize
buffer_release_cb
Option<MemoryDestroyCallback>
buffer_release_cb_context
*mut ()