Here is an example program:
# Smart window example script (set win (xwin-create Null "Smart Window test" [100 100] [620 480])) (set smartwin (new-smart-window)) (set foreground (new-standard-image 3 [640 480])) (set background (new-standard-image 3 [640 480])) # fill foreground to red (image-fill-constant 255 (isolate-channel 0 foreground)) (image-fill-constant 0 (isolate-channel 1 foreground)) (image-fill-constant 0 (isolate-channel 2 foreground)) (smartwin 'm' [0 0 639 479]) # mark entire image as modified (smartwin 's' foreground background) # save foreground to background (set dispinfo (smartwin 'd' foreground)) # get area to display (print "Displaying a " ((dispinfo 0) buf-dims) "size piece at " (dispinfo 1) newline) (xwin-display-image win (dispinfo 0) (dispinfo 1)) # display it (print "Press return to continue" newline) (read-string) # make a rectangle (image-fill-constant 255 (isolate-sub-image [100 100] [100 200] (isolate-channel 1 foreground))) (smartwin 'm' [100 100 199 299]) # mark that area as modified (set dispinfo (smartwin 'd' foreground)) # get area to display (print "Displaying a " ((dispinfo 0) buf-dims) "size piece at " (dispinfo 1) newline) (xwin-display-image win (dispinfo 0) (dispinfo 1)) # display it (print "Press return to continue" newline) (read-string) (smartwin 'c' foreground background) # clears the foreground # make a different rectangle (image-fill-constant 255 (isolate-sub-image [150 200] [200 100] (isolate-channel 2 foreground))) (smartwin 'm' [150 200 349 299]) # mark that area as modified (set dispinfo (smartwin 'd' foreground)) # get area to display (print "Displaying a " ((dispinfo 0) buf-dims) "size piece at " (dispinfo 1) newline) (xwin-display-image win (dispinfo 0) (dispinfo 1)) # display it (print "Press return to continue" newline) (read-string) (smartwin 'c' foreground background) (set dispinfo (smartwin 'd' foreground)) # get area to display (print "Displaying a " ((dispinfo 0) buf-dims) "size piece at " (dispinfo 1) newline) (xwin-display-image win (dispinfo 0) (dispinfo 1)) # display it (print "Press return to continue" newline) (read-string)
Scripts: | (load "smart-window.isis")
|