Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!hila.hut.fi!jmunkki From: jmunkki@hila.hut.fi (Juri Munkki) Newsgroups: comp.sys.mac.programmer Subject: Re: What's the screen depth? Summary: You can't really know, if all you want is 8 colors. Message-ID: <1991Mar29.153818.11510@santra.uucp> Date: 29 Mar 91 15:38:18 GMT References: <1991Mar28.110336.40826@eagle.wesleyan.edu> Sender: news@santra.uucp (Cnews - USENET news system) Reply-To: jmunkki@hila.hut.fi (Juri Munkki) Organization: Helsinki University of Technology, FINLAND Lines: 61 In article <1991Mar28.110336.40826@eagle.wesleyan.edu> rcook@eagle.wesleyan.edu writes: >Here's the deal: I have an old style window (ie not color, a standard >grafport) and I do some color drawing in it with standard QuickDraw colors >(by setting ForeColor and BackColor) This works fine on a machine in 16 color >mode or higher, but everything comes out black on a 2 or 4 color machine. This >is expected since standard QuickDraw isn't picky about how colors interact. > >Here's the problem: I know how to sense if a machine has Color QuickDraw, but >how do you detect the bit depth/color mode? I don't want to move to color >windows, because I want to keep only one set of drawing routines, thus not >keeping parallel sets for standard and color quickdraw. Someone else already gave a solution that uses GetGDevice. I'll just note that GetGDevice gets you only one device and it might very well not be the device that your window is using. Multiple screens getting very common in these days and it's usual to have a large B&W screen and a smaller color screen. What I usually do is that I put color windows on the smaller screen. Some programs look at the current graphics device, see that it is a B&W device and then refuse to draw in color. The recommended method is to walk through the graphics device list with calls to GetDeviceList and GetNextDevice. Find out if the device rectangle intersects with your window and act accordingly. There's another thing you should be aware of. Some Macs have color, but not color quickdraw. You can actually buy 16-color boards for the SE and they use the old color model for drawing. I wrote a Prestel terminal emulator. Prestel happens to require those same 8 colors that are in the classic Macintosh selection. This program has a check box that allows you to switch the colors on and off. This way the user can choose what looks best. One more way to get color with classic Macs is to print to an ImageWriter II or LQ. These printers support the old color model with a special ribbon. The results are quite pleasing. If you allow your user to copy a picture to the clipboard, it should be possible to have it in color or in B&W depending on what the user wants. >Please help me out on this one. At least I'm not asking about the sound >manager (yet... :-) Thanks. Oh, the sound manager? I read the new and improved IM-VI chapter on the sound manager and I was quite pleased. It is now much easier to understand and things seem to work the way they should. Stereo sound is finally possible and even easy to use. It looks like there are still some limitations with the sampled sound synthesizer (I had to experiment to get rid of a clicking sound). The funny thing is that my program didn't crash while I was experimenting with it, so I guess the new routines are much more robust than the old ones. The new sound manager uses slightly more CPU than the old sound driver, but it is much more flexible. Some of you might remember my flames about the sound manager, but now that it works, I find no reason for flaming. ____________________________________________________________________________ / Juri Munkki / Helsinki University of Technology / Wind / Project / / jmunkki@hut.fi / Computing Center Macintosh Support / Surf / STORM / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~