diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-03-22 11:36:42 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-03-22 11:36:42 -0400 |
| commit | 6a30feead73dbee2d664b0099efcdc5106096c55 (patch) | |
| tree | 25685907394a49d2e22637f7e5c649904e09c4dc /js/photo.js | |
| parent | 858587af95cfd02341cee1ec1f63c560f6944145 (diff) | |
| parent | b55c277f18a56cb6c6f85df968111f230e828b07 (diff) | |
Merge branch 'master' of lmno:ascii
Diffstat (limited to 'js/photo.js')
| -rw-r--r-- | js/photo.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/js/photo.js b/js/photo.js index ae4558e..3f72cfc 100644 --- a/js/photo.js +++ b/js/photo.js @@ -108,12 +108,15 @@ var Photo = (function(){ null, null, ] - var colors = COLORS, recolor_fn = null + var colors = COLORS, recolor_fn = null, shade_fn = null var canvas = document.createElement("canvas"), ctx = canvas.getContext('2d'), pixels function set_colors (a) { colors = a } + function set_shade_fn (fn) { + shade_fn = fn + } function set_recolor_fn (fn) { recolor_fn = fn } @@ -154,6 +157,9 @@ var Photo = (function(){ pixel[1] = data[t+1] pixel[2] = data[t+2] pixel[3] = data[t+3] + if (shade_fn) { + shade_fn(data, pixel, j, i, w, h) + } if (Photo.denoise) { denoise_pixel(data, w, h, i, j, pixel, Photo.denoise) } row[j] = closest_to(pixel) } @@ -289,6 +295,7 @@ var Photo = (function(){ reds: REDS, yellows: YELLOWS, blues: BLUES, + set_shade_fn: set_shade_fn, set_recolor_fn: set_recolor_fn, set_colors: set_colors, closest_to: closest_to, |
