Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
INTERFACE Circle;
|
||||
|
||||
IMPORT Bitmap;
|
||||
|
||||
PROCEDURE Draw(
|
||||
img: Bitmap.T;
|
||||
center: Bitmap.Point;
|
||||
radius: CARDINAL;
|
||||
color: Bitmap.Pixel);
|
||||
|
||||
END Circle.
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
MODULE Circle;
|
||||
|
||||
IMPORT Bitmap;
|
||||
|
||||
PROCEDURE Draw(
|
||||
img: Bitmap.T;
|
||||
center: Bitmap.Point;
|
||||
radius: CARDINAL;
|
||||
color: Bitmap.Pixel) =
|
||||
VAR f := 1 - radius;
|
||||
ddfx := 0;
|
||||
ddfy := - 2 * radius;
|
||||
x := 0;
|
||||
y := radius;
|
||||
BEGIN
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x, center.y + radius}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x, center.y - radius}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x + radius, center.y}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x - radius, center.y}, color);
|
||||
WHILE x < y DO
|
||||
IF f >= 0 THEN
|
||||
y := y - 1;
|
||||
ddfy := ddfy + 2;
|
||||
f := f + ddfy;
|
||||
END;
|
||||
x := x + 1;
|
||||
ddfx := ddfx + 2;
|
||||
f := f + ddfx + 1;
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x + x, center.y + y}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x - x, center.y + y}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x + x, center.y - y}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x - x, center.y - y}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x + y, center.y + x}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x - y, center.y + x}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x + y, center.y - x}, color);
|
||||
Bitmap.SetPixel(img, Bitmap.Point{center.x - y, center.y - x}, color);
|
||||
END;
|
||||
END Draw;
|
||||
|
||||
BEGIN
|
||||
END Circle.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
MODULE Main;
|
||||
|
||||
IMPORT Circle, Bitmap, PPM;
|
||||
|
||||
VAR testpic: Bitmap.T;
|
||||
|
||||
BEGIN
|
||||
testpic := Bitmap.NewImage(32, 32);
|
||||
Bitmap.Fill(testpic, Bitmap.White);
|
||||
Circle.Draw(testpic, Bitmap.Point{16, 16}, 10, Bitmap.Black);
|
||||
PPM.Create("testpic.ppm", testpic);
|
||||
END Main.
|
||||
Loading…
Add table
Add a link
Reference in a new issue