9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
vg:grow-rect
vg:components-get-extents)
(define d1 (vg:drawing-new))
(define l1 (vg:lib-new))
(define c1 (vg:comp-new))
(define c2 (vg:comp-new))
(let ((r1 (vg:make-rect 20 20 30 30 text: "r1" font: "Helvetica, -20"))
(r2 (vg:make-rect 30 30 60 60 text: "r2" font: "Helvetica, -10"))
(t1 (vg:make-text 60 60 "The middle" font: "Helvetica, -10")))
(vg:add-objs-to-comp c1 r1 r2 t1))
;; add the c1 component to lib l1 with name firstcomp
(vg:add-comp-to-lib l1 "firstcomp" c1)
(vg:add-comp-to-lib l1 "secondcomp" c2)
;; add the l1 lib to drawing with name firstlib
(vg:add-lib d1 "firstlib" l1)
|
>
>
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
vg:grow-rect
vg:components-get-extents)
(define d1 (vg:drawing-new))
(define l1 (vg:lib-new))
(define c1 (vg:comp-new))
(define c2 (vg:comp-new))
(define bt1 (vg:make-rect 10 40 20 50 text: "A long piece of text" font: "Helvetica, -10"))
(let ((r1 (vg:make-rect 20 20 30 30 text: "r1" font: "Helvetica, -20"))
(r2 (vg:make-rect 30 30 60 60 text: "r2" font: "Helvetica, -10"))
(t1 (vg:make-text 60 60 "The middle" font: "Helvetica, -10")))
(vg:add-objs-to-comp c1 r1 r2 t1 bt1))
;; add the c1 component to lib l1 with name firstcomp
(vg:add-comp-to-lib l1 "firstcomp" c1)
(vg:add-comp-to-lib l1 "secondcomp" c2)
;; add the l1 lib to drawing with name firstlib
(vg:add-lib d1 "firstlib" l1)
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
;; 1.1 1.1 -2 -2))
;; get extents of c1 and put a rectange around it
;;
(define xtnts (apply vg:grow-rect 10 10 (vg:components-get-extents d1 c1)))
(vg:add-objs-to-comp c1 (apply vg:make-rect xtnts))
;; get extents of all objects and put rectangle around it
;;
(define big-xtnts (vg:instances-get-extents d1))
(vg:add-objs-to-comp c2 (apply vg:make-rect big-xtnts))
(vg:instantiate d1 "firstlib" "secondcomp" "inst3" 0 0)
(vg:drawing-scalex-set! d1 1.5)
|
>
>
>
>
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
;; 1.1 1.1 -2 -2))
;; get extents of c1 and put a rectange around it
;;
(define xtnts (apply vg:grow-rect 10 10 (vg:components-get-extents d1 c1)))
(vg:add-objs-to-comp c1 (apply vg:make-rect xtnts))
(define bt1xt (vg:obj-get-extents d1 bt1))
(print "bt1xt: " bt1xt)
(vg:add-objs-to-comp c1 (apply vg:make-rect bt1xt))
;; get extents of all objects and put rectangle around it
;;
(define big-xtnts (vg:instances-get-extents d1))
(vg:add-objs-to-comp c2 (apply vg:make-rect big-xtnts))
(vg:instantiate d1 "firstlib" "secondcomp" "inst3" 0 0)
(vg:drawing-scalex-set! d1 1.5)
|