glyphTint
The finished ASCII look: each character tinted with its cell's color, everything else transparent.
glyphTint(slots: {
grid: FragmentStage
cell: FragmentStage
glyph: FragmentStage
alphaThreshold: PropRef
preserveAlpha: PropRef
}): FragmentStage
Import effects from shaders/std and use effects.stylize.glyphTint.
Returns the fragment for gpu.fragment. Cells whose alpha is below alphaThreshold (0 to 1) turn transparent. With preserveAlpha on, the output keeps the alpha of the layer inside; off, visible characters are fully opaque.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
grid: FragmentStage
cell: FragmentStage
glyph: FragmentStage
alphaThreshold: PropRef
preserveAlpha: PropRef
}` | |
Example
gpu: {fragment: glyphTint({grid, cell, glyph, alphaThreshold: p('alphaThreshold'), preserveAlpha: p('preserveAlpha')})}
See also
glyphFor— The character drawn in each cell, picked by how bright the cell is.charGrid— The character grid: which cell each pixel falls in, and where it sits inside that cell.