-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathheader.ps
More file actions
157 lines (136 loc) · 2.93 KB
/
header.ps
File metadata and controls
157 lines (136 loc) · 2.93 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
%
% PS header for umat - SOM to PS converter
% Version 1.1 Wed June 28 1995
% Author: Jussi Hynninen <hynde@nucleus.hut.fi>
100 dict begin
% predefine variables
/yoff 0 def /xoff 0 def /xstep 0 def /ystep 0 def /y 0 def /radius 0 def
/yoffset 0 def /xoffset 0 def
/picwidth 0 def /picheight 0 def
/doborder false def
% default font
/fontname /Helvetica def
% font size relative to radius
/fontsize 1.0 def
% default black and white tresholds
/bt 0.0 def /wt 1.0 def
% labelpallon sade suhteessa hexan sateeseen
/ballrad 0.2 def
% newline function. Moves the y coordinate to the next line
/NL
{ /yoff yoff ystep sub def % next row
/y y 1 add def % add y by one
} bind def
% start of line (for hexagonal lattice) - moves the current position in
% x direction to the correct place of the line
/XSH
{ xoff
y 4 mod
dup 3 eq {pop 1} if
xstep 2 div mul
add
yoff moveto % move to start of line
} bind def
% start of line (for rectangular lattice) - moves the current position in
% x direction to the correct place of the line
/XSR { xoff yoff moveto } bind def
% set label color. If block is light -> label is black and same for dark block
/sbc { .5 gt {0} {1} ifelse setgray } bind def
% set gray level
/G {
100 div dup bt le {pop 0}
{ dup wt ge {pop 1} {bt sub wt bt sub div} ifelse
} ifelse
} bind def
% unlabelled node
/LN {
gsave
G sbc
currentpoint radius ballrad mul 0 360 arc fill
grestore
xstep 2 mul 0 rmoveto
} bind def
%select font
/selfont {
fontname findfont radius fontsize mul scalefont setfont
} bind def
% print single label
/LAB {
gsave
G sbc
dup %duplicate string
stringwidth
pop fontsize radius mul -0.25 mul exch
-2 div exch
rmoveto
show
grestore
xstep 2 mul 0 rmoveto
} bind def
% print multiple labels on one unit
/ML {
gsave
G sbc
/numlabs exch def %number of labels
numlabs
2 div
0.25 sub
radius fontsize mul mul neg
0 exch rmoveto
1 1 numlabs {
pop
gsave
dup %duplicate string
stringwidth
pop
-2 div 0
rmoveto
show
grestore
0 fontsize radius mul rmoveto
} for
grestore
xstep 2 mul 0 rmoveto
} bind def
% print hexagon
/H {
gsave
G dup setgray %duplicate gray level
currentpoint translate
newpath 0 radius moveto
5 {60 rotate 0 radius lineto} repeat
closepath
doborder { gsave fill grestore sbc stroke}
{ fill pop } ifelse
grestore
xstep 0 rmoveto
} bind def
% print rectangle
/R {
gsave
G dup setgray %duplicate gray level
currentpoint translate
newpath
xstep 0.5 mul dup moveto
xstep neg 0 rlineto
0 xstep neg rlineto
xstep 0 rlineto
closepath
doborder { gsave fill grestore sbc stroke}
{ fill pop } ifelse
grestore
xstep 0 rmoveto
} bind def
% swap x
/swapx {
/xstep xstep neg def
/xoffset picwidth xoffset sub def
} bind def
%swap y
/swapy {
/ystep ystep neg def
/yoffset picheight yoffset sub def
} bind def
1 setlinewidth
% End of umat PS header
% Start image