Skip to main content

capture_layer

Function capture_layer 

Source
pub unsafe fn capture_layer(
    layer: *mut c_void,
    width: u32,
    height: u32,
) -> Vec<u8> ⓘ
Expand description

Rasterise a CALayer into a tightly packed RGBA8 buffer.

The flip is not cosmetic: a bitmap context has its origin at the bottom left and UIKit’s layers have theirs at the top left, so without it every capture comes out upside down.

§Safety

layer must be a live CALayer.