Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -0,0 +1,37 @@
|
|||
# -*- coding: utf-8 -*- #
|
||||
|
||||
circle OF class image :=
|
||||
( REF IMAGE picture,
|
||||
POINT center,
|
||||
INT radius,
|
||||
PIXEL color
|
||||
)VOID:
|
||||
BEGIN
|
||||
INT f := 1 - radius,
|
||||
POINT ddf := (0, -2 * radius),
|
||||
df := (0, radius);
|
||||
picture [x OF center, y OF center + radius] :=
|
||||
picture [x OF center, y OF center - radius] :=
|
||||
picture [x OF center + radius, y OF center] :=
|
||||
picture [x OF center - radius, y OF center] := color;
|
||||
WHILE x OF df < y OF df DO
|
||||
IF f >= 0 THEN
|
||||
y OF df -:= 1;
|
||||
y OF ddf +:= 2;
|
||||
f +:= y OF ddf
|
||||
FI;
|
||||
x OF df +:= 1;
|
||||
x OF ddf +:= 2;
|
||||
f +:= x OF ddf + 1;
|
||||
picture [x OF center + x OF df, y OF center + y OF df] :=
|
||||
picture [x OF center - x OF df, y OF center + y OF df] :=
|
||||
picture [x OF center + x OF df, y OF center - y OF df] :=
|
||||
picture [x OF center - x OF df, y OF center - y OF df] :=
|
||||
picture [x OF center + y OF df, y OF center + x OF df] :=
|
||||
picture [x OF center - y OF df, y OF center + x OF df] :=
|
||||
picture [x OF center + y OF df, y OF center - x OF df] :=
|
||||
picture [x OF center - y OF df, y OF center - x OF df] := color
|
||||
OD
|
||||
END # circle #;
|
||||
|
||||
SKIP
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/a68g --script #
|
||||
# -*- coding: utf-8 -*- #
|
||||
|
||||
PR READ "prelude/Bitmap.a68" PR; # c.f. [[rc:Bitmap]] #
|
||||
PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; # c.f. [[rc:Bitmap/Bresenhams_line_algorithm]] #
|
||||
PR READ "prelude/Bitmap/Midpoint_circle_algorithm.a68" PR;
|
||||
|
||||
# The following illustrates use: #
|
||||
|
||||
test:(
|
||||
REF IMAGE x = INIT LOC [1:16, 1:16] PIXEL;
|
||||
(fill OF class image)(x, (white OF class image));
|
||||
(circle OF class image)(x, (8, 8), 5, (black OF class image));
|
||||
(print OF class image)(x)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue