Re: Fw: XForms: Pixmaps etc.

Yann Guichoux (guichoux@shom.fr)
Fri, 26 Jun 1998 08:37:13 +0200

# To subscribers of the xforms list from Yann Guichoux <guichoux@shom.fr> :

> >># 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/
> >>
> >>

you can just use 2 pixmaps for your application...
first the _BackgroundPixmap within you draw your map at the beginning of
your application

Then you create a 2nd pixmap within you will draw your plane after
having restored the background by copiing the first one...

/*** restore backgroundmap ****/
XCopyArea(dpy,_backgroundPixmap,_planePixmap,gc,0,0,carte->get_fl_structure()->fl_pixmap->w,carte->get_fl_structure()->fl_pixmap->h,0,0);

/*** then redraw your plane***/

XFillRectangle(dpy,_planePixmap,gc,plane.x,plane.y,3,3);

}

/*** and show your pixmap redrawn **/

fl_set_pixmap_pixmap(carte->get_fl_structure()->fl_pixmap,_planePixmap,0);
fl_show_object(carte->get_fl_structure()->fl_pixmap);

And it should not flickers...
_________________________________________________
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/