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
|
(use canvas-draw iup)
(import canvas-draw-iup)
(load "vg.scm")
(use trace)
(trace
vg:draw-rect
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-obj 10 40 20 50 text: "A long piece of text" font: "Helvetica, -10"))
(let ((r1 (vg:make-rect-obj 20 20 30 30 text: "r1" font: "Helvetica, -20"))
(r2 (vg:make-rect-obj 30 30 60 60 text: "r2" font: "Helvetica, -10"))
(t1 (vg:make-text-obj 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)
|
>
>
>
>
|
|
|
|
|
>
>
>
>
>
>
|
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
|
(use canvas-draw iup)
(import canvas-draw-iup)
(load "vg.scm")
(define numtorun (if (> (length (argv)) 1)
(string->number (cadr (argv)))
1000))
;; (use trace)
;; (trace
;; vg:draw-rect
;; 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-obj 10 40 20 50 text: "A long piece of text" font: "Helvetica, -10"))
(let ((r1 (vg:make-rect-obj 20 20 30 30 text: "r1" font: "Helvetica, -20"))
(r2 (vg:make-rect-obj 30 30 60 60 text: "r2" font: "Helvetica, -10"))
(t1 (vg:make-text-obj 60 60 "The middle" font: "Helvetica, -10")))
(vg:add-objs-to-comp c1 r1 r2 t1 bt1))
(let ((start (current-seconds)))
(let loop ((i 0))
(vg:add-obj-to-comp c1 (vg:make-rect-obj 0 0 100 100))
(if (< i numtorun)(loop (+ i 1))))
(print "Run time: " (- (current-seconds) start)))
;; 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)
|