[comp.sys.mac.programmer] When is an integer not an integer?

johnte@microsoft.UUCP (John Terranova) (09/19/89)

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

ftanaka@Apple.COM (Forrest Tanaka) (09/19/89)

In article <7740@microsoft.UUCP> johnte@microsoft.UUCP (John Terranova) writes:
*
  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.
*

    Starting with 32-Bit Quickdraw, Apple now only takes the top TWO bits
away from RowBytes.  Well, that's a LITTLE better.

                     Apple: Going that extra bit for you

-- 
*******************************************************************************
Forrest Tanaka                            AppleLink: TANAKA
Macintosh Developer Technical Support     UseNet:    ftanaka@Apple.COM
Apple Computer, Inc.