Skip to content

Commit

Permalink
[#15] arc
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Nov 24, 2018
1 parent 47e499d commit 79c4b0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/doodler/core.clje
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,22 @@
(wxBrush/setColour brush (apply color args))
(wxDC/setBrush *canvas* brush)))

(defn fill-rect
(defn arc
[x y w h start end]
(wxDC/drawEllipticArc *canvas* #erl[x y] #erl[w h] start end))

(defn ellipse
[x y w h]
(wxDC/drawEllipse *canvas* #erl[x y] #erl[w h]))

(defn rect
[x y w h]
(wxDC/drawRectangle *canvas* #erl[x y] #erl[w h]))

(defn point
[x y]
(wxDC/drawPoint *canvas* (tuple x y)))

(defn circle
[x y r]
(wxDC/drawCircle *canvas* #erl[x y] r))

(defn width
[]
(erlang/element 1 (wxDC/getSize *canvas*)))
Expand Down
8 changes: 4 additions & 4 deletions src/doodler/examples/circles.clje
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
(d/stroke (rand-int 255))
(d/stroke-weight (rand-int 10))
(d/fill (rand-int 255))
(let [radius (rand-int 50)
x (rand-int (d/width))
y (rand-int (d/height))]
(d/circle x y radius)))
(let [diam (rand-int 100)
x (rand-int (d/width))
y (rand-int (d/height))]
(d/ellipse x y diam diam)))

(d/defsketch sketch
:title "Oh so many circles"
Expand Down

0 comments on commit 79c4b0e

Please sign in to comment.