summaryrefslogtreecommitdiff
path: root/Master/xemtex/gslib/gs_trap.ps
blob: a3d37d3bd3f808e72eee823f4a1bc16c2cb55b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
%    Copyright (C) 1999, 2000 Aladdin Enterprises.  All rights reserved.
% 
% This program is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2 of the License, or (at your
% option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
% Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 59 Temple Place, Suite 330, Boston, MA, 02111-1307.

% $Id: gs_trap.ps,v 1.3.6.2.2.1 2003/04/12 14:02:38 giles Exp $
% 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
  /ImagemaskTrapping true
  /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 InkParams and TrapParams resource categories.
{ /InkParams /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