Re: XForms: Pixmaps etc.

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 24 Jun 98 13:06:36 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

My apologies to the list for the previous reply -- I managed to crash
one of my systems while composing a reply...

> ... I then have a graphic of an aircraft
> which can move freely over the map, but which obviously erases
> what's under it. Is it possible to paint the aircraft with some
> type of XOR scheme so the original pixel color comes back after
> the plane moves. ...

Yes, it is -- you'll have to manipulate the GC to put it in XOR draw
mode, but I don't think this is going to be satistfactory, since you
have little control over the colors. You'll basically flip bits in
the pixel and get whatever junk is in the Colormap for that index.

> ... Or is there some way to read what color a certain
> pixel is so I can redraw the map that was previously under the
> airplane? ...

You could use XCopyArea to copy the pixels from under your airplane
sprite into an offscreen pixmap and then copy them back again. If the
sprite is small enough, you should be able to do it without noticable
flicker.

Refer to your favorite Xlib manual for details.

> ... I'm trying to avoid keeping the 600 by 600 pixel
> map in memory, although I guess that is an option. ...

Why is this a constraint. That's not much memory in terms of today's
machines.

What kind of machine are you on? What type of Visuals are you
planning on supporting? TrueColor? PseudoColor?

I still suggest that a background Pixmap is the correct solution,
however, since you hand over all the bitblting annoyance to X, which
can do it much better than you can.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/