forked from OdonataResearchLLC/LispPlotter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotter-boxes.lisp
48 lines (36 loc) · 1.14 KB
/
plotter-boxes.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(in-package :plotter)
(defun inset-box-sides (box dxleft dytop &optional
(dxright dxleft) (dybottom dytop))
(list
(+ (gp:rectangle-left box) dxleft)
(+ (gp:rectangle-top box) dytop)
(- (gp:rectangle-right box) dxright)
(- (gp:rectangle-bottom box) dybottom)))
(defmacro box-left (box)
`(gp:rectangle-left ,box))
(defmacro box-top (box)
`(gp:rectangle-top ,box))
(defmacro box-right (box)
`(gp:rectangle-right ,box))
(defmacro box-bottom (box)
`(gp:rectangle-bottom ,box))
(defmacro box-width (box)
`(gp:rectangle-width ,box))
(defmacro box-height (box)
`(gp:rectangle-height ,box))
(defmacro box-top-left (box)
(let ((gbx (gensym)))
`(let ((,gbx ,box))
(list (box-left ,gbx) (box-top ,gbx)))))
(defmacro box-top-right (box)
(let ((gbx (gensym)))
`(let ((,gbx ,box))
(list (box-right ,gbx) (box-top ,gbx)))))
(defmacro box-bottom-left (box)
(let ((gbx (gensym)))
`(let ((,gbx ,box))
(list (box-left ,gbx) (box-bottom ,gbx)))))
(defmacro box-bottom-right (box)
(let ((gbx (gensym)))
`(let ((,gbx ,box))
(list (box-right ,gbx) (box-bottom ,gbx)))))