Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!ucbcad!ucbvax!GRANITE.DEC.COM!todd From: todd@GRANITE.DEC.COM (Todd Newman) Newsgroups: comp.windows.x Subject: Colormaps for StaticColor visuals Message-ID: <8711042337.AA01754@granite.DEC.COM> Date: Wed, 4-Nov-87 18:37:33 EST Article-I.D.: granite.8711042337.AA01754 Posted: Wed Nov 4 18:37:33 1987 Date-Received: Mon, 9-Nov-87 03:37:56 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 41 This is in reply to Michael Toy's mail. (It would be nice if the return address given is one I can actually use instead of one that will work "Someday.") I'm having trouble believing what you've said. You said: PortingLayer doc suggests checking the BeingCreated bit in the ddx CreateColormap routine and if it is set, calling AllocColor for each pixel. This doesn't work. AllocColors calss Find which just returns if your visualtype is StaticColor. It's hard for me to believe that FindColor just returns. You've actually run this and had it fail? I'm puzzled because I double-checked the source code and can't see why it should. AllocColor will diddle with its concept of the class so that if the server is creating the colormap, and the BeingCreated flag is set, the class becomes Dynamic. That means that it will ALWAYS call FindColor when you're creating a colormap. Three points about FindColor: Firstly, FindColor never checks whether the colormap is static or not. There simply isn't such a test. Secondly, all you have to do is AllocColor with *pPix (the 5th argument) set to 0. When it calls FindColor, FindColor will start looking at the 0th map entry and keep searching till it finds an empty one. That is going to be the next free one. Just keep making the same call to AllocColor and it should return successive pixels into which you load your ramping color values. Finally, if you think about it right, you'll see that that's how the qvCreateColormap code works. The monochrome colormap is static. And I call it twice and get back two different pixels. I know it seems a lot to ask, but please trace through the FindColor and see why it's giving up. I just can't believe it's because the class is static. /tdn