1 % Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
3 % This software is provided AS-IS with no warranty, either express or
6 % This software is distributed under license and may not be copied,
7 % modified or distributed except as expressly authorized under the terms
8 % of the license contained in the file LICENSE in this distribution.
10 % For more information about licensing, please refer to
11 % http://www.ghostscript.com/licensing/. For information on
12 % commercial licensing, go to http://www.artifex.com/licensing/ or
13 % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14 % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
16 % $Id: gs_trap.ps,v 1.6 2002/06/02 12:03:28 mpsuzuki Exp $
17 % PostScript LanguageLevel 3 in-RIP trapping support.
21 % We need LanguageLevel 2 or higher in order to have setuserparams and
23 languagelevel dup 2 .max .setlanguagelevel
25 % ------ Trapping ------ %
27 % The PostScript-level trapping parameters are maintained in userdict,
28 % and explicitly reinstalled upon restore.
32 /settrapparams dup { % <paramdict> settrapparams -
33 /.trapparams .uservar dup length dict .copydict
35 % Stack: paramdict olddict olddict key value
36 2 index 2 index known { put dup } { pop pop } ifelse
38 dup .settrapparams % Let the operator check parameter validity.
39 .userdict /.trapparams 3 -1 roll put pop
42 /.copyparams { % <obj> .copyparams <obj'>
43 dup type /dicttype eq {
44 dup length dict .copydict
46 .copyparams 3 copy put pop pop
49 dup type /arraytype eq {
50 [ exch { .copyparams } forall ]
55 /currenttrapparams dup { % - currenttrapparams <paramdict>
56 /.trapparams .uservar .copyparams
59 /settrapzone dup { % - settrapzone -
64 % Define initial (dummy) trapping parameters.
65 % These values are mostly complete guesses.
66 userdict /.trapparams mark
68 /BlackDensityLimit 1.0
70 /ColorantZoneDetails 0 dict
73 /ImageInternalTrapping false
74 /ImagemaskTrapping true
76 /ImageToObjectTrapping true
77 /ImageTrapPlacement /Center
83 .dicttomark readonly put
85 .dicttomark /ProcSet defineresource pop
87 % Define the InkParams and TrapParams resource categories.
88 { /InkParams /TrapParams } {
89 /Generic /Category findresource dup maxlength 3 add dict .copydict begin
90 /InstanceType /dicttype def
91 currentdict end /Category defineresource pop
94 % Define the TrappingType resource category.
95 /Generic /Category findresource dup maxlength 3 add dict .copydict begin
96 /InstanceType /integertype def
97 /TrappingType currentdict end /Category defineresource pop
99 {1001} { dup /TrappingType defineresource pop } forall