Re: Bounding Rectangle [and data type Rect]
Re: Bounding Rectangle [and data type Rect]
- Subject: Re: Bounding Rectangle [and data type Rect]
- From: email@hidden
- Date: Sun, 28 Jul 2002 22:45:08 EDT
Bounding Rectangle - [Bounding] Rect/Inside Macintosh Series, volume 1, page
I-144:
A bit map in QuickDraw is a data structure that defines a
physical bit image in terms of the coordinate plane. A bit
map has three parts: a pointer to a bit image, the row
width of that image, and a boundary rectangle that give the
bit map both its dimensions and a coordinate system.
There can be several bit maps pinting to the same bit
image, each imposing a different coordinate system on it.
This important feature is explained in "Coordinates in
GrafPorts", below.
TYPE BitMap = RECORD
baseAddr: Ptr; (pointer to bit image)
rowBytes: INTEGER; (row width)
bounds: Rect (boundary rectangle)
END;
[snip]
===
Now to kill the tech jargon and clarify the Rect portion of
this into a simple concept:
If we're talking about a floating window, location 0,0 can
be anywhere in it (and we can have negative X or Y values),
but good form dictates that we consider the top left corner
pixel 0,0. If we're talking about the main screen, then
location 0,0 is the top, left-most addressable pixel of the
screen. Normally, the bounding_rect must encompass the
entire bitmap without any empty rows or columns of pixels.
Bounding Rectangle (X1,X2,Y1,Y2)
- where X1 is horizontal pixel count in short int (short
integer) from location 0,0 to beginning of bounding_rect;
- where X2 is horizontal pixel count in short int from
location 0,0 to end of bounding_rect;
- where Y1 is vertical pixel count in short int from location
0,0 to beginning of bounding_rect;
- where Y2 is vertical pixel count in short int from location
0,0 to end of bounding_rect.
Thus X2 - X1 = width in pixels of bounding rect,
AND Y2-Y1 = height in pixels of bounding rect,
AND (X2-X1) * (Y2 - Y1) = area in pixels of bounding_rect.
===
Now the even simpler answer:
The concept was that you could call the window manager
toolbox handler from a programming language and pass it the
four pixel location variables (plus a few others, such as
what to name the window and where to store the pointer to
this window 'object'), and poof, you have a referenced
'floating' window for output or for a dialog box, et
cetera, sans all the code to draw it from scratch (thanks
Mac Toolbox!). This is part of what made the Mac different
from DOS...
Hope that clarifies the concept. If not, I can try a yet simpler
explanation...
Best Wishes
=-= Marc Glasgow
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.