Skip to content

Commit a1a22d6

Browse files
[lisp/geo/viewport.l] add color option for :draw-star, :draw-polyline, :draw-box-NDC
1 parent 0630e03 commit a1a22d6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lisp/geo/viewport.l

+10-10
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@
197197
(setq width (send port :ndc-width-to-screen width))
198198
(setq height (send port :ndc-height-to-screen height))
199199
(send surface :draw-fill-arc point width height angle1 angle2))
200-
(:draw-polyline-NDC (polyline)
200+
(:draw-polyline-NDC (polyline &optional color)
201201
(let ((p1 (pop polyline)) p2)
202202
(while polyline
203203
(setq p2 (pop polyline))
204-
(send self :draw-line-NDC p1 p2 t)
204+
(send self :draw-line-NDC p1 p2 t color)
205205
(setq p1 p2))))
206-
(:draw-box-NDC (lower-left upper-right)
206+
(:draw-box-NDC (lower-left upper-right &optional color)
207207
(declare (float-vector lower-left upper-right))
208208
(let ((x1 (aref lower-left 0)) (y1 (aref lower-left 1))
209209
(x2 (aref upper-right 0)) (y2 (aref upper-right 1)))
@@ -212,13 +212,13 @@
212212
(float-vector x1 y1 0) (float-vector x2 y1 0)
213213
(float-vector x2 y2 0) (float-vector x1 y2 0)
214214
(float-vector x1 y1 0)))))
215-
(:draw-star-NDC (point &optional (size 0.02))
215+
(:draw-star-NDC (point &optional (size 0.02) (color nil))
216216
(send self :draw-line-NDC
217217
(float-vector (- (aref point 0) size) (aref point 1) 0)
218-
(float-vector (+ (aref point 0) size) (aref point 1) 0))
218+
(float-vector (+ (aref point 0) size) (aref point 1) 0) t color)
219219
(send self :draw-line-NDC
220220
(float-vector (aref point 0) (- (aref point 1) size) 0)
221-
(float-vector (aref point 0) (+ (aref point 1) size) 0))) )
221+
(float-vector (aref point 0) (+ (aref point 1) size) 0) t color)) )
222222

223223
;; drawing primitives which work in world coordinates
224224
;; First, viewing and projective transformations are applied,
@@ -234,9 +234,9 @@
234234
(setq size (float-vector size size 0.0))
235235
(setq v (homo2normal (send eye :view v)))
236236
(send self :draw-box-NDC (v- v size) (v+ v size)))
237-
(:draw-polyline (vlist)
237+
(:draw-polyline (vlist &optional color)
238238
(send self :draw-polyline-ndc
239-
(mapcar #'(lambda (x) (send eye :view x)) vlist)))
239+
(mapcar #'(lambda (x) (send eye :view x)) vlist) color))
240240
(:draw-arc (point width height
241241
&optional (angle1 0) (angle2 2pi) color
242242
&aux v)
@@ -275,9 +275,9 @@
275275
(sys:reclaim p1) (sys:reclaim p2)
276276
(sys:reclaim pn) (sys:reclaim pa) (sys:reclaim pb)))
277277
(:pane () (send self :draw-box-NDC #f(-1 -1 0) #f(1 1 0)))
278-
(:draw-star (v &optional size)
278+
(:draw-star (v &optional size color)
279279
(if (null size) (setq size 0.02))
280-
(send self :draw-star-NDC (homo2normal (send eye :view v)) size))
280+
(send self :draw-star-NDC (homo2normal (send eye :view v)) size color))
281281
(:draw-2dlnseg (l)
282282
(send self :draw-line (send l :spos) (send l :epos))) )
283283

0 commit comments

Comments
 (0)