Documentation / @ripl/terminal / dashPixels
Function: dashPixels() ​
dashPixels(
pattern,offset,plot):PixelCallback
Defined in: terminal/src/algorithms.ts:511
Wraps a plot callback so pixels landing in a dash gap are dropped.
Arc length is approximated by counting plotted pixels, which is exact for axis-aligned runs and up to √2 short on a diagonal — indistinguishable at braille resolution, and far cheaper than re-parameterizing every command by true arc length. A pattern with an odd number of entries is repeated to an even length, as canvas specifies.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
pattern | number[] | The dash pattern, alternating dash and gap lengths in pixels. |
offset | number | Distance into the pattern at which the first dash starts. |
plot | PixelCallback | The callback to gate. |
Returns ​
A callback that forwards only the pixels falling within a dash, or plot itself when the pattern describes a solid line.