StackBlur
StackBlur copied to clipboard
Use jobleonard improvements
Over at https://observablehq.com/@jobleonard/mario-klingemans-stackblur there is a modernized shift table. There are a few things useful to this repo:
- Correctness: the shift operator is corrected from
>>to>>>so integers stay okay until the intended 255 radius. And lots of| 0to make sure. - Simplicity:
- The shift table is removed in favor of a fixed 24-shift so values become more readable
- Since stacks only work one way, an array is used instead
- Fewer stray variables for cleaner code
- Modern JS
In what way is the JS more modern? The source here is pretty modern.
Before accepting any non-obvious changes, I personally think we need some mocha + nyc testing, using some canvas or image testing library, to ensure current behavior is working as intended.