]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/ghostscript/lines.ps
etherbcm: handle 64-bit host addresses, use PCIWADDR() instead of PADDR()
[plan9front.git] / sys / lib / ghostscript / lines.ps
1 %!
2 %   Copyright (C) 1989, 1990, 1992, 1994, 1996 Aladdin Enterprises.  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 % For more information about licensing, please refer to
12 % http://www.ghostscript.com/licensing/. For information on
13 % commercial licensing, go to http://www.artifex.com/licensing/ or
14 % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
15 % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
16
17 % $Id: lines.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
18 % Test line rendering (stroke).
19
20 % Exercise the miter limit.  The left column of lines should bevel at
21 % 90 degrees, the right column at 60 degrees.
22
23 gsave
24 1.8 setlinewidth
25 0 setgray
26 15 15 scale
27 -5 5 translate
28 [1.415 2.0]
29  { setmiterlimit 12 0 translate 0 0 moveto
30    10 30 360
31     { gsave 5 0 rlineto rotate 2.5 0 rlineto
32       gsave 0 setlinewidth 1 0 0 setrgbcolor stroke grestore
33       strokepath 0 setlinewidth stroke
34       grestore
35       0 4 rmoveto
36     } for
37  } forall
38
39 showpage
40 grestore
41
42 % Exercise all the combinations of cap and join styles
43 % for one-line, two-line, and closed paths.
44
45 gsave
46
47 /drawlines {
48 gsave
49 2.0 setmiterlimit
50 2.0 setlinewidth
51 6 6 scale
52 5 20 translate
53 {0 1 2}                         % line cap
54  { setlinecap gsave
55    {0 1 2}                      % line join
56     { setlinejoin gsave
57       { {currentpoint lineto}
58         {3 7 lineto}
59         {3 7 lineto 5 1 lineto}
60         {3 7 lineto 6 3 lineto closepath}
61       }
62        { gsave 0 0 moveto exec
63          gsave stroke grestore
64          0.5 setlinewidth 1 0 0 setrgbcolor stroke
65          grestore 8 0 translate
66        } forall
67       grestore 35 0 translate
68     } forall
69    grestore 0 20 translate
70  } forall
71 grestore
72 } def
73 /xflip
74  { 8.5 72 mul 0 translate -1 1 scale
75  } def
76 /rot90
77  { 90 rotate 0 -9.75 72 mul translate
78  } def
79 /rot180
80  { rot90 rot90
81  } def
82 /rot270
83  { rot180 rot90
84  } def
85
86 drawlines showpage
87 gsave xflip drawlines grestore showpage
88 gsave rot90 drawlines grestore showpage
89 gsave rot90 xflip drawlines grestore showpage
90 gsave drawlines rot180 showpage
91 gsave rot180 xflip drawlines grestore showpage
92 gsave rot270 drawlines grestore showpage
93 gsave rot270 xflip drawlines grestore showpage
94 grestore
95
96 % Here are some boundary conditions, contributed by Mark Rawling.
97
98 gsave
99 1 setlinecap
100 2.6 setmiterlimit
101 3.0 setlinewidth
102
103 5 5 scale
104 10 20 translate
105
106 % [ 0.5 sqrt dup dup dup neg exch 0 0 ] concat  % 45 rotate
107
108 {0 1 2}                        % line join
109 {
110     setlinejoin gsave
111     0 0 moveto 0 10 lineto 10 0 lineto gsave stroke grestore
112     15 0 translate
113     0 0 moveto 0 10 lineto 10 20 lineto gsave stroke grestore
114     15 0 translate
115     10 0 moveto 10 10 lineto 0 20 lineto gsave stroke grestore
116     15 0 translate
117     10 0 moveto 10 10 lineto 0 0 lineto gsave stroke grestore
118     grestore
119     gsave
120     0 20 translate
121     0 20 moveto 0 10 lineto 10 20 lineto gsave stroke grestore
122     15 0 translate
123     0 20 moveto 0 10 lineto 10 0 lineto gsave stroke grestore
124     15 0 translate
125     10 20 moveto 10 10 lineto 0 0 lineto gsave stroke grestore
126     15 0 translate
127     10 20 moveto 10 10 lineto 0 20 lineto gsave stroke grestore
128     grestore 60 0 translate
129 } forall
130
131 showpage
132 grestore
133
134 % Test narrow lines at a variety of angles.
135
136 gsave
137
138 /rad 120 def
139 /ray { gsave rotate 0 0 moveto rad 0 rlineto stroke grestore } def
140 /star
141  { newpath gsave
142    gsave 0.5 setgray 0 0 rad 0 360 arc stroke grestore
143    0 90 359
144     { rotate 
145       0 3 14 { ray } for
146       15 15 89 { ray } for
147     } for
148    grestore
149  } def
150
151 0 setgray
152 150 150 translate
153 [ [ 0 0.5 1 ] [ 1.5 2 2.5 ] [ 3 3.5 4 ] ]
154  { gsave
155     { setlinewidth star
156       250 0 translate
157     } forall
158    grestore 0 250 translate
159  } forall
160
161 grestore showpage
162
163 % End
164
165 quit