Silhouette

This commit is contained in:
Daniel Odendahl Jr
2017-10-13 23:33:57 +00:00
parent d958ea62a3
commit a829bc8de1
3 changed files with 81 additions and 5 deletions
+11
View File
@@ -83,6 +83,17 @@ class Util {
ctx.putImageData(data, x, y);
return ctx;
}
static silhouette(ctx, x, y, width, height) {
const data = ctx.getImageData(x, y, width, height);
for (let i = 0; i < data.data.length; i += 4) {
data.data[i] = 0;
data.data[i + 1] = 0;
data.data[i + 2] = 0;
}
ctx.putImageData(data, x, y);
return ctx;
}
}
module.exports = Util;