forked from rochus-keller/OberonSystem3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Backdrops.Mod
1087 lines (1028 loc) · 32.1 KB
/
Backdrops.Mod
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* OBERON System 3, Release 2.3.
Copyright 1999 ETH Zürich Institute for Computer Systems,
ETH Center, CH-8092 Zürich. e-mail: [email protected].
This module may be used under the conditions of the general Oberon
System 3 license contract. The full text can be downloaded from
"ftp://ftp.inf.ethz.ch/pub/software/Oberon/System3/license.txt;A"
Under the license terms stated it is in particular (a) prohibited to modify
the interface of this module in any way that disagrees with the style
or content of the system and (b) requested to provide all conversions
of the source code to another platform with the name OBERON. *)
MODULE Backdrops; (* Daniel Ponti Jan 94 *)
(* Revidiert: Jan 95 Daniel Ponti
Änderungen: Basiert nun auf Rembrandt0 und RembrandtDocs Modul *)
(** Dieses Modul enthält alle Backdrop-Algorithmen und verwaltet die zugehörigen Farbpaletten *)
IMPORT
Texts, Oberon, Pictures, Rembrandt0, Rembrandt, Display, Math, Input, Gadgets, Objects,
Files, BasicGadgets, Out, RembrandtDocs;
TYPE ptr = POINTER TO complex;
complex = RECORD (* Komplexe Zahl fuer Backdrop Fractal *)
r,i : REAL
END;
VAR seed: LONGINT; (* fuer Zufallszahlenberechnung *)
noisetable : ARRAY 99, 99 OF INTEGER; (* Zufallszahlenfeld *)
maxnoise, px, py : INTEGER;
r0, r1, g0, g1, b0, b1 : INTEGER; (* Farbwerte fuer Rampe *)
PROCEDURE SetColorRamp();
(* Erstellt eine Farbrampe von RGB(r0, g0, b0) nach RGB(r1, g1, b1) mit BD.noc Farbabstufungen *)
VAR
i : INTEGER;
dr, dg, db : REAL;
BEGIN
IF r0>255 THEN r0:=255 ELSIF r0<0 THEN r0:=0 END;
IF r1>255 THEN r1:=255 ELSIF r1<0 THEN r1:=0 END;
IF g0>255 THEN g0:=255 ELSIF g0<0 THEN g0:=0 END;
IF g1>255 THEN g1:=255 ELSIF g1<0 THEN g1:=0 END;
IF b0>255 THEN b0:=255 ELSIF b0<0 THEN b0:=0 END;
IF b1>255 THEN b1:=255 ELSIF b1<0 THEN b1:=0 END;
dr:= (r1-r0)/(Rembrandt0.noc-1);
dg:= (g1-g0)/(Rembrandt0.noc-1);
db:= (b1-b0)/(Rembrandt0.noc-1);
FOR i:= 0 TO Rembrandt0.noc-1 DO
(* why this ?
Rembrandt0.coltable[i+1].r:= r0+SHORT(ENTIER(i*dr));
Rembrandt0.coltable[i+1].g:= g0+SHORT(ENTIER(i*dg));
Rembrandt0.coltable[i+1].b:= b0+SHORT(ENTIER(i*db))
*)
Rembrandt0.coltable[i].r:= r0+SHORT(ENTIER(i*dr));
Rembrandt0.coltable[i].g:= g0+SHORT(ENTIER(i*dg));
Rembrandt0.coltable[i].b:= b0+SHORT(ENTIER(i*db))
END
END SetColorRamp;
(** Liest die Werte der Slider in die globalen Variablen r0 bis b1 *)
PROCEDURE SetVal*();
VAR S : Texts.Scanner;
n : INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN n:= SHORT(S.i) END;
Texts.Scan(S);
IF S.class = Texts.Int THEN
CASE n OF
0 : r0:= SHORT(S.i)
| 1 : g0:= SHORT(S.i)
| 2 : b0:= SHORT(S.i)
| 3 : r1:= SHORT(S.i)
| 4 : g1:= SHORT(S.i)
| 5 : b1:= SHORT(S.i)
END;
SetColorRamp
END
END SetVal;
(** Setzt Farben für Wolkenstruktur *)
PROCEDURE SetSkyColor*();
VAR i : INTEGER;
BEGIN
Rembrandt0.noc:= 6;
FOR i:= 1 TO 5 DO
Rembrandt0.coltable[i].r:= (i-1)*60;
Rembrandt0.coltable[i].g:=Rembrandt0.coltable[i].r;
Rembrandt0.coltable[i].b:= 255
END
END SetSkyColor;
(** Setzt Farben für Marmorstruktur *)
PROCEDURE SetMarbleColor*();
VAR i, h : INTEGER;
BEGIN
Rembrandt0.noc:= 5;
FOR i:= 1 TO 5 DO
h:= (i-1)*40+50;
Rembrandt0.coltable[i].r:= h;
Rembrandt0.coltable[i].g:= h;
Rembrandt0.coltable[i].b:= h
END
END SetMarbleColor;
(** Setzt die Hintergrundfarbe *)
PROCEDURE SetBackground*();
VAR S : Texts.Scanner;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN Rembrandt0.color.col:= SHORT(S.i) END;
IF (Rembrandt0.color.col<0) OR (Rembrandt0.color.col>Rembrandt0.maxnoc) THEN Rembrandt0.color.col:=0 END;
Display.GetColor(Rembrandt0.color.col, Rembrandt0.coltable[0].r, Rembrandt0.coltable[0].g, Rembrandt0.coltable[0].b);
Rembrandt0.color.col:=0; Gadgets.Update(Rembrandt0.color)
END SetBackground;
(** Eine einzelne Farbe kann geändert werden; Farbnummer colno mit RGB(r, g, b); wird zur Zeit nicht verwendet *)
PROCEDURE SetColor*();
VAR S : Texts.Scanner;
colno, r, g, b : INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN colno:= SHORT(S.i) ELSE colno:= 1 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN r:= SHORT(S.i) ELSE r:= 110 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN g:= SHORT(S.i) ELSE g:= 110 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN b:= SHORT(S.i) ELSE b:= 110 END;
IF (colno>Rembrandt0.noc) OR (colno<1) THEN colno:= 1 END;
Rembrandt0.coltable[colno].r:= r;
Rembrandt0.coltable[colno].g:= g;
Rembrandt0.coltable[colno].b:= b
END SetColor;
(** Setzt die Anzahl Farben für Farbrampen *)
PROCEDURE SetNoColor*();
VAR S : Texts.Scanner;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN Rembrandt0.noc:= SHORT(S.i) END;
IF Rembrandt0.noc>Rembrandt0.maxnoc THEN Rembrandt0.noc:=Rembrandt0.maxnoc
ELSIF Rembrandt0.noc<1 THEN Rembrandt0.noc:= 1
END;
SetColorRamp
END SetNoColor;
PROCEDURE Random(): LONGINT;
(* Liefert eine Zufallszahl vom Typ Longint *)
CONST a = 16807; m = 2147483647; q = m DIV a; r = m MOD a;
VAR i: LONGINT;
BEGIN
seed := ABS(Oberon.Time()-seed);
i := a * (seed MOD q) - r * (seed DIV q);
IF i > 0 THEN seed := i ELSE seed := i + m END;
RETURN seed
END Random;
PROCEDURE CheckKeyboard(): BOOLEAN;
(* liefert TRUE zurück falls während dem Zeichnen eine definierte
Taste gedrückt wurde oder eine Mousetaste*)
CONST Quit=27; (* ESC_Taste *)
VAR ch: CHAR;
x, y : INTEGER;
keys : SET;
BEGIN
IF Input.Available()#0 THEN
Input.Read(ch);
IF ORD(ch)=Quit THEN RETURN TRUE
ELSE
RETURN FALSE
END
END;
keys:= {};
Input.Mouse(keys, x, y);
IF keys#{} THEN RETURN TRUE ELSE RETURN FALSE END
END CheckKeyboard;
PROCEDURE Initcolor(P : Pictures.Picture);
(* Weist dem Picture die Farben zu *)
VAR i : INTEGER;
BEGIN
FOR i:= 0 TO Rembrandt0.noc-1 DO
Pictures.SetColor(P, i, Rembrandt0.coltable[i].r, Rembrandt0.coltable[i].g, Rembrandt0.coltable[i].b)
END;
END Initcolor;
PROCEDURE Integer(name : ARRAY OF CHAR): INTEGER;
(* Liefert aktuelle Zahl des gesuchten Modells zurück *)
VAR obj, cont : Objects.Object;
BEGIN
cont:= Gadgets.context; obj:= NIL;
WHILE (cont#NIL) & (obj=NIL) DO
obj:= Gadgets.FindObj(cont, name);
cont:= cont.dlink; (* Aufruf des Befehls aus einem "höheren" Panel *)
END;
IF obj#NIL THEN
RETURN SHORT(obj(BasicGadgets.Integer).val)
ELSE
RETURN 0
END
END Integer;
PROCEDURE Real(name : ARRAY OF CHAR): REAL;
(* Liefert aktuelle Zahl des gesuchten Modells zurück *)
VAR obj, cont : Objects.Object;
BEGIN
cont:= Gadgets.context; obj:= NIL;
WHILE (cont#NIL) & (obj=NIL) DO
obj:= Gadgets.FindObj(cont, name);
cont:= cont.dlink; (* Aufruf des Befehls aus einem "höheren" Panel *)
END;
IF obj#NIL THEN
RETURN SHORT(obj(BasicGadgets.Real).val)
ELSE
RETURN 0.0
END
END Real;
(** Initialisiert die Standardpalette *)
PROCEDURE LoadPalette*();
VAR F: Files.File;
R: Files.Rider;
r, g, b : CHAR; i: INTEGER;
BEGIN
F:= Files.Old("Rembrandt0.Pal");
Files.Set(R, F, 0);
FOR i:= 0 TO 255 DO
Files.Read(R, r);
Files.Read(R, g);
Files.Read(R, b);
Display.SetColor(i, ORD(r), ORD(g), ORD(b));
END;
END LoadPalette;
PROCEDURE CreatePict(VAR P: Pictures.Picture);
(* Gibt das markierte Picture zurück oder erstellt ein neues *)
(* setzt die Farben *)
VAR F: Rembrandt.Frame;
BEGIN
F:= RembrandtDocs.MarkedFrame();
IF F=NIL THEN NEW(P); Pictures.Create(P, 320, 200, 8); RembrandtDocs.OpenPict(P, "Backdrop.Pict") ELSE P:= F.pict END;
px:= P.width; py:= P.height;
Initcolor(P);
END CreatePict;
(** Erstellt ein leeres Picture mit Hintergrundfarbe background *)
PROCEDURE EmptyPicture*();
VAR P: Pictures.Picture;
BEGIN
LoadPalette; (* Palette muss neu geladen werden, falls zwischendurch eine andere Palette geladen wurde *)
CreatePict(P);
Pictures.ReplConst(P, Rembrandt0.color.col, 0, 0, px, py, Display.replace);
Pictures.Update(P, 0, 0, px, py)
END EmptyPicture;
(** Dithert ein markiertes Picture mit zusätzlicher Angabe der Helligkeit und Sättigung als Parameter *)
PROCEDURE Reduce*;
VAR D: Pictures.Picture;
ds, dv, r, g, b: INTEGER;
S: Texts.Scanner;
F: Rembrandt.Frame;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN ds:= SHORT(S.i) ELSE ds:=100 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN dv:= SHORT(S.i) ELSE dv:=100 END;
F:= RembrandtDocs.MarkedFrame();
IF F#NIL THEN
NEW(D); Pictures.Create(D, F.pict.width, F.pict.height, F.pict.depth);
Rembrandt0.Reduce(F.pict, D, ds/100, dv/100);
ds:=0; WHILE ds<ASH(2, D.depth-1) DO Display.GetColor(ds, r, g, b); Pictures.SetColor(D, ds, r, g, b); INC(ds) END;
RembrandtDocs.OpenPict(D, "")
END
END Reduce;
PROCEDURE WraplConst(P: Pictures.Picture; col, x, y, w, h: INTEGER);
(* Zeichnet ein gefülltes Rechteck im Picture modulo Höhe und Breite *)
BEGIN
x:=x MOD px; y:= y MOD py;
IF (x+w<px) & (y+h<py) THEN
Pictures.ReplConst(P, col, x, y, w, h, Display.replace)
ELSE
IF x+w>=px THEN
Pictures.ReplConst(P, col, x, y, px-x, h, Display.replace);
Pictures.ReplConst(P, col, 0, y, x+w-px, h, Display.replace)
END;
IF y+h>=py THEN
Pictures.ReplConst(P, col, x, y, w, py-h, Display.replace);
Pictures.ReplConst(P, col, x, 0, w, y+h-py, Display.replace)
END;
IF (x+w>=px) & (y+h>=py) THEN (* Spezialfall *)
Pictures.ReplConst(P, col, 0, 0, x+w-px, y+h-py, Display.replace)
END
END
END WraplConst;
PROCEDURE Circle(P : Pictures.Picture; xm, ym, r, dc, fac: INTEGER; bres : BOOLEAN; dis: INTEGER);
(* Zeichnet einen Kreis mit Mittelpunkt xm, ym Radius r, Farbe dc, Schritte fac *)
VAR x, y : INTEGER; i, step : REAL;
d,dx,dy, h: INTEGER;
BEGIN
IF ~bres THEN
step:= fac/r;
i:= 0;
WHILE i<360 DO
x:= SHORT(ENTIER(r*Math.sin(i*Math.pi/180)));
y:= SHORT(ENTIER(r*Math.cos(i*Math.pi/180)));
IF dis>1 THEN h:= -dis+SHORT(Random()) MOD (2*dis) ELSE h:=0 END;
IF Pictures.Get(P, (xm+x+h) MOD px, (ym+y+h) MOD py) = Rembrandt0.color.col THEN
Pictures.Dot(P, dc, (xm+x+h) MOD px, (ym+y+h) MOD py, Display.replace)
END;
i:= i+step
END
ELSE (* Bresenham-Methode für gefüllte Kreise *)
x := r; y := 0; d := 2*r-1; dx := 4*r; dy := 0;
WHILE y < r DO
WHILE d <= 0 DO DEC(x); DEC(dx,4); INC(d,dx) END;
WraplConst(P, dc, xm-x,ym+y,2*x,1);
INC(y); INC(dy,4); DEC(d,dy);
WraplConst(P, dc, xm-x,ym-y,2*x,1);
END
END
END Circle;
PROCEDURE Ellipse(P: Pictures.Picture; a,b, xm, ym, col : INTEGER; both: BOOLEAN);
(* Zeichnet eine Ellipse mit Mittelpunkt (xm,ym), Achsen a,b und Farbe col *)
(* both=1: zeichnet ganze Ellipse *)
(* both=0: zeichnet nur die obere Hälfte *)
VAR x, y1, y2, y, i, step : REAL;
BEGIN
i:= 0; step:= 0.5;
WHILE i<2*a DO
x:=-a+i;
i:= i+step;
y:=b*Math.sqrt(1-x*x/a/a);
x:= x+xm; y1:= y+ym;
Pictures.Dot(P, col, SHORT(ENTIER(x) MOD px), SHORT(ENTIER(y1) MOD py), Display.replace);
IF both THEN
y2:= ym-y;
Pictures.Dot(P, col, SHORT(ENTIER(x) MOD px), SHORT(ENTIER(y2) MOD py), Display.replace)
END
END
END Ellipse;
PROCEDURE Spirale(P: Pictures.Picture; r0, r1, a0, a1, xm, ym, col, b : INTEGER);
(* Zeichnet eine Spirale von Radius r0 bis r1 und von Winkel a0 bis a1 um
den Mittelpunkt (xm,ym) *)
(* b=0: einheitliche Farbe *)
(* b=1: Farbverlauf *)
VAR i, x, y : INTEGER; r, dr, coldec, cols : REAL;
BEGIN
dr:= (r1-r0)/(a1-a0); r:=0;
IF b=1 THEN coldec:=col/(a1-a0) ELSE coldec:=0 END;
cols:= col*1.0-coldec;
FOR i:= a0 TO a1 DO
x:= SHORT(ENTIER((r0+r)*Math.sin(i*Math.pi/180)));
y:= SHORT(ENTIER((r0+r)*Math.cos(i*Math.pi/180)));
x:= x+xm; y:= y+ym;
Pictures.Dot(P, SHORT(ENTIER(cols)), x MOD px, y MOD py, Display.replace);
cols:= cols-coldec;
IF cols<=1 THEN cols:=1 END;
r:=r+dr;
END
END Spirale;
(** Backdrops *)
PROCEDURE Fractal*();
(* Generiert das Backdrop Fractal *)
VAR
endr, Inc, endi, Inr, dw, w, fr0, fi0, fr1, fi1 : REAL;
loops , max, f, k : LONGINT;
z, c : complex;
ret : ptr; (* Rueckgabe der komplexen Zahl als Pointer *)
P : Pictures.Picture;
S : Texts.Scanner;
PROCEDURE complexsqrt(z: complex): ptr;
VAR mag : REAL;
BEGIN
mag:= Math.sqrt(z.r*z.r+z.i*z.i);
IF (mag+z.r) < 0 THEN ret.r:=0
ELSE
ret.r:= Math.sqrt((mag+z.r)/2);
END;
IF (mag-z.r) < 0 THEN ret.i:=0
ELSE
ret.i:= Math.sqrt((mag-z.r)/2);
END;
IF z.i<0 THEN ret.i:=-ret.i END;
RETURN ret
END complexsqrt;
PROCEDURE iterate(z: complex): ptr;
VAR help : complex;
result : ptr;
BEGIN
help.r:= z.r-c.r;
help.i:= z.i-c.i;
result:= complexsqrt(help);
IF (Random() MOD 2) = 0 THEN
result.r:= -result.r; result.i:=-result.i
END;
RETURN result
END iterate;
BEGIN
CreatePict(P);
NEW(ret);
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN loops:= SHORT(S.i) ELSE loops:= 10 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN max:= S.i ELSE max:= 10000 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN f:= S.i ELSE f:=1 END;
fr0:= -1.1; fi0:= 0.2;
fr1:= -0.9; fi1:= 0.9;
fr0:= Real("fractalr0"); fi0:= Real("fractali0");
fr1:= Real("fractalr1"); fi1:= Real("fractali1");
c.r:= fr0; c.i:= fi0;
endr:= fr1; endi:= fi1;
Pictures.ReplConst(P, Rembrandt0.color.col, 0, 0, px, py, Display.replace);
Inc:= ABS(c.r-endr)/loops; (* Schrittweiten *)
Inr:= ABS(c.i-endi)/loops;
dw:= Rembrandt0.noc/loops; w:= 1; (* Farbnummerweite *)
z.r:= 1; z.i:= 0;
WHILE (loops >0) & (~CheckKeyboard()) DO
FOR k:= 1 TO 50 DO ret:=iterate(z); z.i:= ret.i; z.r:=ret.r END; (* Anfangsiteration *)
FOR k:= 1 TO max DO
ret:=iterate(z); z.i:= ret.i; z.r:=ret.r;
Pictures.Dot(P, SHORT(ENTIER(w)), SHORT(ENTIER(px*f*z.r) MOD px) ,
SHORT(ENTIER(py*f*z.i) MOD py), Display.replace);
END;
w:= w+dw;
Pictures.Update(P, 0,0, px, py);
c.r:= c.r+Inc;
c.i:= c.i+Inr;
DEC(loops)
END;
END Fractal;
PROCEDURE Initnoise();
(* Füllt das Zufallszahlenfeld *)
VAR x, y, xx, yy : INTEGER;
BEGIN
FOR x:= 0 TO maxnoise DO
FOR y:= 0 TO maxnoise DO
noisetable[x,y]:= SHORT(Random() MOD 10000);
IF x = maxnoise THEN xx:=0 ELSE xx:=x END;
IF y = maxnoise THEN yy:=0 ELSE yy:=y END;
noisetable[x,y]:= noisetable[xx,yy]
END
END
END Initnoise;
PROCEDURE noise(x,y : REAL): REAL;
(* Berechnet mittels linearer Interpolation eine Zufallswert aus dem bestehenden Feld *)
VAR ix, iy: LONGINT;
ox, oy: REAL;
n : INTEGER;
n00, n10 : REAL;
BEGIN
x:= x+15000; y:= y+15000;
ix:= ENTIER(x) MOD maxnoise;
iy:= ENTIER(y) MOD maxnoise;
ox:= x-ENTIER(x); oy:= y-ENTIER(y);
n:= noisetable[ix, iy];
n00:= n+ox*(noisetable[ix+1, iy]-n);
n:= noisetable[ix, iy+1];
n10:= n+ox*(noisetable[ix+1, iy+1]-n);
RETURN (n00+oy*(n10-n00))*0.0001
END noise;
PROCEDURE Marble*();
(* Generiert das Backdrop Marble *)
VAR c, prim : INTEGER;
konst, fac, scale : REAL;
i,j : LONGINT;
P : Pictures.Picture;
S: Texts.Scanner;
PROCEDURE marb(u,v: REAL; VAR i : REAL);
VAR d, dd : REAL;
BEGIN
d:= prim*noise(u/100*scale, v/100*scale);
dd:= ENTIER(d) MOD 17;
IF dd < 4 THEN i:=noise(u/100*scale, v/100*scale)
ELSE
IF (dd<9) OR (dd>=12) THEN
d:= ABS(d-ENTIER(d/17)*17-10.5)*fac;
i:= 0.4+0.3*d+0.2*noise(u/100*scale, v/100*scale);
ELSE
i:= 0.2+0.2*noise(u/100*scale, v/100*scale);
END
END;
END marb;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN prim:= SHORT(S.i) ELSE prim:= 7 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN scale:= 1.0*SHORT(S.i) ELSE scale:= 16 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN fac:= S.i/1000 ELSE fac:= 0.15 END;
IF scale>49 THEN scale:= 49 END;
maxnoise:= SHORT(ENTIER(2*scale));
Initnoise;
CreatePict(P);
FOR i:= 0 TO py DO
FOR j:= 0 TO px DO
marb(i*200/px, j*200/py, konst);
c:= SHORT(ENTIER(konst*100)) DIV Rembrandt0.noc;
Pictures.Dot(P, (c MOD Rembrandt0.noc), SHORT(j), SHORT(i), Display.replace)
END;
IF i MOD 4 =0 THEN
Pictures.Update(P, 0, SHORT(i), px, 2)
END;
IF CheckKeyboard() THEN i:= py END;
END;
Pictures.Update(P, 0,0, px, py);
END Marble;
PROCEDURE turbulence(x,y: REAL): REAL;
VAR mins, t,s : REAL;
BEGIN
t:=0; s:=1; mins:= 1/px;
WHILE s>=mins DO
t:=t+noise(x/s,y/s)*s; s:=s*0.5;
END;
RETURN t
END turbulence;
(** Dient zur Vorschau eines Backdrops *)
PROCEDURE Preview*();
CONST size=480; (* Grösse des Pictures *)
VAR i, j, sx, sy : INTEGER;
P : Pictures.Picture;
F: Rembrandt.Frame;
BEGIN
F:= RembrandtDocs.MarkedFrame();
IF F#NIL THEN
NEW(P); Rembrandt0.AllocatePictureMem(P, size, size, 8);
sy:= size DIV py; sx:=size DIV px;
FOR i:= 0 TO sy DO
FOR j:= 0 TO sx DO
Pictures.CopyBlock(F.pict, P, 1,1,F.pict.width-1, F.pict.height-1,
j*(F.pict.width-1), i*(F.pict.height-1), Display.replace)
END
END;
RembrandtDocs.OpenPict(P, "Preview")
END
END Preview;
(** Backdrops *)
PROCEDURE Textils*();
(* Generiert das Backdrop Textils *)
VAR x, y, col, j : INTEGER;
t, m,n: REAL;
P : Pictures.Picture;
S: Texts.Scanner;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN maxnoise:= SHORT(S.i) ELSE maxnoise:= 10 END;
CreatePict(P);
Initnoise;
col := 100 DIV (Rembrandt0.noc-1) +1;
FOR y:= 0 TO py DO
FOR x:= 0 TO px DO
m:=x; n:=y; m:= m*maxnoise/px; n:= n*maxnoise/py;
t:= turbulence(m,n);
j:= SHORT(ENTIER((t-0.05)*60) DIV col) MOD Rembrandt0.noc;
Pictures.Dot(P, j, x , y , Display.replace)
END;
IF y MOD 4 =0 THEN Pictures.Update(P, 0, y, px, 2) END;
IF CheckKeyboard() THEN y:=py END;
END;
Pictures.Update(P, 0,0, px, py);
END Textils;
PROCEDURE Clouds*();
(* Generiert das Backdrop Clouds *)
CONST kor=24;
VAR array, update : INTEGER;
j, loop : LONGINT;
dir, i, k : INTEGER;
P : Pictures.Picture;
S: Texts.Scanner;
x, y : ARRAY 50 OF INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN array:= SHORT(S.i) ELSE array:= 15 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN loop:= S.i ELSE loop:= 10000 END;
CreatePict(P);
IF array>49 THEN array:= 49 END;
Pictures.ReplConst(P, 1, 0,0, px, py, Display.replace);
Pictures.Update(P, 0,0, px, py);
(* Zentren initialisieren *)
FOR i:= 1 TO array DO
x[i]:= SHORT(Random() MOD px);
y[i]:= SHORT(Random() MOD py);
Pictures.Dot(P, 2, x[i],y[i], Display.replace);
Pictures.Dot(P, 2, x[i]+1,y[i], Display.replace);
Pictures.Dot(P, 2, x[i]-1,y[i], Display.replace);
Pictures.Dot(P, 2, x[i],y[i]-1, Display.replace);
Pictures.Dot(P, 2, x[i],y[i]+1, Display.replace);
Pictures.Dot(P, 2, x[i]-1,y[i]-1, Display.replace);
Pictures.Dot(P, 2, x[i]+1,y[i]-1, Display.replace);
Pictures.Dot(P, 2, x[i]+1,y[i]+1, Display.replace);
Pictures.Dot(P, 2, x[i]-1,y[i]+1, Display.replace);
END;
j:=0; update:= SHORT(loop DIV 100);
(* Wachstumsphase *)
WHILE (j< loop) & (~CheckKeyboard()) DO
FOR i:= 1 TO array DO
dir:= SHORT(Random() MOD kor);
CASE dir OF
0: y[i]:=y[i]+1;
|1: x[i]:=x[i]+1;
|2: y[i]:=y[i]-1;
|3: x[i]:=x[i]-1;
|4: x[i]:=x[i]+1; y[i]:=y[i]+1
|5: x[i]:=x[i]+1; y[i]:=y[i]-1;
|6: x[i]:=x[i]-1; y[i]:=y[i]-1;
|7: x[i]:=x[i]-1; y[i]:=y[i]+1;
|8..16: x[i]:=x[i]-1;
|17..24: x[i]:=x[i]+1;
END;
k:=0;
IF Pictures.Get(P, x[i] MOD px, (y[i]+1) MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]+1) MOD px, y[i] MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, x[i] MOD px, (y[i]-1) MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]-1) MOD px, y[i] MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]+1) MOD px, (y[i]+1) MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]+1) MOD px, (y[i]-1) MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]-1) MOD px, (y[i]-1) MOD py) # 1 THEN INC(k) END;
IF Pictures.Get(P, (x[i]-1) MOD px, (y[i]+1) MOD py) # 1 THEN INC(k) END;
CASE k OF
0, 1 : Pictures.Dot(P, 1, x[i] MOD px, y[i] MOD py, Display.replace)
| 2, 3 : Pictures.Dot(P, 2, x[i] MOD px, y[i] MOD py, Display.replace)
| 4, 5 : Pictures.Dot(P, 3, x[i] MOD px, y[i] MOD py, Display.replace)
| 6, 7 : Pictures.Dot(P, 4, x[i] MOD px, y[i] MOD py, Display.replace)
| 8 : Pictures.Dot(P, 5, x[i] MOD px, y[i] MOD py, Display.replace)
END
END;
IF j MOD update =0 THEN
Pictures.Update(P, 0,0, px, py)
END;
INC(j)
END;
Pictures.Update(P, 0,0, px, py)
END Clouds;
PROCEDURE Molecules*();
(* Generiert das Backdrop Molecules *)
VAR x, y, r,t, size, dif, dis : INTEGER;
frac, col : REAL;
P : Pictures.Picture;
S: Texts.Scanner;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN size:= SHORT(S.i) ELSE size:= 20 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN dif:= SHORT(S.i) ELSE dif:= 30 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN dis:= SHORT(S.i) ELSE dis:=1 END;
CreatePict(P);
y:=SHORT(Random() MOD dif);
WHILE (y<py) & (~CheckKeyboard()) DO
x:= SHORT(Random() MOD dif);
WHILE x<px DO
x:=x+ SHORT(Random() MOD dif);
r:= SHORT(Random() MOD size)+1;
t:= y+SHORT(Random() MOD size);
frac:= (Rembrandt0.noc-1)*1.0; frac:=frac/r; col:= frac;
WHILE r>0 DO
Circle(P, x, t, r, SHORT(ENTIER(col)), 20, FALSE, dis);
col:=col+frac;
DEC(r)
END
END;
y:=y+ SHORT(Random() MOD dif);
Pictures.Update(P, 0,0, px, py)
END
END Molecules;
PROCEDURE Threads*();
(* Generiert das Backdrop Threads *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
x, y, num, j, i, long, nbr, dir : INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN nbr:= SHORT(S.i) ELSE nbr:= 50 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN long:= SHORT(S.i) ELSE long:= 1000 END;
CreatePict(P);
FOR i:= 1 TO nbr DO
j:=0;
dir:= SHORT(Random() MOD 4);
x:= SHORT(Random() MOD P.width);
y:= SHORT(Random() MOD P.height);
WHILE j < long DO
num:= dir*2+SHORT(Random() MOD 3);
CASE num OF
0: x:=x+1; y:=y+1;
| 1: x:=x+1;
| 2: x:=x+1; y:=y-1;
| 3: y:=y-1;
| 4: x:=x-1; y:=y-1;
| 5: x:=x-1;
| 6: x:=x-1; y:=y+1;
| 7: y:=y+1;
| 8: x:=x+1; y:=y+1;
END;
Pictures.Dot(P, i MOD (Rembrandt0.noc-1) +1, x MOD P.width, y MOD P.height, Display.replace);
INC(j)
END;
Pictures.Update(P, 0,0, px, py);
IF CheckKeyboard() THEN i:=nbr END;
END
END Threads;
PROCEDURE Damage(P: Pictures.Picture; col, dx, dy, x,y,w,h: INTEGER);
(* Generiert die Defekte zum Backdrop Bricks *)
VAR n, fgd, bgd: INTEGER;
BEGIN
n:= SHORT(Random() MOD 20)+1;
fgd:= col-2; IF fgd<=0 THEN fgd:=1 END;
bgd:= col+2; IF bgd>=Rembrandt0.noc THEN bgd:=Rembrandt0.noc-1 END;
WHILE n>0 DO
IF (dx>=0) & (dy>=0) & (dx+1<=w) & (dy+1<=h) THEN
WraplConst(P, bgd, x+dx+1, y+dy-1, 1, 1);
WraplConst(P, fgd, x+dx, y+dy, 1, 1);
END;
INC(dx, SHORT(Random() MOD 3)-1);
INC(dy, SHORT(Random() MOD 3)-1);
DEC(n)
END
END Damage;
PROCEDURE Brick(P: Pictures.Picture; col, dam, x,y,w,h: INTEGER);
VAR fgd, bgd : INTEGER; n : LONGINT;
BEGIN
WraplConst(P, col,x,y,w,h);
fgd:= col-2; IF fgd<=0 THEN fgd:=1 END;
bgd:= col+2; IF bgd>=Rembrandt0.noc THEN bgd:=Rembrandt0.noc-1 END;
WraplConst(P, fgd, x-1, y-1, w+2, 1);
WraplConst(P, bgd, x-1, y-1, 1, h+2);
WraplConst(P, bgd, x-1, y+h, w+2, 1);
WraplConst(P, fgd, x+w, y-1, 1, h+2);
n:= Random() MOD (dam+1);
WHILE n>0 DO
Damage(P, col, SHORT(Random() MOD w), SHORT(Random() MOD h),
x,y,w,h);
DEC(n)
END;
END Brick;
PROCEDURE Bricks*();
(* Generiert das Backdrop Bricks *)
VAR P : Pictures.Picture;
i,x,y,w,h, dam, loop, col, maxw, maxd : INTEGER;
BEGIN
loop:= Integer("brian");
dam:= Integer("bride");
maxw:= Integer("bribr");
maxd:=Integer("briho");
IF maxw>px-8 THEN maxw:= px-8 END;
IF maxd>py-4 THEN maxd:= py-4 END;
CreatePict(P);
i:=0;
WHILE (i<loop) & (~CheckKeyboard()) DO
col:= SHORT(Random() MOD (Rembrandt0.noc-4))+3;
x:= SHORT(Random() MOD px); y:= SHORT(Random() MOD py);
w:= SHORT(Random() MOD maxw)+8;
h:= SHORT(Random() MOD maxd)+4;
Brick(P, col, dam, x, y, w, h);
Pictures.Update(P,0,0, px, py);
INC(i)
END
END Bricks;
PROCEDURE Surface*();
(* Generiert das Backdrop Surface *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
rnd, t, fgd, bgd, he, dx, dy, update : INTEGER;
n, loop : LONGINT;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN loop:=S.i ELSE loop:= 1000 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN rnd:=SHORT(S.i) ELSE rnd:= 25 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN t:=SHORT(S.i) ELSE t:= 1 END;
Texts.Scan(S);
CreatePict(P);
update:= 2500 DIV rnd;
Pictures.ReplConst(P, (Rembrandt0.noc DIV 2), 0, 0, px, py, Display.replace);
WHILE (loop>0) & (~CheckKeyboard()) DO
n:= SHORT(Random() MOD rnd)+1;
fgd:= (Rembrandt0.noc DIV 2)-2; IF fgd<=0 THEN fgd:=1 END;
bgd:= (Rembrandt0.noc DIV 2)+2; IF bgd>=Rembrandt0.noc THEN bgd:=Rembrandt0.noc-1 END;
dx:= SHORT(Random() MOD px);
dy:= SHORT(Random() MOD py);
WHILE n>0 DO
he:= 1+SHORT(Random() MOD t);
dx:= dx MOD px; dy:=dy MOD py;
WraplConst(P, bgd, (dx+2*he) MOD px, (dy-2*he) MOD py, he, 2*he);
WraplConst(P, bgd, (dx+he) MOD px, (dy-2*he) MOD py, he, he);
WraplConst(P, bgd-1, (dx+2*he) MOD px, dy, he, he);
WraplConst(P, bgd-1, dx, (dy-2*he) MOD py, he, he);
WraplConst(P, bgd-1, (dx+he) MOD px, (dy-he) MOD py, he, he);
WraplConst(P, fgd, dx, dy, 2*he, he);
WraplConst(P, fgd, dx, (dy-he) MOD py, he, he);
INC(dx, SHORT(Random() MOD 3)-1);
INC(dy, SHORT(Random() MOD 3)-1);
DEC(n)
END;
IF loop MOD update =0 THEN Pictures.Update(P,0,0, px, py) END;
DEC(loop)
END;
Pictures.Update(P,0,0, px, py)
END Surface;
PROCEDURE Plasma*();
(* Generiert das Backdrop Plasma *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
x, y, num, j, k , oldnum, long, nbr : INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN nbr:= SHORT(S.i) ELSE nbr:= 10 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN long:= SHORT(S.i) ELSE long:= 10000 END;
CreatePict(P); num := 0;
FOR k:= 1 TO nbr DO
x:= SHORT(Random() MOD px);
y:= SHORT(Random() MOD py);
FOR j:= 1 TO long DO
oldnum:= num;
REPEAT
num:= SHORT(Random() MOD 8)
UNTIL (oldnum#num) & (ABS(oldnum-num)#1);
CASE num OF
0: y:=y+1;
| 1: y:=y-1;
| 2: x:=x+1;
| 3: x:=x-1;
| 4: x:=x+1; y:=y+1;
| 5: x:=x-1; y:=y-1;
| 6: x:=x-1; y:=y+1;
| 7: x:=x+1; y:=y-1;
END;
Pictures.Dot(P, k MOD Rembrandt0.noc, x MOD px, y MOD py, Display.replace);
END;
Pictures.Update(P, 0,0, px, py);
IF CheckKeyboard() THEN k:= nbr END
END;
Pictures.Update(P, 0,0, px, py)
END Plasma;
PROCEDURE Coins*();
(* Generiert das Backdrop Coins *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
x, y, r, nbr, loop, j : INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN loop:= SHORT(S.i) ELSE loop:= 100 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN nbr:= SHORT(S.i) ELSE nbr:= 30 END;
CreatePict(P);
FOR j:= 1 TO loop DO
x:= SHORT(Random() MOD px);
y:= SHORT(Random() MOD py);
r:= SHORT(Random() MOD nbr);
Circle(P, x, y, r, SHORT(Random() MOD (Rembrandt0.noc-1))+1, 20, TRUE, 1);
IF j MOD 20 =0 THEN Pictures.Update(P, 0,0, px, py) END;
IF CheckKeyboard() THEN j:= loop END;
END;
Pictures.Update(P, 0,0, px, py)
END Coins;
PROCEDURE Bows*();
(* Generiert das Backdrop Bows *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
col, i, j, nbr, loop, x, y, a, b, dick: INTEGER;
ud : LONGINT;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
Texts.Scan(S);
IF S.class = Texts.Int THEN loop:= SHORT(S.i) ELSE loop:= 100 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN nbr:= SHORT(S.i) ELSE nbr:= 30 END;
Texts.Scan(S);
IF S.class = Texts.Int THEN dick:= SHORT(S.i) ELSE dick:= Rembrandt0.noc END;
CreatePict(P);
ud:= loop; ud:= (ud*nbr) DIV 1000; (* Update des Pictures *)
IF ud<10 THEN ud:= 10 END;
FOR j:= 1 TO loop DO
x:= SHORT(Random() MOD px);
y:= SHORT(Random() MOD py);
a:= SHORT(Random() MOD nbr)+3;
b:= SHORT(Random() MOD nbr)+3;
col:= SHORT(Random() MOD (Rembrandt0.noc-2))+2;
FOR i:= 1 TO dick DO
IF col<=1 THEN col:=1 END;
Ellipse(P, a,b-i+1, x, y, col, FALSE);
DEC(col);
END;
IF j MOD ud=0 THEN Pictures.Update(P, 0,0, px, py) END;
IF CheckKeyboard() THEN j:= loop END
END;
Pictures.Update(P, 0,0, px, py)
END Bows;
PROCEDURE Spirals*();
(* Generiert das Backdrop Spir *)
VAR P : Pictures.Picture;
col, i, j, loop, x, y, rad, bool, diff: INTEGER;
rounds : REAL;
BEGIN
loop:= Integer("spian");
rad:= Integer("spira");
rounds:= Integer("spium")/10;
diff:= Integer("spili");
bool:= Integer("spifa");
CreatePict(P);
FOR j:= 1 TO loop DO
x:= SHORT(Random() MOD px);
y:= SHORT(Random() MOD py);
col:= SHORT(Random() MOD (Rembrandt0.noc-3*bool+1))+3*bool+1;
FOR i:=0 TO diff-1 DO
Spirale(P, 0, rad, i*(360 DIV diff), SHORT(ENTIER(rounds*360)), x, y, col, bool);
END;
IF j MOD 10=0 THEN Pictures.Update(P, 0,0, px, py) END;
IF CheckKeyboard() THEN j:= loop END
END;
Pictures.Update(P, 0,0, px, py)
END Spirals;
PROCEDURE Tree(P: Pictures.Picture; x,y, dir, col, count,max, len : INTEGER);
(* Rekursion für Tree *)
VAR num, red : INTEGER; i: LONGINT;
BEGIN
IF count<max THEN
red:=count*(len DIV (max+1));
FOR i:= 1 TO (Random() MOD (len-red) + 5) DO
num:= dir;
num:= (num+SHORT(Random() MOD 3)) MOD 8;
CASE num OF
0: x:=x+1; y:=y+1;
| 1: x:=x+1;
| 2: x:=x+1; y:=y-1;
| 3: y:=y-1;;
| 4: x:=x-1; y:=y-1;
| 5: x:=x-1;
| 6: x:=x-1; y:=y+1;
| 7: y:=y+1;
| 8: x:=x+1; y:=y+1;
END;
Pictures.Dot(P, col, x MOD px, y MOD py, Display.replace)
END;
IF col+1>Rembrandt0.noc THEN col:=Rembrandt0.noc-1 END;
Tree(P, x,y, dir, col+1, count+1, max, len);
Tree(P, x,y, (dir+1) MOD 8, col+1, count+1, max, len);
IF dir -1<0 THEN dir:=8 END;
Tree(P, x,y, dir-1, col+1, count+1, max, len)
END;
IF count<max-2 THEN Pictures.Update(P, 0,0, px, py) END
END Tree;
PROCEDURE Trees*();
(* Generiert das Backdrop Trees *)
VAR P : Pictures.Picture;
S: Texts.Scanner;
i, loop, x, y, max, len, start: INTEGER;
BEGIN
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);