| 1 |
%====================================================================== |
| 2 |
% This is |
| 3 |
% rook.mf |
| 4 |
% |
| 5 |
% Copyright (C) 1989-93 by Elmar Bartel. |
| 6 |
% |
| 7 |
% This program is free software; you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation; either version 1, or (at your option) |
| 10 |
% any later version. |
| 11 |
% |
| 12 |
% This program is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% You should have received a copy of the GNU General Public License |
| 18 |
% along with this program; if not, write to the Free Software |
| 19 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 |
%====================================================================== |
| 21 |
|
| 22 |
def MakeRookPath = |
| 23 |
|
| 24 |
numeric wdbotta,wdbottb,wdstem,wdtop; % The widths |
| 25 |
numeric htbotta,htbottb,htbottc,httopa,httopb; |
| 26 |
numeric x[]; numeric y[]; |
| 27 |
|
| 28 |
wdbotta:= .90 BottomWidth; |
| 29 |
wdbottb:= .72 BottomWidth; |
| 30 |
wdstem := .51 BottomWidth; |
| 31 |
wdtop := .74 BottomWidth; |
| 32 |
|
| 33 |
htbotta:= .12BottomWidth; |
| 34 |
htbottb:= .16BottomWidth; |
| 35 |
htbottc:= .12BottomWidth; |
| 36 |
httopa := .13BottomWidth; |
| 37 |
httopb := .20BottomWidth; |
| 38 |
|
| 39 |
rt x1 = rt x3 = .5(qs+wdbotta); |
| 40 |
lft x2 = lft x4 = .5(qs-wdbotta); |
| 41 |
bot y1 = bot y2 = BottomSpace; |
| 42 |
top y3 = top y4 = BottomSpace+htbotta; |
| 43 |
|
| 44 |
y5 = y6 = y4; |
| 45 |
top y8 - bot y6 = top y7 - bot y5 = htbottb; |
| 46 |
rt x5 = rt x7 = .5(qs+wdbottb); |
| 47 |
lft x6 = lft x8 = .5(qs-wdbottb); |
| 48 |
|
| 49 |
top y9 - bot y7 = top y10 - bot y8 = htbottc; |
| 50 |
rt x9 = rt x11 = .5(qs+wdstem); |
| 51 |
lft x10 = lft x12 = .5(qs-wdstem); |
| 52 |
top y13 - bot y11 = top y14 - bot y12 = httopa; |
| 53 |
top y15 - bot y13 = top y16 - bot y14 = httopb; |
| 54 |
top y15 = top y16 = qs - TopSpace + .01qs; |
| 55 |
rt x13 = rt x15 = .5(qs+wdtop); |
| 56 |
lft x14 = lft x16 = .5(qs-wdtop); |
| 57 |
|
| 58 |
path LeftP,RightP,RookPath,SmP[]; |
| 59 |
LeftP= z16--z14--z12--z10--z8--z6--z4--z2; |
| 60 |
RightP= z1--z3--z5--z7--z9--z11--z13--z15; |
| 61 |
|
| 62 |
def RookTopPath(expr nn) = |
| 63 |
numeric wdt; wdt = abs xpart(z15-z16)/(2nn+3); |
| 64 |
numeric sdt; sdt = wdt; |
| 65 |
pair pt,pb; |
| 66 |
path TopP; TopP=z15; |
| 67 |
pt = z15-(sdt,0); |
| 68 |
bot pb = z15-(sdt,.5httopb); |
| 69 |
for i=1 upto nn+1: |
| 70 |
TopP:= TopP--pt--pb; |
| 71 |
pb:= pb-(wdt,0); |
| 72 |
pt:= pt-(wdt,0); |
| 73 |
TopP:= TopP--pb--pt; |
| 74 |
pb:= pb-(wdt,0); |
| 75 |
pt:= pt-(wdt,0); |
| 76 |
endfor; |
| 77 |
TopP:= TopP--z16; |
| 78 |
enddef; |
| 79 |
|
| 80 |
RookTopPath(1); |
| 81 |
RookPath=RightP & TopP & LeftP -- cycle; |
| 82 |
|
| 83 |
SmP1= z5--z6; |
| 84 |
SmP2= z7--z8; |
| 85 |
SmP3= z9--z10; |
| 86 |
SmP4= z11--z12; |
| 87 |
SmP5= z13--z14; |
| 88 |
|
| 89 |
if proofing > 0: |
| 90 |
labels(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); |
| 91 |
def PixelGrid(expr PixPerInch, w) = |
| 92 |
if proofing > 0: |
| 93 |
begingroup |
| 94 |
numeric d; |
| 95 |
d = pixels_per_inch/PixPerInch; |
| 96 |
makegrid(0, |
| 97 |
for i=d step d until w: ,i endfor) |
| 98 |
(0,for i=d step d until w: ,i endfor) |
| 99 |
endgroup; |
| 100 |
fi; |
| 101 |
enddef; |
| 102 |
PixelGrid(400,qs); |
| 103 |
fi |
| 104 |
|
| 105 |
enddef; |
| 106 |
%------------------------------------------------------------ |
| 107 |
def DrawInner = |
| 108 |
%pickup inner_pen; |
| 109 |
pickup chess_pen; |
| 110 |
forsuffixes $=1,2,3,4,5: |
| 111 |
draw SmP$; |
| 112 |
endfor; |
| 113 |
enddef; |
| 114 |
%------------------------------------------------------------ |
| 115 |
def UnDrawInner = |
| 116 |
pickup chess_pen scaled 1.1; |
| 117 |
forsuffixes $=1,3,4: |
| 118 |
undraw ShortenPath(SmP$,thin); |
| 119 |
undraw ShortenPath(SmP2,1.5thin); |
| 120 |
undraw ShortenPath(SmP5,1.5thin); |
| 121 |
endfor; |
| 122 |
enddef; |
| 123 |
%------------------------------------------------------------ |
| 124 |
|
| 125 |
def MakeWhiteRook = |
| 126 |
clearit; |
| 127 |
draw RookPath; |
| 128 |
DrawInner; |
| 129 |
cullit; |
| 130 |
WhiteMan:= currentpicture; |
| 131 |
enddef; |
| 132 |
|
| 133 |
def MakeBlackRook = |
| 134 |
clearit; |
| 135 |
filldraw RookPath; |
| 136 |
UnDrawInner; |
| 137 |
cullit; |
| 138 |
BlackMan:= currentpicture; |
| 139 |
enddef; |
| 140 |
|
| 141 |
def MakeOuterShape = |
| 142 |
clearit; |
| 143 |
pickup frame_pen; |
| 144 |
filldraw RookPath; |
| 145 |
cullit; |
| 146 |
OuterShape:= currentpicture; |
| 147 |
enddef; |
| 148 |
|
| 149 |
MakeRookPath; |
| 150 |
MakeWhiteRook; |
| 151 |
MakeBlackRook; |
| 152 |
MakeNeutral(WhiteMan, BlackMan); |
| 153 |
MakeOuterShape; |
| 154 |
|
| 155 |
%=========================================================== |
| 156 |
% this one for testing |
| 157 |
%beginchar(Rook+White+OnBlack, qs#, qs#, 0); |
| 158 |
% "White rook on black field"; |
| 159 |
% MakeBlackField; |
| 160 |
% currentpicture:= currentpicture - OuterShape; |
| 161 |
% cullit; |
| 162 |
% currentpicture:= currentpicture + WhiteMan; |
| 163 |
%endchar; |
| 164 |
%beginchar(Rook+Black+OnWhite, qs#, qs#, 0); |
| 165 |
% "Black rook on white field"; |
| 166 |
% currentpicture:= BlackMan; |
| 167 |
%endchar; |
| 168 |
%endinput |
| 169 |
%----------------------------------------------------------------------- |
| 170 |
% |
| 171 |
beginchar(Rook+White+OnWhite, qs#, qs#, 0); |
| 172 |
"White rook on white field"; |
| 173 |
currentpicture:= WhiteMan; |
| 174 |
endchar; |
| 175 |
|
| 176 |
beginchar(Rook+White+OnWhite+LeftTurned, qs#, qs#, 0); |
| 177 |
"White rook on white field rotated to the left"; |
| 178 |
currentpicture:= TurnLeft(WhiteMan); |
| 179 |
endchar; |
| 180 |
|
| 181 |
beginchar(Rook+White+OnWhite+RightTurned, qs#, qs#, 0); |
| 182 |
"White rook on white field rotated to the right"; |
| 183 |
currentpicture:= TurnRight(WhiteMan); |
| 184 |
endchar; |
| 185 |
|
| 186 |
beginchar(Rook+White+OnWhite+UpSideDown, qs#, qs#, 0); |
| 187 |
"White rook on white field upside down"; |
| 188 |
currentpicture:= TurnUpSideDown(WhiteMan); |
| 189 |
endchar; |
| 190 |
|
| 191 |
beginchar(Rook+Black+OnWhite, qs#, qs#, 0); |
| 192 |
"Black rook on white field"; |
| 193 |
currentpicture:= BlackMan; |
| 194 |
endchar; |
| 195 |
|
| 196 |
beginchar(Rook+Black+OnWhite+LeftTurned, qs#, qs#, 0); |
| 197 |
"Black rook on white field rotated to the left"; |
| 198 |
currentpicture:= TurnLeft(BlackMan); |
| 199 |
endchar; |
| 200 |
|
| 201 |
beginchar(Rook+Black+OnWhite+RightTurned, qs#, qs#, 0); |
| 202 |
"Black rook on white field rotated to the right"; |
| 203 |
currentpicture:= TurnRight(BlackMan); |
| 204 |
endchar; |
| 205 |
|
| 206 |
beginchar(Rook+Black+OnWhite+UpSideDown, qs#, qs#, 0); |
| 207 |
"Black rook on white field upside down"; |
| 208 |
currentpicture:= TurnUpSideDown(BlackMan); |
| 209 |
endchar; |
| 210 |
|
| 211 |
beginchar(Rook+Neutral+OnWhite, qs#, qs#, 0); |
| 212 |
"Neutral rook on white field"; |
| 213 |
currentpicture:= NeutralMan; |
| 214 |
endchar; |
| 215 |
|
| 216 |
beginchar(Rook+Neutral+OnWhite+LeftTurned, qs#, qs#, 0); |
| 217 |
"Neutral rook on white field rotated to the left"; |
| 218 |
currentpicture:= TurnLeft(NeutralMan); |
| 219 |
endchar; |
| 220 |
|
| 221 |
beginchar(Rook+Neutral+OnWhite+RightTurned, qs#, qs#, 0); |
| 222 |
"Neutral rook on white field rotated to the right"; |
| 223 |
currentpicture:= TurnRight(NeutralMan); |
| 224 |
endchar; |
| 225 |
|
| 226 |
beginchar(Rook+Neutral+OnWhite+UpSideDown, qs#, qs#, 0); |
| 227 |
"Neutral rook on white field upside down"; |
| 228 |
currentpicture:= TurnUpSideDown(NeutralMan); |
| 229 |
endchar; |
| 230 |
|
| 231 |
beginchar(Rook+White+OnBlack, qs#, qs#, 0); |
| 232 |
"White rook on black field"; |
| 233 |
MakeBlackField; |
| 234 |
currentpicture:= currentpicture - OuterShape; |
| 235 |
cullit; |
| 236 |
currentpicture:= currentpicture + WhiteMan; |
| 237 |
endchar; |
| 238 |
|
| 239 |
beginchar(Rook+White+OnBlack+LeftTurned, qs#, qs#, 0); |
| 240 |
"White rook on black field turned to the left"; |
| 241 |
MakeBlackField; |
| 242 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 243 |
cullit; |
| 244 |
currentpicture:= currentpicture + TurnLeft(WhiteMan); |
| 245 |
endchar; |
| 246 |
|
| 247 |
beginchar(Rook+White+OnBlack+RightTurned, qs#, qs#, 0); |
| 248 |
"White rook on black field turned to the right"; |
| 249 |
MakeBlackField; |
| 250 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 251 |
cullit; |
| 252 |
currentpicture:= currentpicture + TurnRight(WhiteMan); |
| 253 |
endchar; |
| 254 |
|
| 255 |
beginchar(Rook+White+OnBlack+UpSideDown, qs#, qs#, 0); |
| 256 |
"White rook on black field upsidedown"; |
| 257 |
MakeBlackField; |
| 258 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 259 |
cullit; |
| 260 |
currentpicture:= currentpicture + TurnUpSideDown(WhiteMan); |
| 261 |
endchar; |
| 262 |
|
| 263 |
beginchar(Rook+Neutral+OnBlack, qs#, qs#, 0); |
| 264 |
"Neutral rook on black field"; |
| 265 |
MakeBlackField; |
| 266 |
currentpicture:= currentpicture - OuterShape; |
| 267 |
cullit; |
| 268 |
currentpicture:= currentpicture + NeutralMan; |
| 269 |
endchar; |
| 270 |
|
| 271 |
beginchar(Rook+Neutral+OnBlack+LeftTurned, qs#, qs#, 0); |
| 272 |
"Neutral rook on black field turned to the left"; |
| 273 |
MakeBlackField; |
| 274 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 275 |
cullit; |
| 276 |
currentpicture:= currentpicture + TurnLeft(NeutralMan); |
| 277 |
endchar; |
| 278 |
|
| 279 |
beginchar(Rook+Neutral+OnBlack+RightTurned, qs#, qs#, 0); |
| 280 |
"Neutral rook on black field turned to the right"; |
| 281 |
MakeBlackField; |
| 282 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 283 |
cullit; |
| 284 |
currentpicture:= currentpicture + TurnRight(NeutralMan); |
| 285 |
endchar; |
| 286 |
|
| 287 |
beginchar(Rook+Neutral+OnBlack+UpSideDown, qs#, qs#, 0); |
| 288 |
"Neutral rook on black field upsidedown"; |
| 289 |
MakeBlackField; |
| 290 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 291 |
cullit; |
| 292 |
currentpicture:= currentpicture + TurnUpSideDown(NeutralMan); |
| 293 |
endchar; |
| 294 |
|
| 295 |
beginchar(Rook+Black+OnBlack, qs#, qs#, 0); |
| 296 |
"Black rook on black field"; |
| 297 |
MakeBlackField; |
| 298 |
currentpicture:= currentpicture - OuterShape; |
| 299 |
cullit; |
| 300 |
currentpicture:= currentpicture + BlackMan; |
| 301 |
endchar; |
| 302 |
|
| 303 |
beginchar(Rook+Black+OnBlack+LeftTurned, qs#, qs#, 0); |
| 304 |
"Black rook on black field turned to the left"; |
| 305 |
MakeBlackField; |
| 306 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 307 |
cullit; |
| 308 |
currentpicture:= currentpicture + TurnLeft(BlackMan); |
| 309 |
endchar; |
| 310 |
|
| 311 |
beginchar(Rook+Black+OnBlack+RightTurned, qs#, qs#, 0); |
| 312 |
"Black rook on black field turned to the right"; |
| 313 |
MakeBlackField; |
| 314 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 315 |
cullit; |
| 316 |
currentpicture:= currentpicture + TurnRight(BlackMan); |
| 317 |
endchar; |
| 318 |
|
| 319 |
beginchar(Rook+Black+OnBlack+UpSideDown, qs#, qs#, 0); |
| 320 |
"Black rook on black field upsidedown"; |
| 321 |
MakeBlackField; |
| 322 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 323 |
cullit; |
| 324 |
currentpicture:= currentpicture + TurnUpSideDown(BlackMan); |
| 325 |
endchar; |