@ -212,15 +212,15 @@ var ColorSpace = (function ColorSpaceClosure() {
case 'DeviceCmykCS' :
case 'DeviceCmykCS' :
return this . singletons . cmyk ;
return this . singletons . cmyk ;
case 'CalGrayCS' :
case 'CalGrayCS' :
whitePoint = IR [ 1 ] . WhitePoint ;
whitePoint = IR [ 1 ] ;
blackPoint = IR [ 1 ] . BlackPoint ;
blackPoint = IR [ 2 ] ;
gamma = IR [ 1 ] . Gamma ;
gamma = IR [ 3 ] ;
return new CalGrayCS ( whitePoint , blackPoint , gamma ) ;
return new CalGrayCS ( whitePoint , blackPoint , gamma ) ;
case 'CalRGBCS' :
case 'CalRGBCS' :
whitePoint = IR [ 1 ] . WhitePoint ;
whitePoint = IR [ 1 ] ;
blackPoint = IR [ 1 ] . BlackPoint ;
blackPoint = IR [ 2 ] ;
gamma = IR [ 1 ] . Gamma ;
gamma = IR [ 3 ] ;
var matrix = IR [ 1 ] . Matrix ;
var matrix = IR [ 4 ] ;
return new CalRGBCS ( whitePoint , blackPoint , gamma , matrix ) ;
return new CalRGBCS ( whitePoint , blackPoint , gamma , matrix ) ;
case 'PatternCS' :
case 'PatternCS' :
var basePatternCS = IR [ 1 ] ;
var basePatternCS = IR [ 1 ] ;
@ -241,9 +241,9 @@ var ColorSpace = (function ColorSpaceClosure() {
return new AlternateCS ( numComps , ColorSpace . fromIR ( alt ) ,
return new AlternateCS ( numComps , ColorSpace . fromIR ( alt ) ,
PDFFunction . fromIR ( tintFnIR ) ) ;
PDFFunction . fromIR ( tintFnIR ) ) ;
case 'LabCS' :
case 'LabCS' :
whitePoint = IR [ 1 ] . WhitePoint ;
whitePoint = IR [ 1 ] ;
blackPoint = IR [ 1 ] . BlackPoint ;
blackPoint = IR [ 2 ] ;
var range = IR [ 1 ] . Range ;
var range = IR [ 3 ] ;
return new LabCS ( whitePoint , blackPoint , range ) ;
return new LabCS ( whitePoint , blackPoint , range ) ;
default :
default :
error ( 'Unknown name ' + name ) ;
error ( 'Unknown name ' + name ) ;
@ -287,7 +287,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 , alt ;
var numComps , params , alt , whitePoint , blackPoint , gamma ;
switch ( mode ) {
switch ( mode ) {
case 'DeviceGray' :
case 'DeviceGray' :
@ -300,11 +300,18 @@ var ColorSpace = (function ColorSpaceClosure() {
case 'CMYK' :
case 'CMYK' :
return 'DeviceCmykCS' ;
return 'DeviceCmykCS' ;
case 'CalGray' :
case 'CalGray' :
params = xref . fetchIfRef ( cs [ 1 ] ) . getAll ( ) ;
params = xref . fetchIfRef ( cs [ 1 ] ) ;
return [ 'CalGrayCS' , params ] ;
whitePoint = params . get ( 'WhitePoint' ) ;
blackPoint = params . get ( 'BlackPoint' ) ;
gamma = params . get ( 'Gamma' ) ;
return [ 'CalGrayCS' , whitePoint , blackPoint , gamma ] ;
case 'CalRGB' :
case 'CalRGB' :
params = xref . fetchIfRef ( cs [ 1 ] ) . getAll ( ) ;
params = xref . fetchIfRef ( cs [ 1 ] ) ;
return [ 'CalRGBCS' , params ] ;
whitePoint = params . get ( 'WhitePoint' ) ;
blackPoint = params . get ( 'BlackPoint' ) ;
gamma = params . get ( 'Gamma' ) ;
var matrix = params . get ( 'Matrix' ) ;
return [ 'CalRGBCS' , whitePoint , blackPoint , gamma , matrix ] ;
case 'ICCBased' :
case 'ICCBased' :
var stream = xref . fetchIfRef ( cs [ 1 ] ) ;
var stream = xref . fetchIfRef ( cs [ 1 ] ) ;
var dict = stream . dict ;
var dict = stream . dict ;
@ -356,8 +363,11 @@ var ColorSpace = (function ColorSpaceClosure() {
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 = xref . fetchIfRef ( cs [ 1 ] ) . getAll ( ) ;
params = xref . fetchIfRef ( cs [ 1 ] ) ;
return [ 'LabCS' , params ] ;
whitePoint = params . get ( 'WhitePoint' ) ;
blackPoint = params . get ( 'BlackPoint' ) ;
var range = params . get ( 'Range' ) ;
return [ 'LabCS' , whitePoint , blackPoint , range ] ;
default :
default :
error ( 'unimplemented color space object "' + mode + '"' ) ;
error ( 'unimplemented color space object "' + mode + '"' ) ;
}
}