Академический Документы
Профессиональный Документы
Культура Документы
All rights
reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
level2dict begin
/.makestackdict
{ { counttomark -1 roll } forall .dicttomark
} bind def
/currenthalftone % - currenthalftone <dict>
{ mark .currenthalftone
{ { exch pop } % halftone
{ /HalftoneType 1 % screen
{ /Frequency /Angle /SpotFunction }
.makestackdict
}
{ /HalftoneType 2 % colorscreen
{ /RedFrequency /RedAngle /RedSpotFunction
/GreenFrequency /GreenAngle /GreenSpotFunction
/BlueFrequency /BlueAngle /BlueSpotFunction
/GrayFrequency /GrayAngle /GraySpotFunction
}
.makestackdict
}
}
exch get exec
} odef
% Define sethalftone so it converts types 1-4 to type 5.
/.makehalftoneRGBV { % <dict> <type> <keys> <keysRGBV>
4 -1 roll exch { 1 index exch get exch } forall 15 1 roll
14 -2 roll mark 15 1 roll { /Gray /Blue /Green /Red } {
% stack: v0 v1 v2 type keys comp
mark
2 index 0 get 8 -1 roll
4 index 1 get 9 -1 roll
6 index 2 get 10 -1 roll
% stack: type keys comp mark k0 v0 k1 v1 k2 v2
/HalftoneType 10 index .dicttomark
counttomark 2 roll
} forall pop pop
/Default 1 index .dicttomark exch pop { .sethalftone5 }
} bind def
/.UserObjects {
.userdict /UserObjects
} odef
% In order to get proper error recovery behavior, we need to be careful
% not to pop any operands from the stack until we're done.
% The code below faithfully duplicates the apparent array-growing
% behavior of Adobe interpreters.
/defineuserobject { % <index> <value> defineuserobject -
.UserObjects .knownget {
length dup 3 index le {
% Stack: index value len
2 index eq { 1 index 2 mul } { 1 index 1 add } ifelse
.localvmarray .UserObjects get
1 index copy pop
.UserObjects 3 -1 roll put
} {
pop
} ifelse
} {
.UserObjects 3 index 1 add 10 .max .localvmarray put
} ifelse
.UserObjects get 2 index 2 index put pop pop
} odef
/execuserobject { % <index> execuserobject -
.UserObjects get 1 index get exch pop exec
} odef
/undefineuserobject { % <index> undefineuserobject -
.UserObjects get 1 index null put pop
} odef
end % level2dict