Function vizia_core::vg::gpu::images::borrow_texture_from
pub fn borrow_texture_from(
context: &mut RCHandle<GrRecordingContext>,
backend_texture: &RefHandle<GrBackendTexture>,
origin: GrSurfaceOrigin,
color_type: ColorType,
alpha_type: SkAlphaType,
color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
) -> Option<RCHandle<SkImage>>
Expand description
Creates GPU-backed Image
from the provided GPU texture associated with context.
GPU texture must stay valid and unchanged until texture_release_proc
is called by Skia.
Skia will call texture_release_proc
with the passed-in release_context
when Image
is deleted or no longer refers to the texture.
A non-null Image
is returned if format of backend_texture
is recognized and supported.
Recognized formats vary by GPU backend.
Note: When using a DDL recording context, texture_release_proc
will be called on the
GPU thread after the DDL is played back on the direct context.
context
- GPU contextbackend_texture
- texture residing on GPUcolor_space
- This describes the color space of this image’s contents, as seen after sampling. In general, if the format of the backend texture is SRGB, some linearcolor_space
should be supplied (e.g.,ColorSpace::new_srgb_linear()
). If the format of the backend texture is linear, then thecolor_space
should include a description of the transfer function as well (e.g.,ColorSpace::new_srgb()
).texture_release_proc
- function called when texture can be releasedrelease_context
- state passed totexture_release_proc
Returns: createdImage
, orNone