mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 21:44:48 +02:00
Silhouette
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user