mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Add support for blend modes.
This commit is contained in:
parent
c11a8a6e42
commit
523aa9c152
4 changed files with 24 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -497,6 +497,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
case 'FL':
|
||||
case 'CA':
|
||||
case 'ca':
|
||||
case 'BM':
|
||||
gsStateObj.push([key, value]);
|
||||
break;
|
||||
case 'Font':
|
||||
|
@ -506,11 +507,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
value[1]
|
||||
]);
|
||||
break;
|
||||
case 'BM':
|
||||
// We support the default so don't trigger the TODO.
|
||||
if (!isName(value) || value.name != 'Normal')
|
||||
TODO('graphic state operator ' + key);
|
||||
break;
|
||||
case 'SMask':
|
||||
// We support the default so don't trigger the TODO.
|
||||
if (!isName(value) || value.name != 'None')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue