Skip to main content

cgimage_render_rgba_into

Function cgimage_render_rgba_into 

Source
pub unsafe extern "C" fn cgimage_render_rgba_into(
    image: *const c_void,
    dest: *mut u8,
    dest_capacity: usize,
) -> usize
Expand description

Render the CGImage’s RGBA bytes directly into a caller-owned buffer. Returns the number of bytes written (= widthheight4) on success, or 0 on failure. Replaces the legacy cgimage_get_data + cgimage_free_data pair which made an extra Swift-side malloc + memcpy before handing the buffer back; this single-call form lets Rust own the allocation and removes one full RGBA-sized memcpy from the screenshot decode path.