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: Direct-to-screen drawing Message-ID: <1991Apr24.200807.8602@santra.uucp> Date: 24 Apr 91 20:08:07 GMT References: <91113.105146CXT105@psuvm.psu.edu> Sender: news@santra.uucp (Cnews - USENET news system) Reply-To: jmunkki@hila.hut.fi (Juri Munkki) Organization: Helsinki University of Technology, FINLAND Lines: 35 In article <91113.105146CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: > *(base + x + rowBytes*y) = 33; >If x, y, and rowBytes are declared long, it crashes. Every time. Anyone >have any ideas why? Or, alternatively, has anyone already worked out the >nitty-gritty of direct screen bit-twiddling to a color window? First of all, you're assuming an 8-bit screen. This is Ok, if you have checked that you really do have one, but be careful. rowBytes has some extra flag bits that you have to strip out. There are quite a few non-obvious things about drawing directly onto a color screen, so unless you are 100% sure that you want to do it, don't. Actually, Inside Mac V says that bit 15 is used and that bits 13 and 14 should always be 0. Develop I, page 9 says that 32 bit QD allows rowBytes to be up to $3FFE, so they have obviously made some changes. I used to mask off the top three bits, but now I only strip out the most significant bit. At least that's how I interpret the current documentation. Quiz question: Why is the limit $3FFE and not $3FFF. I know why, but if you can't figure it out in 3 seconds, you probably shouldn't be messing with direct screen writes. rmsism: [Actually, what I mean is that you shouldn't be writing commercial or widely distributed software without source distribution, because someone will then obviously stumble in a bug and not be able to fix it.] ____________________________________________________________________________ / Juri Munkki / Helsinki University of Technology / Wind / Project / / jmunkki@hut.fi / Computing Center Macintosh Support / Surf / STORM / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~