mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Merge pull request #8266 from brendandahl/issue6652
Normalize blend mode names.
This commit is contained in:
commit
10e5f766a2
5 changed files with 134 additions and 17 deletions
|
@ -217,6 +217,50 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
}
|
||||
};
|
||||
|
||||
// Convert PDF blend mode names to HTML5 blend mode names.
|
||||
function normalizeBlendMode(value) {
|
||||
if (!isName(value)) {
|
||||
return 'source-over';
|
||||
}
|
||||
switch (value.name) {
|
||||
case 'Normal':
|
||||
case 'Compatible':
|
||||
return 'source-over';
|
||||
case 'Multiply':
|
||||
return 'multiply';
|
||||
case 'Screen':
|
||||
return 'screen';
|
||||
case 'Overlay':
|
||||
return 'overlay';
|
||||
case 'Darken':
|
||||
return 'darken';
|
||||
case 'Lighten':
|
||||
return 'lighten';
|
||||
case 'ColorDodge':
|
||||
return 'color-dodge';
|
||||
case 'ColorBurn':
|
||||
return 'color-burn';
|
||||
case 'HardLight':
|
||||
return 'hard-light';
|
||||
case 'SoftLight':
|
||||
return 'soft-light';
|
||||
case 'Difference':
|
||||
return 'difference';
|
||||
case 'Exclusion':
|
||||
return 'exclusion';
|
||||
case 'Hue':
|
||||
return 'hue';
|
||||
case 'Saturation':
|
||||
return 'saturation';
|
||||
case 'Color':
|
||||
return 'color';
|
||||
case 'Luminosity':
|
||||
return 'luminosity';
|
||||
}
|
||||
warn('Unsupported blend mode: ' + value.name);
|
||||
return 'source-over';
|
||||
}
|
||||
|
||||
var deferred = Promise.resolve();
|
||||
|
||||
var TILING_PATTERN = 1, SHADING_PATTERN = 2;
|
||||
|
@ -606,7 +650,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
});
|
||||
break;
|
||||
case 'BM':
|
||||
gStateObj.push([key, value]);
|
||||
gStateObj.push([key, normalizeBlendMode(value)]);
|
||||
break;
|
||||
case 'SMask':
|
||||
if (isName(value, 'None')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue