skia_safe::gpu::surfaces

Function wrap_mtk_view

Source
pub unsafe fn wrap_mtk_view(
    context: &mut RecordingContext,
    mtk_view: Handle,
    origin: SurfaceOrigin,
    sample_count: impl Into<Option<usize>>,
    color_type: ColorType,
    color_space: impl Into<Option<ColorSpace>>,
    surface_props: Option<&SurfaceProps>,
) -> Option<Surface>
Expand description

Creates Surface from MTKView. Returned Surface takes a reference on the MTKView. 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 MTKView*)
  • 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

Returns: created Surface, or None