Function freya_engine::prelude::wrap_backend_render_target

pub fn wrap_backend_render_target(
    context: &mut RCHandle<GrRecordingContext>,
    backend_render_target: &Handle<GrBackendRenderTarget>,
    origin: GrSurfaceOrigin,
    color_type: ColorType,
    color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
    surface_props: Option<&SurfaceProps>,
) -> Option<RCHandle<SkSurface>>
Expand description

Wraps a GPU-backed buffer into Surface. Caller must ensure backend_render_target is valid for the lifetime of returned Surface.

Surface is returned if all parameters are valid. backend_render_target is valid if its pixel configuration agrees with color_space and context; for instance, if backend_render_target has an sRGB configuration, then context must support sRGB, and color_space must be present. Further, backend_render_target width and height must not exceed context capabilities, and the context must be able to support back-end render targets.

  • context - GPU context
  • backend_render_target - GPU intermediate memory buffer
  • origin - origin of canvas
  • color_type - type of colors in the buffer
  • color_space - range of colors
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None

Returns: Surface if all parameters are valid; otherwise, None