[][src]Function k4a_sys_temp::k4a_image_create_from_buffer

pub unsafe extern "C" fn k4a_image_create_from_buffer(
    format: k4a_image_format_t,
    width_pixels: c_int,
    height_pixels: c_int,
    stride_bytes: c_int,
    buffer: *mut u8,
    buffer_size: usize,
    buffer_release_cb: k4a_memory_destroy_cb_t,
    buffer_release_cb_context: *mut c_void,
    image_handle: *mut k4a_image_t
) -> k4a_result_t

Create an image from a pre-allocated buffer.

\param format The format of the image that will be stored in this image container.

\param width_pixels Width in pixels.

\param height_pixels Height in pixels.

\param stride_bytes The number of bytes per horizontal line of the image.

\param buffer Pointer to a pre-allocated image buffer.

\param buffer_size Size in bytes of the pre-allocated image buffer.

\param buffer_release_cb Callback to the buffer free function, called when all references to the buffer have been released. This parameter is optional.

\param buffer_release_cb_context Context for the buffer free function. This value will be called as a parameter to \p buffer_release_cb when the callback is invoked.

\param image_handle Pointer to store image handle in.

\remarks This function creates a \ref k4a_image_t from a pre-allocated buffer. When all references to this object reach zero the provided \p buffer_release_cb callback function is called so that the memory can be released. If this function fails, the API will not use the memory provided in \p buffer, and the API will not call \p buffer_release_cb.

\remarks The \ref k4a_image_t is created with a reference count of 1.

\remarks Release the reference on this function with k4a_image_release().

\returns Returns #K4A_RESULT_SUCCEEDED on success. Errors are indicated with #K4A_RESULT_FAILED and error specific data can be found in the log.

\relates k4a_image_t

\xmlonly k4a.h (include k4a/k4a.h) k4a.lib k4a.dll \endxmlonly