skia_safe::gpu::surfaces

Function wrap_ca_metal_layer

Source
pub unsafe fn wrap_ca_metal_layer(
    context: &mut RecordingContext,
    layer: Handle,
    origin: SurfaceOrigin,
    sample_cnt: impl Into<Option<usize>>,
    color_type: ColorType,
    color_space: impl Into<Option<ColorSpace>>,
    surface_props: Option<&SurfaceProps>,
    drawable: *mut Handle,
) -> Option<Surface>
Expand description

Creates Surface from CAMetalLayer. Returned Surface takes a reference on the CAMetalLayer. The ref on the layer will be released when the Surface is destroyed.

Only available when Metal API is enabled.

Will grab the current drawable from the layer and use its texture as a backend_rt to create a renderable surface.

  • context - GPU context
  • layer - gpu::mtl::Handle (expected to be a CAMetalLayer*)
  • sample_cnt - samples per pixel, or 0 to disable full scene anti-aliasing
  • color_space - range of colors; may be None
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None
  • drawable - Pointer to drawable to be filled in when this surface is instantiated; may not be None

Returns: created Surface, or None