| 1 |
% This is |
| 2 |
% pkblackfield.mf |
| 3 |
% |
| 4 |
% Copyright (C) 1989-92 by Elmar Bartel. |
| 5 |
% |
| 6 |
% This program is free software; you can redistribute it and/or modify |
| 7 |
% it under the terms of the GNU General Public License as published by |
| 8 |
% the Free Software Foundation; either version 1, or (at your option) |
| 9 |
% any later version. |
| 10 |
% |
| 11 |
% This program is distributed in the hope that it will be useful, |
| 12 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
% GNU General Public License for more details. |
| 15 |
% |
| 16 |
% You should have received a copy of the GNU General Public License |
| 17 |
% along with this program; if not, write to the Free Software |
| 18 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 |
% |
| 20 |
def MakeBlackField = |
| 21 |
|
| 22 |
if unknown BlackField: |
| 23 |
|
| 24 |
pair ua[],ub[],la[],lb[],ul,lr,ma,mb; |
| 25 |
|
| 26 |
numeric n,part; |
| 27 |
|
| 28 |
n=7; part=6; |
| 29 |
pickup pencircle scaled (qs/(part*n)); |
| 30 |
bot lft ma = (0,0); |
| 31 |
top rt mb = (w,w); |
| 32 |
draw ma--mb; |
| 33 |
|
| 34 |
top lft ul = (0,h); |
| 35 |
bot rt lr = (w,0); |
| 36 |
|
| 37 |
numeric xdelta,ydelta; |
| 38 |
xdelta= floor((xpart(lr) - xpart(ma)) / n); |
| 39 |
ydelta= floor((ypart(ul) - ypart(ma)) / n); |
| 40 |
|
| 41 |
for i=1 upto n: |
| 42 |
lft ua[i] = (0,ypart(ma)+(i*ydelta)); |
| 43 |
top ub[i] = (xpart(mb)-(i*xdelta),h); |
| 44 |
draw ua[i]..ub[i]; |
| 45 |
endfor; |
| 46 |
|
| 47 |
for i=1 upto n: |
| 48 |
bot la[i] = (xpart(ma)+(i*xdelta),0); |
| 49 |
rt lb[i] = (w,ypart(mb)-(i*ydelta)); |
| 50 |
draw la[i]..lb[i]; |
| 51 |
endfor; |
| 52 |
|
| 53 |
picture BlackField; |
| 54 |
cullit; |
| 55 |
BlackField:= currentpicture; |
| 56 |
|
| 57 |
else: |
| 58 |
currentpicture:= BlackField; |
| 59 |
fi; |
| 60 |
|
| 61 |
enddef; |
| 62 |
|
| 63 |
beginchar(144,qs#,qs#,0); "Empty black field"; |
| 64 |
MakeBlackField; |
| 65 |
endchar; |