diff options
Diffstat (limited to 'gs/lib/gs_trap.ps')
-rw-r--r-- | gs/lib/gs_trap.ps | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/gs/lib/gs_trap.ps b/gs/lib/gs_trap.ps new file mode 100644 index 000000000..c268fd6af --- /dev/null +++ b/gs/lib/gs_trap.ps @@ -0,0 +1,104 @@ +% Copyright (C) 1999 Aladdin Enterprises. All rights reserved. +% +% This file is part of Aladdin Ghostscript. +% +% Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author +% or distributor accepts any responsibility for the consequences of using it, +% or for whether it serves any particular purpose or works at all, unless he +% or she says so in writing. Refer to the Aladdin Ghostscript Free Public +% License (the "License") for full details. +% +% Every copy of Aladdin Ghostscript must include a copy of the License, +% normally in a plain ASCII text file named PUBLIC. The License grants you +% the right to copy, modify and redistribute Aladdin Ghostscript, but only +% under certain conditions described in the License. Among other things, the +% License requires that the copyright notice and this notice be preserved on +% all copies. + + +% PostScript LanguageLevel 3 in-RIP trapping support. + +ll3dict begin + +% We need LanguageLevel 2 or higher in order to have setuserparams and +% defineresource. +languagelevel dup 2 max .setlanguagelevel + +% ------ Trapping ------ % + +% The PostScript-level trapping parameters are maintained in userdict, +% and explicitly reinstalled upon restore. + +/Trapping mark + +/settrapparams dup { % <paramdict> settrapparams - + /.trapparams .uservar dup length dict .copydict + dup 2 index { + % Stack: paramdict olddict olddict key value + 2 index 2 index known { put dup } { pop pop } ifelse + } forall pop + dup .settrapparams % Let the operator check parameter validity. + .userdict /.trapparams 3 -1 roll put pop +} bind .makeoperator + +/.copyparams { % <obj> .copyparams <obj'> + dup type /dicttype eq { + dup length dict .copydict + dup { + .copyparams 3 copy put pop pop + } forall + } { + dup type /arraytype eq { + [ exch { .copyparams } forall ] + } if + } ifelse +} odef + +/currenttrapparams dup { % - currenttrapparams <paramdict> + /.trapparams .uservar .copyparams +} bind .makeoperator + +/settrapzone dup { % - settrapzone - + % ****** DUMMY ****** + newpath +} bind .makeoperator + +% Define initial (dummy) trapping parameters. +% These values are mostly complete guesses. +userdict /.trapparams mark + /BlackColorLimit 1.0 + /BlackDensityLimit 1.0 + /BlackWidth 1.0 + /ColorantZoneDetails 0 dict + /Enabled true + /HalftoneName null + /ImageInternalTrapping false + /ImageResolution 1 + /ImageToObjectTrapping true + /ImageTrapPlacement /Center + /SlidingTrapLimit 1.0 + /StepLimit 1.0 + /TrapColorScaling 0.0 + /TrapSetName null + /TrapWidth 1.0 +.dicttomark readonly put + +.dicttomark /ProcSet defineresource pop + +% Define the TrapParams resource category +{ /TrapParams } { + /Generic /Category findresource dup maxlength 3 add dict .copydict begin + /InstanceType /dicttype def + currentdict end /Category defineresource pop +} forall + +% Define the TrappingType resource category. +/Generic /Category findresource dup maxlength 3 add dict .copydict begin + /InstanceType /integertype def +/TrappingType currentdict end /Category defineresource pop + +{1001} { dup /TrappingType defineresource pop } forall + +.setlanguagelevel + +end % ll3dict |