Function vizia::vg::gpu::images::cross_context_texture_from_pixmap

pub fn cross_context_texture_from_pixmap(
    context: &mut RCHandle<GrDirectContext>,
    pixmap: &Pixmap<'_>,
    build_mips: bool,
    limit_to_max_texture_size: impl Into<Option<bool>>,
) -> Option<RCHandle<SkImage>>
Expand description

Creates a GPU-backed Image from pixmap. It is uploaded to GPU backend using context. Created Image is available to other GPU contexts, and is available across thread boundaries. All contexts must be in the same GPU share group, or otherwise share resources. When Image is no longer referenced, context releases texture memory asynchronously. ColorSpace of Image is determined by pixmap.color_space(). Image is returned referring to GPU backend if context is not None, format of data is recognized and supported, and if context supports moving resources between contexts. Otherwise, pixmap pixel data is copied and Image as returned in raster format if possible; None may be returned. Recognized GPU formats vary by platform and GPU backend.

  • context - GPU context
  • pixmap - ImageInfo, pixel address, and row bytes
  • build_mips - create Image as mip map if true
  • limit_to_max_texture_size - downscale image to GPU maximum texture size, if necessary Returns: created Image, or None