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 contextlayer
-gpu::mtl::Handle
(expected to be a CAMetalLayer*)sample_cnt
- samples per pixel, or 0 to disable full scene anti-aliasingcolor_space
- range of colors; may beNone
surface_props
- LCD striping orientation and setting for device independent fonts; may beNone
drawable
- Pointer to drawable to be filled in when this surface is instantiated; may not beNone
Returns: created Surface
, or None