Debian Codegraph @

Resource/Init/gs_trap.ps

raw
1 % Copyright (C) 2001-2023 Artifex Software, Inc.
2 % All Rights Reserved.
3 %
4 % This software is provided AS-IS with no warranty, either express or
5 % implied.
6 %
7 % This software is distributed under license and may not be copied,
8 % modified or distributed except as expressly authorized under the terms
9 % of the license contained in the file LICENSE in this distribution.
10 %
11 % Refer to licensing information at http://www.artifex.com or contact
12 % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
13 % CA 94129, USA, for further information.
14 %
15
16 % PostScript LanguageLevel 3 in-RIP trapping support.
17
18 ll3dict begin
19
20 % We need LanguageLevel 2 or higher in order to have setuserparams and
21 % defineresource.
22 languagelevel dup 2 .max .setlanguagelevel
23
24 % ------ Trapping ------ %
25
26 % The PostScript-level trapping parameters are maintained in userdict,
27 % and explicitly reinstalled upon restore.
28
29 /Trapping mark
30
31 /settrapparams dup { % <paramdict> settrapparams -
32 /.trapparams .uservar dup length dict .copydict
33 dup 2 index {
34 % Stack: paramdict olddict olddict key value
35 2 index 2 index known { put dup } { pop pop } ifelse
36 } forall pop
37 dup .settrapparams % Let the operator check parameter validity.
38 .userdict /.trapparams 3 -1 roll put pop
39 } .internalbind .makeoperator
40
41 /.copyparams { % <obj> .copyparams <obj'>
42 dup type /dicttype eq {
43 dup length dict .copydict
44 dup {
45 .copyparams 3 copy put pop pop
46 } forall
47 } {
48 dup type /arraytype eq {
49 [ exch { .copyparams } forall ]
50 } if
51 } ifelse
52 } odef
53
54 /currenttrapparams dup { % - currenttrapparams <paramdict>
55 /.trapparams .uservar .copyparams
56 } .internalbind executeonly .makeoperator
57
58 /settrapzone dup { % - settrapzone -
59 % ****** DUMMY ******
60 newpath
61 } .internalbind .makeoperator
62
63 % Define initial (dummy) trapping parameters.
64 % These values are mostly complete guesses.
65 userdict /.trapparams mark
66 /BlackColorLimit 1.0
67 /BlackDensityLimit 1.0
68 /BlackWidth 1.0
69 /ColorantZoneDetails 0 dict
70 /Enabled //true
71 /HalftoneName //null
72 /ImageInternalTrapping //false
73 /ImagemaskTrapping //true
74 /ImageResolution 1
75 /ImageToObjectTrapping //true
76 /ImageTrapPlacement /Center
77 /SlidingTrapLimit 1.0
78 /StepLimit 1.0
79 /TrapColorScaling 0.0
80 /TrapSetName //null
81 /TrapWidth 1.0
82 .dicttomark readonly put
83
84 .dicttomark /ProcSet defineresource pop
85
86 % Define the InkParams and TrapParams resource categories.
87 { /InkParams /TrapParams } {
88 /Generic /Category findresource dup maxlength 3 add dict .copydict begin
89 /InstanceType /dicttype def
90 currentdict end /Category defineresource pop
91 } forall
92
93 % Define the TrappingType resource category.
94 /Generic /Category findresource dup maxlength 3 add dict .copydict begin
95 /InstanceType /integertype def
96 /TrappingType currentdict end /Category defineresource pop
97
98 {1001} { dup /TrappingType defineresource pop } forall
99
100 .setlanguagelevel
101
102 end % ll3dict