Skip to main content

cap_and_encode

Function cap_and_encode 

Source
fn cap_and_encode(img: RgbaImage, cap: i32) -> Option<CappedSprite>
Expand description

Apply the size cap to a premultiplied sprite and encode it as a straight-alpha PNG.

cap <= 0, or a sprite already within it, is encoded at its source size. Resizing happens while the pixels are still premultiplied — filtering straight alpha pulls the (zero) color of transparent texels into the edges and leaves a dark fringe, and Lanczos3 overshoot has no headroom to land in — which is the order the X11 XFixes path uses.