diff options
| author | Julie Lala <jules@okfoc.us> | 2015-08-18 00:29:20 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2015-08-18 00:29:20 -0400 |
| commit | 1ea6de86eb3d086971fced5123c18b8f41c64161 (patch) | |
| tree | dba89f3f14a61ff0d8ec1d55346d63dbba6b9db1 /js/photo.js | |
| parent | 99795bd1552a481dcb8f23e010e836ef06856447 (diff) | |
add basic webcam shaders
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, |
