1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Shared softness stand-in: the low-opacity copies components draw in place of a real gaussian.
//!
//! A component is compiled in only when its own Cargo feature is on, so a softness stand-in two
//! components share cannot live in either of them. This module holds the one set the character- and
//! word-level reveals share; it is **not** the only set in the crate. The word-level components
//! [`blur_slide_text`](crate::components::blur_slide_text) and
//! [`text_build`](crate::components::text_build) each carry their own local constants, with
//! deliberately different numbers (a 10 px reference, a 0.35 cap, a 0.6 spread ratio and a single
//! trailing copy), and they are independent of these.
//!
//! Source: <https://github.com/Remocn/remocn> (MIT).
use crateclamp01;
/// Softness radius at which the secondary copies reach [`BLUR_GHOST_MAX_ALPHA`], in reference px.
pub const BLUR_GHOST_REFERENCE_PX: f32 = 12.0;
/// Total opacity the secondary copies reach at [`BLUR_GHOST_REFERENCE_PX`].
///
/// The source's gaussian is isotropic; this stand-in spreads the budget over
/// [`BLUR_GHOST_COPIES`] offset copies, so each one is dimmer than the single trailing copy of
/// the word-level components.
pub const BLUR_GHOST_MAX_ALPHA: f32 = 0.45;
/// How many offsets the softness stand-in draws per glyph.
pub const BLUR_GHOST_COPIES: usize = 2;
/// Displacement of the furthest secondary copy per px of softness radius.
pub const BLUR_GHOST_SPREAD_RATIO: f32 = 0.5;
/// Below this softness radius no secondary copy is drawn.
pub const BLUR_GHOST_MIN_PX: f32 = 0.05;
/// Alpha of each secondary copy for a softness radius in canvas px.
///
/// The reference radius is the configured starting softness brought onto the canvas, so the budget
/// is spent exactly when a glyph starts at full softness.