summaryrefslogtreecommitdiff
path: root/Master/xemtex/gslib/zeroline.ps
blob: 7411a170d64fc6724cdb31a33c46d397292b9161 (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
%!
%    Copyright (C) 1994 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: zeroline.ps,v 1.2.6.1.2.1 2003/04/12 14:02:39 giles Exp $
% zeroline.ps
% Test file to determine how other PostScript implementations handle
% filling zero-width lines under a variety of conditions.

% Add a small "fan" of zero-width lines at different angles to the path.
/fan
 { currentpoint 100 0 rlineto
   2 copy moveto 100 20 rlineto
   2 copy moveto 100 100 rlineto
   2 copy moveto 20 100 rlineto
   moveto 0 100 rlineto
 } def

% Append a rectangle to the current path.
/rectappend
 { 4 -2 roll moveto 1 index 0 rlineto 0 exch rlineto
   neg 0 rlineto closepath
 } def
% Fill a rectangle.
/rectfill
 { gsave newpath rectappend fill grestore
 } def
% Stroke a rectangle.
/rectstroke
 { gsave newpath rectappend stroke grestore
 } def
% Clip to a rectangle.  Unlike the real rectclip,
% this clear the current path.
/rectclip
 { newpath rectappend clip newpath
 } def

40 40 translate

% Display fans of different colors on different backgrounds.
gsave
0 setgray
0 0 120 120 rectstroke
10 10 moveto fan fill
140 0 translate
0 setgray
0 0 120 120 rectstroke
0.8 setgray
10 10 moveto fan fill
140 0 translate
0 setgray
0 0 120 120 rectfill
1 setgray
10 10 moveto fan fill
grestore
0 140 translate

% Display rectangles with two edges coincident.
gsave
newpath
0 setgray
0 0 40 40 rectappend
0 0 20 20 rectappend
eofill
60 0 translate
0 0 40 40 rectappend
40 0 -20 20 rectappend
fill
grestore
0 60 translate

% Display superimposed lines.
gsave
/super
 { currentpoint fan
   2 copy moveto 20 0 rmoveto 50 0 rlineto
   2 copy moveto 20 4 rmoveto 50 10 rlineto
   2 copy moveto 20 20 rmoveto 50 50 rlineto
   2 copy moveto 4 20 rmoveto 10 50 rlineto
   moveto 0 20 rmoveto 0 50 rlineto
 } def
0 setgray
0 0 moveto super fill
140 0 translate 0 0 moveto super eofill
grestore
0 140 translate

showpage