};
constructor.parse = function colorspace_parse(cs, xref, res) {
- var IR = constructor.parseToIR(cs, xref, res);
- return constructor.fromIR(IR);
+ var IR = constructor.parseToIR(cs, xref, res, true);
+ if (!(IR instanceof SeparationCS)) {
+ return constructor.fromIR(IR);
+ } else {
+ return IR
+ }
};
constructor.fromIR = function(raw) {
return null;
}
- constructor.parseToIR = function colorspace_parse(cs, xref, res) {
+ constructor.parseToIR = function colorspace_parse(cs, xref, res, parseOnly) {
if (IsName(cs)) {
var colorSpaces = res.get('ColorSpace');
if (IsDict(colorSpaces)) {
var hiVal = cs[2] + 1;
var lookup = xref.fetchIfRef(cs[3]);
return ["IndexedCS", baseCS, hiVal, lookup];
- case 'Separation':
- error("Need to implement IR form for SeparationCS");
-
- // var name = cs[1];
- // var alt = ColorSpace.parse(cs[2], xref, res);
- // var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3]));
- // return new SeparationCS(alt, tintFn);
+ case 'Separation':
+ if (!parseOnly) {
+ error("Need to implement IR form for SeparationCS");
+ } else {
+ var name = cs[1];
+ var alt = ColorSpace.parse(cs[2], xref, res);
+ var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3]));
+ return new SeparationCS(alt, tintFn);
+ }
case 'Lab':
case 'DeviceN':
default:
baseBuf[pos++] = 255 * tinted[j];
}
return base.getRgbBuffer(baseBuf, 8);
-
}
};