mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[ts][canvas] Always set global alpha
This commit is contained in:
parent
d72885b296
commit
3ad80d076f
@ -8300,9 +8300,7 @@ var spine;
|
||||
}
|
||||
ctx.scale(1, -1);
|
||||
ctx.translate(-w / 2, -h / 2);
|
||||
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {
|
||||
ctx.globalAlpha = color.a;
|
||||
}
|
||||
ctx.globalAlpha = color.a;
|
||||
ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h);
|
||||
if (this.debugRendering)
|
||||
ctx.strokeRect(0, 0, w, h);
|
||||
@ -8348,9 +8346,7 @@ var spine;
|
||||
var color = this.tempColor;
|
||||
color.set(skeletonColor.r * slotColor.r * attachmentColor.r, skeletonColor.g * slotColor.g * attachmentColor.g, skeletonColor.b * slotColor.b * attachmentColor.b, alpha);
|
||||
var ctx = this.ctx;
|
||||
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {
|
||||
ctx.globalAlpha = color.a;
|
||||
}
|
||||
ctx.globalAlpha = color.a;
|
||||
for (var j = 0; j < triangles.length; j += 3) {
|
||||
var t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8;
|
||||
var x0 = vertices[t1], y0 = vertices[t1 + 1], u0 = vertices[t1 + 6], v0 = vertices[t1 + 7];
|
||||
@ -8471,4 +8467,4 @@ var spine;
|
||||
canvas.SkeletonRenderer = SkeletonRenderer;
|
||||
})(canvas = spine.canvas || (spine.canvas = {}));
|
||||
})(spine || (spine = {}));
|
||||
//# sourceMappingURL=spine-canvas.js.map
|
||||
//# sourceMappingURL=spine-canvas.js.map
|
||||
|
||||
@ -99,13 +99,11 @@ module spine.canvas {
|
||||
}
|
||||
ctx.scale(1, -1);
|
||||
ctx.translate(-w / 2, -h / 2);
|
||||
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {
|
||||
ctx.globalAlpha = color.a;
|
||||
// experimental tinting via compositing, doesn't work
|
||||
// ctx.globalCompositeOperation = "source-atop";
|
||||
// ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")";
|
||||
// ctx.fillRect(0, 0, w, h);
|
||||
}
|
||||
ctx.globalAlpha = color.a;
|
||||
// experimental tinting via compositing, doesn't work
|
||||
// ctx.globalCompositeOperation = "source-atop";
|
||||
// ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")";
|
||||
// ctx.fillRect(0, 0, w, h);
|
||||
ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h);
|
||||
if (this.debugRendering) ctx.strokeRect(0, 0, w, h);
|
||||
ctx.restore();
|
||||
@ -159,13 +157,11 @@ module spine.canvas {
|
||||
|
||||
let ctx = this.ctx;
|
||||
|
||||
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {
|
||||
ctx.globalAlpha = color.a;
|
||||
// experimental tinting via compositing, doesn't work
|
||||
// ctx.globalCompositeOperation = "source-atop";
|
||||
// ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")";
|
||||
// ctx.fillRect(0, 0, w, h);
|
||||
}
|
||||
ctx.globalAlpha = color.a;
|
||||
// experimental tinting via compositing, doesn't work
|
||||
// ctx.globalCompositeOperation = "source-atop";
|
||||
// ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")";
|
||||
// ctx.fillRect(0, 0, w, h);
|
||||
|
||||
for (var j = 0; j < triangles.length; j+=3) {
|
||||
let t1 = triangles[j] * 8, t2 = triangles[j+1] * 8, t3 = triangles[j+2] * 8;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user