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.
Styles
| Style | Visible coverage |
|---|---|
Normal | Inside and outside |
Solid | Sharp interior, blur outside |
Inner | Inside only |
Outer | Outside only |
Canvas2D shadowBlur is Normal and nothing else.
The same four styles on a filled rounded rect (top) and a stroked circle (bottom).
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).