mikeo@sae.UUCP (Mike Ovington Overhead) (05/03/89)
I have a window which has a map background set by XSetWindowBackgroundPixmap. I then draw lines and symbols -- which represent nodes and connections in a network -- on top of the map background. As the status of the connections changes, or as routes change, I would like to update the window by "erasing" some old lines and drawing new ones. I am currently erasing lines by redrawing them in the window's background color. This gets rid of the lines, but corrupts the background map. I can't draw the lines with GXxor, since, on color machines, the lines are color coded. As a workaround, I am clearing the window anytime I have to actually move lines. The clear operation redraws the map background, and the exposure handler and redraw list draws the correct lines, but this causes the whole screen to blink at the user. Does anyone have a better idea of how to "erase" a object drawn in a window that has a background pixmap? Michael S. Ovington uunet!sundc!sae!mikeo Software Architecture & Engineering 1600 Wilson Boulavard, Suite 500 Arlington, VA 22209 (703) 276-7910
rws@EXPO.LCS.MIT.EDU (05/03/89)
Does anyone have a better idea of how to "erase" a object drawn in a window that has a background pixmap? Read Chapter 7 in the Volume One of the O'Reilly books. Alternatively, look at the version of it they donated to us on the R3 distribution, in doc/tutorials/color.tbl.ms.
bobtl@tekecs.GWD.TEK.COM (Bob Toole) (05/04/89)
Sounds like what you need is an overlay plane. You should be able to use XAllocColorCells with nplanes = 1, assuming that you can control what pixels are used to build your colormap. If you need more than one line color, up the number of planes. Basically, set up your colormap so that the color cells without the plane bit set are the colors you want in your pixmap, those with that bit set are your line color. Then draw and erase your lines with XOR mode and foreground value of planemask.
garya@Solbourne.COM (Gary Aitken) (05/04/89)
> Does anyone have a better idea of how to "erase" a[n] object > drawn in a window that has a background pixmap? Do an XClearArea. -- Gary Aitken Solbourne Computer Inc. ARPA: garya@Solbourne.COM Longmont, CO UUCP: ...!{boulder,sun}!stan!garya
garya@Solbourne.COM (Gary Aitken) (05/05/89)
> Does anyone have a better idea of how to "erase" a[n] object > drawn in a window that has a background pixmap? Do an XClearArea for the region where the line was. -- Gary Aitken Solbourne Computer Inc. ARPA: garya@Solbourne.COM Longmont, CO UUCP: ...!{boulder,sun}!stan!garya
stroyan@hpfcdc.HP.COM (Mike Stroyan) (05/05/89)
If you need more line colors than you can allocate planes for, you could erase lines in front of a background pixmap by drawing the lines using a GC which has a 'fill_style' value of 'FillTiled' and a 'tile' value of the background pixmap. That should set the pixels in the line to the background pixmap values. Of course, the performance may be terrible. Mike Stroyan, stroyan@hpfcla.hp.com
jonnyg@umd5.umd.edu (Jon Greenblatt) (05/05/89)
In article <6910007@hpfcdc.HP.COM> stroyan@hpfcdc.HP.COM (Mike Stroyan) writes: >If you need more line colors than you can allocate planes for, you could >erase lines in front of a background pixmap by drawing the lines using a >GC which has a 'fill_style' value of 'FillTiled' and a 'tile' value of >the background pixmap. That should set the pixels in the line to the >background pixmap values. Of course, the performance may be terrible. > >Mike Stroyan, stroyan@hpfcla.hp.com Here is what I do: Pixmap pix; pix = XCreateBitmapFromData(Dpy,Wnd, dither_map_bits,dither_map_width,dither_map_height); XSetTile(Dpy,gc,pix); XFreePixmap(Dpy,pix); XSetFillStyle(Dpy,gc,FillTiled); Now anything including lines and filled things will use dither_map to draw on the screen. There is a command to set the tiling origin, make sure that is correct, the default should work fine. BTW the performance seems to be OK. JonnyG.