Function vizia_core::vg::gpu::images::texture_from_image

pub fn texture_from_image(
    direct_context: &mut RCHandle<GrDirectContext>,
    image: &RCHandle<SkImage>,
    mipmapped: skgpu_Mipmapped,
    budgeted: Budgeted,
) -> Option<RCHandle<SkImage>>
Expand description

Returns Image backed by GPU texture associated with context. Returned Image is compatible with Surface created with dst_color_space. The returned Image respects mipmapped setting; if mipmapped equals Mipmapped::Yes, the backing texture allocates mip map levels. The mipmapped parameter is effectively treated as No if MIP maps are not supported by the GPU. Returns original Image if the image is already texture-backed, the context matches, and mipmapped is compatible with the backing GPU texture. skgpu::Budgeted is ignored in this case. Returns None if context is None, or if Image was created with another DirectContext.

  • direct_context - the DirectContext in play, if it exists
  • image - a non-null pointer to an Image.
  • mipmapped - Whether created Image texture must allocate mip map levels. Defaults to No.
  • budgeted - Whether to count a newly created texture for the returned image counts against the context’s budget. Defaults to Yes. Returns: created Image, or None