Skip to content

Commit

Permalink
Updated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nangah Amandine Chi authored and Nangah Amandine Chi committed Oct 27, 2023
1 parent 9e6831f commit d3f5154
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/shape.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ let denormalize point =
let rec render_shape s =
match s with
| Circle circle ->
set_color black;
if circle.fill <> Transparent then begin
match circle.fill with
| RGB (r, g, b) -> set_color (rgb r g b);
Expand All @@ -43,8 +42,8 @@ let rec render_shape s =
| Transparent -> ()
end;
draw_circle (denormalize circle.c).x (denormalize circle.c).y circle.radius;

| Rectangle rectangle ->
set_color black;
let c = denormalize rectangle.c in
if rectangle.fill <> Transparent then begin
match rectangle.fill with
Expand All @@ -59,8 +58,8 @@ let rec render_shape s =
| Transparent -> ()
end;
draw_rect c.x c.y rectangle.length rectangle.width;

| Ellipse ellipse ->
set_color black;
let c = denormalize ellipse.c in
if ellipse.fill <> Transparent then begin
match ellipse.fill with
Expand All @@ -75,10 +74,12 @@ let rec render_shape s =
| Transparent -> ()
end;
draw_ellipse c.x c.y ellipse.rx ellipse.ry;

| Line line ->
let a = denormalize line.a in
let b = denormalize line.b in
draw_line a.x a.y b.x b.y
draw_line a.x a.y b.x b.y;

| Complex complex -> List.iter render_shape complex

let circle ?x ?y ?(fill = Transparent) ?(stroke = RGB (0, 0, 0)) r =
Expand Down

0 comments on commit d3f5154

Please sign in to comment.