mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
This is better
This commit is contained in:
+4
-2
@@ -78,12 +78,14 @@ class CanvasUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static drawImageWithTint(ctx, image, color, x, y, width, height) {
|
static drawImageWithTint(ctx, image, color, x, y, width, height) {
|
||||||
|
const fillStyle = ctx.fillStyle;
|
||||||
|
const globalAlpha = ctx.globalAlpha;
|
||||||
ctx.fillStyle = color;
|
ctx.fillStyle = color;
|
||||||
ctx.drawImage(image, x, y, width, height);
|
ctx.drawImage(image, x, y, width, height);
|
||||||
ctx.globalAlpha = 0.5;
|
ctx.globalAlpha = 0.5;
|
||||||
ctx.fillRect(x, y, width, height);
|
ctx.fillRect(x, y, width, height);
|
||||||
ctx.fillStyle = '#000000';
|
ctx.fillStyle = fillStyle;
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = globalAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
static shortenText(ctx, text, maxWidth) {
|
static shortenText(ctx, text, maxWidth) {
|
||||||
|
|||||||
Reference in New Issue
Block a user