Apply group blend mode when compositing group to main canvas
This commit is contained in:
parent
04511c607b
commit
f0964c7dfd
@ -2464,7 +2464,12 @@ class CanvasGraphics {
|
||||
currentMtx,
|
||||
dirtyBox
|
||||
);
|
||||
|
||||
// Apply the group blend mode and alpha when compositing the group
|
||||
const prevBlendMode = this.pushGroupBlendMode(this.ctx, group.blendMode);
|
||||
this.ctx.drawImage(groupCtx.canvas, 0, 0);
|
||||
this.popGroupBlendMode(this.ctx, prevBlendMode);
|
||||
|
||||
this.ctx.restore();
|
||||
this.compose(dirtyBox);
|
||||
}
|
||||
@ -3044,6 +3049,22 @@ class CanvasGraphics {
|
||||
}
|
||||
}
|
||||
|
||||
pushGroupBlendMode(ctx, blendMode) {
|
||||
if (!ctx || !blendMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const prev = ctx.globalCompositeOperation;
|
||||
ctx.globalCompositeOperation = blendMode;
|
||||
return prev;
|
||||
}
|
||||
|
||||
popGroupBlendMode(ctx, prev) {
|
||||
if (ctx && prev !== null) {
|
||||
ctx.globalCompositeOperation = prev;
|
||||
}
|
||||
}
|
||||
|
||||
isContentVisible() {
|
||||
for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
|
||||
if (!this.markedContentStack[i].visible) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user