|
|
@ -262,7 +262,7 @@ var ColorSpace = (function ColorSpaceClosure() { |
|
|
|
} else if (isArray(cs)) { |
|
|
|
} else if (isArray(cs)) { |
|
|
|
mode = xref.fetchIfRef(cs[0]).name; |
|
|
|
mode = xref.fetchIfRef(cs[0]).name; |
|
|
|
this.mode = mode; |
|
|
|
this.mode = mode; |
|
|
|
var numComps, params; |
|
|
|
var numComps, params, alt; |
|
|
|
|
|
|
|
|
|
|
|
switch (mode) { |
|
|
|
switch (mode) { |
|
|
|
case 'DeviceGray': |
|
|
|
case 'DeviceGray': |
|
|
@ -284,6 +284,17 @@ var ColorSpace = (function ColorSpaceClosure() { |
|
|
|
var stream = xref.fetchIfRef(cs[1]); |
|
|
|
var stream = xref.fetchIfRef(cs[1]); |
|
|
|
var dict = stream.dict; |
|
|
|
var dict = stream.dict; |
|
|
|
numComps = dict.get('N'); |
|
|
|
numComps = dict.get('N'); |
|
|
|
|
|
|
|
alt = dict.get('Alternate'); |
|
|
|
|
|
|
|
if (alt) { |
|
|
|
|
|
|
|
var altIR = ColorSpace.parseToIR(alt, xref, res); |
|
|
|
|
|
|
|
// Parse the /Alternate CS to ensure that the number of components
|
|
|
|
|
|
|
|
// are correct, and also (indirectly) that it is not a PatternCS.
|
|
|
|
|
|
|
|
var altCS = ColorSpace.fromIR(altIR); |
|
|
|
|
|
|
|
if (altCS.numComps === numComps) { |
|
|
|
|
|
|
|
return altIR; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
warn('ICCBased color space: Ignoring incorrect /Alternate entry.'); |
|
|
|
|
|
|
|
} |
|
|
|
if (numComps === 1) { |
|
|
|
if (numComps === 1) { |
|
|
|
return 'DeviceGrayCS'; |
|
|
|
return 'DeviceGrayCS'; |
|
|
|
} else if (numComps === 3) { |
|
|
|
} else if (numComps === 3) { |
|
|
@ -316,11 +327,11 @@ var ColorSpace = (function ColorSpaceClosure() { |
|
|
|
} else if (isArray(name)) { |
|
|
|
} else if (isArray(name)) { |
|
|
|
numComps = name.length; |
|
|
|
numComps = name.length; |
|
|
|
} |
|
|
|
} |
|
|
|
var alt = ColorSpace.parseToIR(cs[2], xref, res); |
|
|
|
alt = ColorSpace.parseToIR(cs[2], xref, res); |
|
|
|
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); |
|
|
|
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); |
|
|
|
return ['AlternateCS', numComps, alt, tintFnIR]; |
|
|
|
return ['AlternateCS', numComps, alt, tintFnIR]; |
|
|
|
case 'Lab': |
|
|
|
case 'Lab': |
|
|
|
params = cs[1].getAll(); |
|
|
|
params = xref.fetchIfRef(cs[1]).getAll(); |
|
|
|
return ['LabCS', params]; |
|
|
|
return ['LabCS', params]; |
|
|
|
default: |
|
|
|
default: |
|
|
|
error('unimplemented color space object "' + mode + '"'); |
|
|
|
error('unimplemented color space object "' + mode + '"'); |
|
|
|