Skip to Content
valo
Drawing

Mask blur

Soften a draw's coverage. Four styles.

Mask blur is a Gaussian on the coverage mask, not on the pixels after the draw. Solid colours use a closed-form rrect blur (one quad). Shader paints and images blur a white mask of their shape in an effect layer, then fill it with their own colours, so a gradient or an image stays sharp inside the soft edge.

Sigma is in local units and follows the draw's transform. A save layer's paint takes no mask blur: blur a layer with an image filter.

paint.mask_blur = Some(MaskBlur::outer(12.0));
paint.setMaskBlur(12, BlurStyle.Outer);

Left to right: Normal, Solid, Inner, Outer.

scene.jsplayground
loading editor
liveacquiring device

Styles

StyleVisible coverage
NormalInside and outside
SolidSharp interior, blur outside
InnerInside only
OuterOutside only

Canvas2D shadowBlur is Normal and nothing else.

The same four styles on a filled rounded rect (top) and a stroked circle (bottom).

scene.jsplayground
loading editor
liveacquiring device

Mask blur is not the same as image-filter blur (which blurs rasterized pixels) or backdrop blur (which blurs what is already on the target).

On this page