summaryrefslogtreecommitdiff
path: root/js/photo.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/photo.js')
-rw-r--r--js/photo.js9
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,