Skip to main content

encode_image

Function encode_image 

pub fn encode_image<'a>(
    context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>,
    img: &RCHandle<SkImage>,
    options: &Options,
) -> Option<RCHandle<SkData>>
Expand description

Encode the provided image and return the resulting bytes. If the image was created as a texture-backed image on a GPU context, that context must be provided so the pixels can be read before being encoded. For raster-backed images, context can be None. options may be used to control the encoding behavior.

Returns None if the pixels could not be read or encoding otherwise fails.