3 ;; image-demo.lsp - demonstrate images rotating and zooming
4 ;; and the mouse-wheel rotating an object
8 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
13 (gs:frame
'ImageDemo
100 100 600 600 "Image demo")
14 (gs:set-border-layout
'ImageDemo
)
15 ;(gs:set-resizable 'ImageDemo nil)
17 (gs:set-background
'MyCanvas gs
:white
)
19 (gs:radio-button
'ZoomButton
'zoom-action
"zoom")
20 (gs:radio-button
'TurnButton
'turn-action
"turn")
21 (gs:set-selected
'TurnButton true
)
23 (gs:add-to
'Select
'ZoomButton
'TurnButton
)
24 (gs:add-to
'ImageDemo
'MyCanvas
"center" 'Select
"south")
25 (gs:mouse-wheel
'MyCanvas
'mouse-wheel-action
)
27 ;(gs:set-scale 0.5 0.5) ; only for testing
29 (gs:set-font
'MyCanvas
"Lucida Sans Oblique" 14 "plain")
30 (gs:draw-text
'T
"turn mouse wheel to turn or zoom image" 20 50 gs
:darkGray
)
31 (gs:draw-image
'S
"/local/newLISP128.png" 320 20 32 50)
32 (gs:draw-image
'S
"/local/newLISP128.png" 380 30 50 32)
34 (gs:draw-image
'I
"/local/newLISP128.png" -
64 -
64)
35 (gs:translate-tag
'I
300 300)
37 (gs:set-visible
'ImageDemo true
)
41 (define (zoom-action id flag
)
42 (gs:set-selected
'TurnButton
(not flag
))
43 (set 'turn-flag
(not flag
))
46 (define (turn-action id flag
)
47 (gs:set-selected
'ZoomButton
(not flag
))
52 (define (mouse-wheel-action x y wheel
)
54 (gs:rotate-tag
'I wheel
0 0)
56 (gs:scale-tag
'I
0.9 0.9)
57 (gs:scale-tag
'I
1.1 1.1)