diff options
Diffstat (limited to 'js/photo.js')
| -rw-r--r-- | js/photo.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/js/photo.js b/js/photo.js index 3f72cfc..d6f5f1e 100644 --- a/js/photo.js +++ b/js/photo.js @@ -108,7 +108,7 @@ var Photo = (function(){ null, null, ] - var colors = COLORS, recolor_fn = null, shade_fn = null + var colors = COLORS, recolor_fn = null, shade_fn = null, cc_recolor_fn = null var canvas = document.createElement("canvas"), ctx = canvas.getContext('2d'), pixels function set_colors (a) { @@ -120,6 +120,9 @@ var Photo = (function(){ function set_recolor_fn (fn) { recolor_fn = fn } + function set_cc_recolor_fn (fn) { + cc_recolor_fn = fn + } function closest_to(pixel){ if (recolor_fn) { @@ -162,6 +165,7 @@ var Photo = (function(){ } if (Photo.denoise) { denoise_pixel(data, w, h, i, j, pixel, Photo.denoise) } row[j] = closest_to(pixel) + if (cc_recolor_fn) row[j] = cc_recolor_fn(row[j]) } } if (! cb) return rows @@ -297,6 +301,7 @@ var Photo = (function(){ blues: BLUES, set_shade_fn: set_shade_fn, set_recolor_fn: set_recolor_fn, + set_cc_recolor_fn: set_cc_recolor_fn, set_colors: set_colors, closest_to: closest_to, distance: distance, |
