Image windows Isis software documentation

Image windows

This library provides platform-independent objects and routines for opening windows and displaying images on either the desktop or external video display devices. Only byte-sampled images are supported. Images are handled using the image buffer protocol.


Easy windows

(easywin-create image) # open window and display image (easywin-create image title pos) # optional title and position (easywin-close easywin) # close window easywin-create opens a window and displays an Isis image buffer in that window, and returns a window handle. An optional title and window position may be passed. easywin-close closes a previously created window.
(set image (retrieve-url-image "file:/usr/local/isis/media/nana.jpg")) (set win (easywin-create image "Nana")) (easywin-close win)


Window object

(win-create commands ...) # create new window win-create creates a new window using whatever means available on the machine. A procedure is returned that serves as the interface to the window. Commands may be sent to the window in the win-create call, or by calling the returned procedure. Commands take the form of lists in which the first item is an "opcode" that identifies the command to execute, and the rest of the items are the arguments for that command. Several commands may be passed in each call to the window, and they will be carried out in order, and only the result of the last command will be returned. [win-type typestr] # set type: "external" or "default" [win-size [xsize ysize]] # set size (default [350 350]) [win-title titlestr] # set title (default "Isis") [win-pos [xpos ypos]] # set position (default [100 100]) [win-buf] # return current image buffer for the window [win-output] # output current buffer, return next buffer [win-put image {pos}] # transfer an image into the buffer, optional pos [win-combfunc func] # set image combination func: (func put-command image) [win-close] # close and destroy window The type, size, title, and position commands should all be specified when creating the window, as not all platforms support changing these attributes after creation. None of these commands is actually required (see default values above). If the type is set to "external", an external monitor will be used for display, if available.

The win-buf command will return the current Isis image serving as the buffer for the window. The user is free to modify this buffer as needed, and then call win-output to display it on the device. win-output will return the next Isis image that will serve as the buffer for the window. Several different buffers may be in use depending on the device, so it is important to obtain the current buffer after each win-output command. Furthermore, image data placed in these buffers may not survive after each win-output command, so all frames should be prepared from scratch.

The win-put command transfers the specified image into the current window buffer at an optional position. Several win-put commands may be made in succession, but changes will not be made visible until a win-output command is passed.

Advanced users may use the win-combfunc command to specify the function used by win-put to transfer images into the window buffer. The function should accept two arguments: the win-put command list, and the destination image buffer. The default is a simple transfer function that works for images with 1 or 3 channels.

win-close closes and destroys the window and frees any resources that were allocated. Do not attempt to call the window object again after this command.

Below are a few examples:

(set image (retrieve-url-image "file:/usr/local/isis/media/nana.jpg")) (set win (win-create [win-pos [500 500]] [win-title "Nana"] [win-size (+ (image buf-dims) [50 50])] [win-put image [25 25]] [win-output])) (set winbuf (win [win-buf])) (image-gainbias 0.5 64 image (isolate-sub-image [25 25] (image buf-dims) winbuf)) (win [win-output]) (set winbuf (win [win-buf])) (image-fill-constant 255 (isolate-channel 0 winbuf)) (image-fill-constant 128 (isolate-channel 1 winbuf)) (image-fill-constant 64 (isolate-channel 2 winbuf)) (win [win-output]) (set framesize [640 480]) (set win2 (win-create [win-type "external"] [win-size framesize] [win-put image (/ (- framesize (image buf-dims)) [2 2])] [win-output])) (win [win-close]) (win2 [win-close])


Requirements:
Scripts: (load "image-window.isis")
Other: At least one of the following libraries should be operational:
OpenGL, MIL, MME video, or X windows