pub struct TextContrast {
pub gamma: f32,
pub contrast: f32,
}Expand description
The coverage remap applied to monochrome glyphs (see the module docs).
Fields§
§gamma: f32The exponent, relative to sRGB-encoded values, of the space the glyph
edge is blended in: 1.0 blends in sRGB-encoded values as FreeType
and most toolkits do, larger values move toward linear light (about
2.2), smaller values darken edges further. 0.0 turns the
correction off and the coverage is blended in linear light as is.
Clamped to 0.0..=4.0.
contrast: f32Extra weight given to partly covered pixels, coverage + (1 − coverage) · contrast · coverage, scaled down as the text gets
lighter (Skia’s contrast term). 0.0 adds none. Clamped to
0.0..=1.0.
Implementations§
Source§impl TextContrast
impl TextContrast
Sourcepub const OFF: Self
pub const OFF: Self
No correction: coverage is blended in linear light, as before this type existed.
Sourcepub const STRONGER: Self
pub const STRONGER: Self
Heavier edges on dark text than DEFAULT: the
blend of sRGB-encoded values, plus half the contrast term.
Sourcepub const STRONGEST: Self
pub const STRONGEST: Self
The heaviest edges this type offers: the blend of sRGB-encoded values, plus the full contrast term.
Sourcepub fn corrected_coverage(self, coverage: f32, text_rgb: [f32; 3]) -> f32
pub fn corrected_coverage(self, coverage: f32, text_rgb: [f32; 3]) -> f32
The coverage to blend in linear light for a glyph pixel of
coverage in text of linear colour text_rgb, so that the result
looks as if it had been blended in the space gamma
names. The CPU twin of the shader’s text_coverage; it reads the
parameters through the same packing so both see the same values.