Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!alchemy!markov From: markov@cs.ruu.nl (Mark Overmars) Newsgroups: comp.sys.sgi Subject: Re: Getting compor map colors. Keywords: getmcolor Message-ID: <1991Apr25.130848.25198@cs.ruu.nl> Date: 25 Apr 91 13:08:48 GMT References: <1991Apr22.153229.7358@cs.ruu.nl> <80085@bu.edu.bu.edu> Organization: Utrecht University, Dept. of Computer Science Lines: 34 In <80085@bu.edu.bu.edu> tjh@bucrf11.bu.edu (Tim Hall) writes: >In article <1991Apr22.153229.7358@cs.ruu.nl>, markov@cs.ruu.nl (Mark Overmars) writes: >|> I have the following problem. I want to draw colormap images inside a RGB >|> window. As a result I need to find out what the colors in the colormap are. To >|> this end I thought I should use the routine >|> >|> getmcolor() >|> >|> Unfortunately, this routine only work when you are in colormap mode, not when >|> you are in RGB mode. (Why?) > > current_window = winget(); /* Remember what the current window is */ > > noport(); /* Open a window that never appears */ > color_window = winopen( NULL); > > Read the color map here. > > winclose( color_window ); > > if ( current_window > 0 ) /* >= ???? I forget.... */ > winset( current_window ); The problem with this solution is that it is way too slow. Even keeping the color window open and doing a winset on it whenever I need a colormap entry slows the drawing of e.g. rectangles down by a factor of three (winset seems to be an expensive call), at least on a GTX. On a 25/TG there was almost no speed penalty (????). What I do now is to keep my own colormap and reading it in only once. Of course, in this way I don't see it when the application changes the colormap but it works fast. (Strangely enough, doing this on a 25/TG was faster than drawing normal in colormap mode.) Mark Overmars