[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 3 14:34:10 1993 
Subject:Re: Controlling image display duration 
From:jonm (Jonathan Meyer) 
Volume-ID:930803.04 

>I would like to be able to display an image for known durations, of the order
>of 100msec, 200msec, 600msec, 5sec etc. with an accuracy of 0-20msec per 
>exposure. Could Pop deliver this?

The easiest way to do this is to preload each image onto a different 
XpwGraphic window and the hide/show the windows to display the images, using
syssleep to time things. I've included some sample code below which you
could use for ideas (after suitable tidying up).

The only part I've missed out is how to get raster images to the X server in
the first place. If you have Xpi you can use that to read and display sun 
rasterfiles, gif images, pcx images, etc. in a Poplog Graphics window, which
takes most of the pain out of the process. (see REF *Xpi).

Jon Meyer.


;;; DECLARATIONS (see TEACH *Xpw)

uses popxlib;   ;;; using X

uses xt_widget;
uses xt_callback;
uses xt_event;

constant
    XpwGraphic = XptWidgetSet("Poplog")("GraphicWidget"),
    XpwComposite = XptWidgetSet("Poplog")("CompositeWidget"),
    ApplicationShell = XptWidgetSet("Toolkit")("ApplicationShellWidget")
;

;;; SETUP

XptDefaultSetup();

vars shell = XtAppCreateShell('slideshow', 'Poplog',
                        ApplicationShell,
                        XptDefaultDisplay,
                        []);

vars composite = XtCreateManagedWidget('composite',
                    XpwComposite, shell,
                    [{width 300} {height 200}]));

;;; make 5 graphics windows. Put them in a list of the form:
;;; [ WINDOW DISPLAY_TIME WINDOW DISPLAY_TIME ... ]
vars graphics =
  [%
        repeat 5 times
            ;;; graphics window
            XtCreateWidget('graphic',
                XpwGraphic, composite,
                [{width 300} {height 200}]));
	
            ;;; the time to show this picture for, in hundredths of a sec
            random(100),
        endrepeat;
  %];

;;; show the top level window
XtRealizeWidget(shell);

;;; DRAW IMAGES

;;; draw 100 random lines in each graphics window
vars graphic;
for graphic in graphics do
	nextif(graphic.isinteger); ;;; ignore the TIME fields
	repeat 100 times;
		XpwDrawLine(graphic,
			random(300), random(200), random(300), random(200));
	endrepeat;
endfor;

;;; RUN SLIDESHOW

define slideshow;
	lvars list = graphics, graphic, time;
	until list == [] do
		dest(list) -> list -> graphic;
		dest(list) -> list -> time;
 		;;; show the graphic
		XtMapWidget(graphic);
		;;; pause
		syssleep(time);
		;;; hide the graphic
		XtUnmapWidget(graphic);
	enduntil;			
enddefine;

slideshow();