Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x Subject: Re: Remembering Graphics Message-ID: <1991Mar24.180043.9052@cs.tcd.ie> Date: 24 Mar 91 18:00:43 GMT References: <9103211805.AA00981@neuro_dev.mayo.EDU> Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 42 In <9103211805.AA00981@neuro_dev.mayo.EDU> kall@mayo.EDU (Bruce Kall) writes: >[An application which displays image data in a window (actually a >pixmap which is then copied to the window upon exposure) and then >draws some lines and text over the image. When the image changes, is >there any way to avoid having to recompute/redraw the text and lines >which are independant of the image data?] > >- We do not want to limit the number of bits in the colormap [...] >- We have thought about have text/lines in one Pixmap and the image in another >Pixmap and then combining them together when a window is Exposed. None of >the GC functions seem to be correct to do this. We use colormap locations >0-8 for colors and 9-256 for the grayscale image. What you can do is have a pixmap for the image data. Also have a _bitmap_ (a 1 bit deep pixmap) into which you will draw the text and lines. To get the image & text/lines into a window you use XCopyArea() to copy the image data from the pixmap and then use XCopyPlane() to copy from the bitmap into the window. The GC used in XCopyPlane() should: o Have the clipmask set to the bitmap which is the source of the XCopyPlane() call. o Have its foreground color set to the color that you want the text and lines drawn in. (If you want the text and lines drawn in different colors then you'll have to use several bitmaps---one bitmap for text/lines to be drawn in red, another for text/lines to be drawn in blue, and so on.) You will, of course, need to use different GCs to draw into the pixmap and bitmap (since they have different depths) but that shouldn't present any difficulties. Also, note that I haven't tried what I've outlined above, so I don't know how quickly XCopyPlane() will work when the GCs clipmask is set to a bitmap. (Anybody know what sort or performance to expect?) Ciaran. -- Ciaran McHale "Verbosity says it all" ____ Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie