Skip to content

Commit

Permalink
[#15] stroke-cap and stoke-join
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Nov 29, 2018
1 parent 33834d3 commit 9056023
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
6 changes: 2 additions & 4 deletions docs/quil.core.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@
- [ ] [`state`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L227) - "Retrieve sketch-specific state by key"
- [ ] [`state-atom`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L202) - "Retrieve sketch-specific state-atom"
- [x] [`stroke`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3885) - "Sets the color used to draw lines and borders around shapes"
- [ ] [`stroke-cap`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3915) - "Sets the style for rendering line endings"
- [ ] [`stroke-cap-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [ ] [`stroke-join`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3931) - "Sets the style of the joints which connect line segments"
- [ ] [`stroke-join-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [x] [`stroke-cap`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3915) - "Sets the style for rendering line endings"
- [x] [`stroke-join`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3931) - "Sets the style of the joints which connect line segments"
- [x] [`stroke-weight`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3951) - "Sets the width of the stroke used for lines, points, and the border around shapes"
- [ ] [`tan`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3963) - "Calculates the ratio of the sine and cosine of an angle"
- [x] [`target-frame-rate`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3978) - "Returns the target framerate specified with the fn frame-rate"
Expand Down
15 changes: 14 additions & 1 deletion src/doodler/core.clje
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns doodler.core
(:require [doodler.util :as u]))
(:require [doodler.util :as u]
[doodler.wx.gui :as gui]))

(def ^:dynamic *canvas* nil)

Expand Down Expand Up @@ -63,6 +64,18 @@
(wxPen/setWidth pen weight)
(wxDC/setPen *canvas* pen)))

(defn stroke-cap
[cap-mode]
(let [pen (:pen *sketch*)]
(wxPen/setCap pen (gui/->stroke-cap cap-mode))
(wxDC/setPen *canvas* pen)))

(defn stroke-join
[join-mode]
(let [pen (:pen *sketch*)]
(wxPen/setJoin pen (gui/->stroke-join join-mode))
(wxDC/setPen *canvas* pen)))

(defn background
([gray]
(background gray 255))
Expand Down
25 changes: 22 additions & 3 deletions src/doodler/wx/gui.clje
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,35 @@
(def frame-style-close-box 4096)
(def frame-style-stay-on-top 32768)

(def stroke-cap-round 130)
(def stroke-cap-projecting 131)
(def stroke-cap-butt 132)

(def stroke-join-bevel 120)
(def stroke-join-mitter 121)
(def stroke-join-round 122)

(def default-frame-style
(bit-or frame-style-system-menu
frame-style-minimize-box
frame-style-close-box
frame-style-caption
frame-style-clip-children))

(def feature->style {:keep-on-top [frame-style-stay-on-top]
:resizable [frame-style-resize-border
frame-style-maximize-box]})
(def feature->style
{:keep-on-top [frame-style-stay-on-top]
:resizable [frame-style-resize-border
frame-style-maximize-box]})

(def ->stroke-cap
{:round stroke-cap-round
:project stroke-cap-projecting
:square stroke-cap-butt})

(def ->stroke-join
{:miter stroke-join-mitter
:bevel stroke-join-bevel
:round stroke-join-round})

(defn frame-style
[features]
Expand Down

0 comments on commit 9056023

Please sign in to comment.