]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/ghostscript/gs_trap.ps
aux/cpuid: decode family and model bitfields
[plan9front.git] / sys / lib / ghostscript / gs_trap.ps
1 %    Copyright (C) 1999, 2000 Aladdin Enterprises.  All rights reserved.
2
3 % This software is provided AS-IS with no warranty, either express or
4 % implied.
5
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.
9
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.
15
16 % $Id: gs_trap.ps,v 1.6 2002/06/02 12:03:28 mpsuzuki Exp $
17 % PostScript LanguageLevel 3 in-RIP trapping support.
18
19 ll3dict begin
20
21 % We need LanguageLevel 2 or higher in order to have setuserparams and
22 % defineresource.
23 languagelevel dup 2 .max .setlanguagelevel
24
25 % ------ Trapping ------ %
26
27 % The PostScript-level trapping parameters are maintained in userdict,
28 % and explicitly reinstalled upon restore.
29
30 /Trapping mark
31
32 /settrapparams dup {            % <paramdict> settrapparams -
33   /.trapparams .uservar dup length dict .copydict
34   dup 2 index {
35                         % Stack: paramdict olddict olddict key value
36     2 index 2 index known { put dup } { pop pop } ifelse
37   } forall pop
38   dup .settrapparams    % Let the operator check parameter validity.
39   .userdict /.trapparams 3 -1 roll put pop
40 } bind .makeoperator
41
42 /.copyparams {          % <obj> .copyparams <obj'>
43   dup type /dicttype eq {
44     dup length dict .copydict
45     dup {
46       .copyparams 3 copy put pop pop
47     } forall
48   } {
49     dup type /arraytype eq {
50       [ exch { .copyparams } forall ]
51     } if
52   } ifelse
53 } odef
54
55 /currenttrapparams dup {        % - currenttrapparams <paramdict>
56   /.trapparams .uservar .copyparams
57 } bind .makeoperator
58
59 /settrapzone dup {              % - settrapzone -
60         % ****** DUMMY ******
61   newpath
62 } bind .makeoperator
63
64 % Define initial (dummy) trapping parameters.
65 % These values are mostly complete guesses.
66 userdict /.trapparams mark
67   /BlackColorLimit 1.0
68   /BlackDensityLimit 1.0
69   /BlackWidth 1.0
70   /ColorantZoneDetails 0 dict
71   /Enabled true
72   /HalftoneName null
73   /ImageInternalTrapping false
74   /ImagemaskTrapping true
75   /ImageResolution 1
76   /ImageToObjectTrapping true
77   /ImageTrapPlacement /Center
78   /SlidingTrapLimit 1.0
79   /StepLimit 1.0
80   /TrapColorScaling 0.0
81   /TrapSetName null
82   /TrapWidth 1.0
83 .dicttomark readonly put
84
85 .dicttomark /ProcSet defineresource pop
86
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
92 } forall
93
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
98
99 {1001} { dup /TrappingType defineresource pop } forall
100
101 .setlanguagelevel
102
103 end                     % ll3dict