Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker.mit.edu!bloom-beacon!JARGON.WHOI.EDU!kens From: kens@JARGON.WHOI.EDU (Ken Stewart) Newsgroups: comp.windows.x Subject: strip-chart display Message-ID: <9012281317.AA10469@jargon.whoi.edu> Date: 28 Dec 90 13:17:33 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 72 Howdy Folks -- I'm writing a simple strip-chart application to display various real-time data streams under X. I'm developing under XView 2.0 but using Xlib calls for display functions. I've tried two approaches to "scroll" the display: 1) copy an area of the drawable then draw one new line to connect the new data point; 2) xor the old polyline to clear then xor the updated polyline. The bitblt approach gives the smoothest scrolling. The xor polyline approach runs about 4 times faster on a SPARC-GX, but flickers annoyingly; bracketing the drawing calls with server grab/ungrab doesn't help. Relative speed would depend on the drawable area, but we need reasonably large displayed areas for good viewable resolution (say, 1024x256). I've included skeleton examples below. My questions are: 1) is there a more efficient approach? 2) does anyone have a similar working application or can point me to a PD source? 3) are there any comments on efficiency/ portability for other X environments? (our applications run mostly on Suns, but must support remote displays on PC's, Mac's, and other workstations). Thanks for any help. Ken Stewart Deep Submergence Laboratory voice: (508) 457-2000 x2644 Woods Hole Oceanographic Institution fax: (508) 457-2191 WHOI, Blake 109 internet: kens@jargon.whoi.edu Woods Hole, MA 02543 omnet: k.stewart ************************************************************************** 1) BITBLT . . /* scroll the display right */ XCopyArea( dpy, xwin, xwin, gc, 0, 0, canvas_width - horiz_incr, canvas_height, horiz_incr, 0 ); /* clear a small region at left */ XClearArea( dpy, xwin, 0, 0, horiz_incr, canvas_height, False ); new_y = ... /* connect the new data point */ XDrawLine( dpy, xwin, gc, horiz_incr, last_y, 0, new_y ); last_y = new_y; . . 2) XOR POLYLINE . . XGrabServer( dpy ); /* clear last displayed polyline */ XDrawLines( dpy, xwin, xorgc, points, num_points, CoordModeOrigin ); /* code omitted here to shift y values in array of points */ . . points[0].y = ... XDrawLines( dpy, xwin, xorgc, points, num_points, CoordModeOrigin ); XFlush( dpy ); XUngrabServer( dpy ); . . **************************************************************************