[comp.sys.mac.programmer] A lesson in Incremental Design

kaufman@polya.Stanford.EDU (Marc T. Kaufman) (06/17/88)

In the beginning, there was QuickDraw, and the world.  The world was, of course,
a rectangular grid (-32000, -32000, 32000, 32000). [Why, I wonder, can't you
go all the way to (-32768, -32768, 32767, 32767)... but I digress].

The map is not the territory.  The territory is a BitMap, with a magic INTEGER
named RowBytes, so that the rows of the world can always be a multiple of 16
bits.  That makes sense... after all, one only needs 8000 bytes to represent
one row, and an INTEGER can hold numbers up to 32767 (or 65535, if unsigned).

However, in the fullness of time, came new Gods... including the God of Color,
and the God of Upward Compatibility.  The God of Color demanded more than a
single bit at each point in the world (only 8, only 8, who would ever need more
than 8!).  But the God of Upward Compatibility said: "you must find a way to
distinguish your world from the former world... find me a hacker!  dredge up
a few free bits!"  The hacker was duly summoned, and cast his eye about.  "Look
there!", he said, "there is a whole INTEGER being used to hold RowBytes, and
only 13 bits are being used.  There are your bits!"

So the sages decreed:  Let it be set down in the book, V-53, that the 3 high
order bits of RowBytes will be used to separate the worlds, and so it came
to pass.

Then came a user who wanted to create a LARGE pixmap (for so the new world was
called).  "I have 5 Megs", he bragged (since he was lucky enough to have ordered
ram before last December).  "I will create an image with 8192 pixels in each
row."

"Oh, no you won't," said the Gods.  The proof is left as an exercise for the
reader.

"Well, at least when we get 24-bit QuickDraw, I can use chunky-planar imaging,
so things can't possibly get any worse."

-----
Marc Kaufman (kaufman@polya.stanford.edu)

lsr@Apple.COM (Larry Rosenstein) (06/24/88)

In article <3067@polya.Stanford.EDU> kaufman@polya.Stanford.EDU (Marc T. Kaufman) writes:

>Then came a user who wanted to create a LARGE pixmap (for so the new world
>was called).  "I have 5 Megs", he bragged (since he was lucky enough to
>have ordered ram before last December).  "I will create an image with 8192
>pixels in each row."
>
>"Oh, no you won't," said the Gods.  The proof is left as an exercise for the
>reader.

This is only true in the current implementation.  You will note that the
PixMap data structure has a version field.  Some future version of Color
Quickdraw can define a new version of PixMap can define a different
interpretation for rowBytes and store a 32-bit version of rowBytes somewhere
else.

-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 27-AJ  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr