pub fn encode_image(
data: &ImageData,
sampler: ImageSampler,
paint_transform: Affine,
encoded_paints: &mut Vec<EncodedPaint>,
images: &mut ImageResidency,
) -> Result<ImageEncoding, ImageSkip>Expand description
Make data resident and append its encoded entry, returning the paint that
references it.
paint_transform is the forward mapping from the image’s natural pixel
rectangle onto device space; the entry stores its inverse, because that is
the direction the shader applies it in (device fragment to image texel).
A sampler alpha below one is folded into the entry’s tint rather than
carried on the sampler: vello_common’s own image encoding
unimplemented!()s on a non-unit sampler alpha, and the shader has no alpha
field to read one from — but it always multiplies by a tint, so an identity
tint scaled by the alpha produces exactly the same result with nothing left
unimplemented on the frame path (E17).
§Errors
Returns the ImageSkip the residency refused the image with, or
ImageSkip::SingularTransform when paint_transform has no finite
inverse.