Add support for blend modes.

This commit is contained in:
Brendan Dahl 2013-03-11 10:23:47 -07:00
parent c11a8a6e42
commit 523aa9c152
4 changed files with 24 additions and 5 deletions

View file

@ -561,6 +561,22 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.current.fillAlpha = state[1];
this.ctx.globalAlpha = state[1];
break;
case 'BM':
if (value && value.name && (value.name !== 'Normal')) {
var mode = value.name.replace(/([A-Z])/g,
function(c) {
return '-' + c.toLowerCase();
}
).substring(1);
this.ctx.globalCompositeOperation = mode;
if (this.ctx.globalCompositeOperation !== mode) {
warn('globalCompositeOperation "' + mode +
'" is not supported');
}
} else {
this.ctx.globalCompositeOperation = 'source-over';
}
break;
}
}
},