Skip to main content

OUTLINE

Constant OUTLINE 

Source
pub const OUTLINE: &str = "// An outer stroke `width` wide: the most alpha within reach, on two rings of taps, drawn in\n// `color` under the source.\nfn effect(uv: vec2f, src: vec4f) -> vec4f {\n    let taps = u32(clamp(max_filter_samples(), 8.0, 64.0));\n    let reach = params.width / builtin_aspect();\n    var cover = src.a;\n    for (var i = 0u; i < taps; i++) {\n        let angle = f32(i) * (BUILTIN_TAU / f32(taps));\n        let ring = select(1.0, 0.5, (i & 1u) == 1u);\n        cover = max(cover, sample_src(uv + vec2f(cos(angle), sin(angle)) * reach * ring).a);\n    }\n    let stroke = builtin_premultiply(params.color) * cover;\n    return src + stroke * (1.0 - src.a);\n}\n";
Expand description

Built-in outline body: an outer stroke from ring taps.