Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!seismo!uunet!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!ai.mit.edu!sundar From: sundar@ai.mit.edu (Sundar Narasimhan) Newsgroups: comp.windows.x Subject: Re: porting unstructured graphics code to X Message-ID: <13601@life.ai.mit.edu> Date: 27 Feb 91 23:02:12 GMT References: <1991Feb25.212501.1776@yogi.fhhosp.ab.ca> <1991Feb26.092358@wsl.dec.com> <1991Feb27.073653@mccall.com> Sender: news@ai.mit.edu Reply-To: sundar@ai.mit.edu Organization: MIT Artificial Intelligence Laboratory Lines: 28 In article <1991Feb27.073653@mccall.com>, tp@mccall.com (Terry Poot) writes: |> In article <1991Feb26.092358@wsl.dec.com>, klee@wsl.dec.com (Ken Lee) writes: |> >In article <1991Feb25.212501.1776@yogi.fhhosp.ab.ca>, |> >henry@yogi.fhhosp.ab.ca writes: |> >|> Is there any easy way to port the code so that I can just draw into |> >|> a window, and *not* have to worry about redrawing from Expose |> >events? |> > |> >Try using the X Toolkit, with the graphics encapsulated in a widget. |> >The X Toolkit will manage your expose events for you. |> |> Of course, you'd still have to write that widget. Hmm.. You may want to look at the Display widget found in trix.ai.mit.edu:/com/ftp/pub/users/sundar/graph.tar.Z. It attempts to manage Expose events for the programmer and the package has a simple graph widget built on top of it. The display widget uses a list of graphic objects to redraw on each Expose event. -Sundar ps. Standard disclaimers. pps. I do have another set of library functions that manages Expose events directly using raw Xlib calls. The idea is to create a pixmap, and draw on the pixmap as well as on the window during each drawing operation. On an expose event one simply copies the pixmap to the window. We use this library for the graphics course here at MIT and are quite happy with it.