vizia::vg::gpu::ganesh::images

Function subset_texture_from

pub fn subset_texture_from(
    context: &mut RCHandle<GrDirectContext>,
    image: &RCHandle<SkImage>,
    subset: impl AsRef<IRect>,
) -> Option<RCHandle<SkImage>>
Expand description

Returns subset of this image as a texture-backed image.

Returns None if any of the following are true:

  • Subset is empty
  • Subset is not contained inside the image’s bounds
  • Pixels in the source image could not be read or copied
  • The source image is texture-backed and context does not match the source image’s context.
  • context - the DirectContext to which the subset should be uploaded.
  • subset - bounds of returned Image

Returns: the subsetted image, uploaded as a texture, or None