mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
Pixelize as a part of CanvasUtil
This commit is contained in:
@@ -117,6 +117,14 @@ module.exports = class CanvasUtil {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static pixelize(ctx, level, x, y, width, height) {
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.drawImage(data, x, y, width * level, height * level);
|
||||
ctx.drawImage(canvas, x, y, width * level, height * level, x, y, width, height);
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static hasAlpha(image) {
|
||||
const canvas = createCanvas(image.width, image.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
Reference in New Issue
Block a user