mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Support Blend Modes which are specified in an Array of Names (issue 11279)
According to the specification, the first *supported* Blend Mode should be choosen in this case; please see https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G10.4848607
This commit is contained in:
parent
4a5a4328f4
commit
5c266f0e8c
4 changed files with 28 additions and 2 deletions
|
@ -125,8 +125,23 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
};
|
||||
|
||||
// Convert PDF blend mode names to HTML5 blend mode names.
|
||||
function normalizeBlendMode(value) {
|
||||
function normalizeBlendMode(value, parsingArray = false) {
|
||||
if (Array.isArray(value)) {
|
||||
// Use the first *supported* BM value in the Array (fixes issue11279.pdf).
|
||||
for (let i = 0, ii = value.length; i < ii; i++) {
|
||||
const maybeBM = normalizeBlendMode(value[i], /* parsingArray = */ true);
|
||||
if (maybeBM) {
|
||||
return maybeBM;
|
||||
}
|
||||
}
|
||||
warn(`Unsupported blend mode Array: ${value}`);
|
||||
return 'source-over';
|
||||
}
|
||||
|
||||
if (!isName(value)) {
|
||||
if (parsingArray) {
|
||||
return null;
|
||||
}
|
||||
return 'source-over';
|
||||
}
|
||||
switch (value.name) {
|
||||
|
@ -164,7 +179,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
case 'Luminosity':
|
||||
return 'luminosity';
|
||||
}
|
||||
warn('Unsupported blend mode: ' + value.name);
|
||||
if (parsingArray) {
|
||||
return null;
|
||||
}
|
||||
warn(`Unsupported blend mode: ${value.name}`);
|
||||
return 'source-over';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue