Function vizia::vg::image::images::deferred_from_encoded_data

pub fn deferred_from_encoded_data(
    data: impl Into<RCHandle<SkData>>,
    alpha_type: impl Into<Option<SkAlphaType>>,
) -> Option<RCHandle<SkImage>>
Expand description

Return a Image using the encoded data, but attempts to defer decoding until the image is actually used/drawn. This deferral allows the system to cache the result, either on the CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may be purged, causing the next draw of the image to have to re-decode.

If alpha_type is None, the image’s alpha type will be chosen automatically based on the image format. Transparent images will default to AlphaType::Premul. If alpha_type contains AlphaType::Premul or AlphaType::Unpremul, that alpha type will be used. Forcing opaque (passing AlphaType::Opaque) is not allowed, and will return None.

If the encoded format is not supported, None is returned.

  • encoded - the encoded data Returns: created Image, or None

example: https://fiddle.skia.org/c/@Image_DeferredFromEncodedData