Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!microsoft!johnte From: johnte@microsoft.UUCP (John Terranova) Newsgroups: comp.sys.mac.programmer Subject: When is an integer not an integer? Summary: why does Apple reserve 3 bits in rowbytes? Message-ID: <7740@microsoft.UUCP> Date: 18 Sep 89 20:30:41 GMT Reply-To: johnte@microsoft.UUCP (John Terranova) Distribution: na Organization: Microsoft Corp., Redmond WA Lines: 32 Greetings. I recently completed a project at school in which I needed to create offscreen pixel maps. The pixmaps were a full 8-bit deep and the dimensions were dependent on the input file. Since my bit map is 8 bits deep RowBytes = X dimension of the data file. I had no problems until I used a file which was 8900 across by 40 down (very short and fat). CopyBitsing to the window generated garbage. It turns out that RowBytes is not really an integer anymore. The top three bits are used by QuickDraw (or some part of the system) as flags. In my case of an offscreen color pix map the high three bits (15, 14, 13) need to be 110. When my data file wants RowBytes to be 8900 (i.e. >8191) bit 13 gets turned on and I get garbage on the screen. Apparently Apple doesn't think anybody will need bitmaps that are that wide. Unfortunately, they are wrong. My solution to the problem was to tell the scientists/grad students using the program to not use files that are that wide. (I was leaving that project and had no time to make any changes.) I realize that adding color to QuickDraw was a massive undertaking, but an int is an int, right? IM defines an int as 16 bits. In many cases (such as RowBytes) the sign bit is less than usefull, but the other bits should remain meaningful to the field they are in. I hope Apple thinks hard about this type of problem in new versions of their system and ROM code. --John Terranova - No longer a student, now a real person. I speak/type for myself and nobody else. "You look so good; you feel good, too. When they see you shake it, baby everybody's gonna pay attention to you and you and you." --Gerard, Shake It