Skip to main content

encode_image_command

Function encode_image_command 

Source
pub fn encode_image_command(
    data: &ImageData,
    dest: Rect,
    transform: Affine,
    encoded_paints: &mut Vec<EncodedPaint>,
    images: &mut ImageResidency,
) -> Result<ImageEncoding, ImageSkip>
Expand description

Encode a Command::Image: data’s natural pixel rectangle scaled to fill dest, under transform.

The natural-to-dest composition is crate::gpu::atlas::natural_to_dest, the same one frust-render’s CPU-tier lowering applies, so an image lands on identical device pixels whichever tier drew it. The sampler is the display list’s own default — ImageQuality::Medium (bilinear) with padded extends, since a Command::Image carries no sampling parameters of its own and a scaled image filtered at nearest would be visibly worse than the CPU tier’s output.

§Errors

Returns the ImageSkip the residency refused the image with, ImageSkip::SingularTransform for a transform with no inverse, or ImageSkip::DegenerateExtent when data has no natural area to scale from.