[comp.sys.apple] Quickdraw

STEIN@UCONNVM.BITNET (04/13/88)

I've started playing around with assembly language using the
GS Toolbox and am having some difficulty deciphering some
facts about Quickdraw's coordinate system from the
documentation I am using -- Michael Fischer's Apple IIGS
Technical Reference and Gary Little's Exploring the Apple
IIGS.  I think I have the concepts down, but the definitions
of various rectangles in those books seem to me to be
ambiguous and perhaps even contradictory.

The following is the state of my understanding.  I would
appreciate corrections and enlightenment.

There is a global coordinate system and a local coordinate
system.  Both are calibrated in pixels.  The global
coordinate system (I think) is tied to the hardware, with
the origin [0,0] representing the upper left hand corner of
the screen.  The lower right hand corner would usually be
[200,640] (with the vertical coord first, horizontal
second).

The local coordinate system seems to be an imaginary
coordinate system based on a theoretical underlying document
size supplied by the user.  The underlying document is
conceptualized as a rectangle.

When a window is defined, it is placed at a given location
on the screen (based on the upper left hand corner) at a
given size.  It can be placed there, and sized, via the
global coordinate system.

The content in the window shown on the screen is corresponds
to a rectangular portion of the underlying document.  The
size and placement of that portion, relative to the
underlying document, is indicated by the scroll bars.

I am virtually certain that the above description is
correct.  My major uncertainty deals with the terminology
used in the references I have, particularly BoundsRect and
PortRect.

PortRect seems to refer to the local coordinates of the
vertices of the window.  But I'm uncertain what BoundsRect
refers to.  Also, clearly there must be terminology
referring to the size of the display screen (or desktop?)
and the placement, in global coordinates, of the window on
the desktop.  These initial coordinates are passed to the
window manager when a window is defined, but the coordinates
(global) change when the window is resized or moved, and I
haven't recognized a reference to them.


ARPA:   stein%uconnvm.bitnet@mitvma.mit.edu        Alan H. Stein
BITNET: STEIN@UCONNVM                          University of Connecticut
UUCP:   ...ihnp4!psuvax1!UCONNVM.BITNET!STEIN        at Waterbury
CompuServe: 71545,1500  Genie:  ah.stein       Department of Mathematics

LMB7421@RITVAX.BITNET (04/14/88)

>From:         STEIN%UCONNVM.BITNET@MITVMA.MIT.EDU
>Subject:      Quickdraw
>
>The following is the state of my understanding.  I would
>appreciate corrections and enlightenment.
>
>There is a global coordinate system and a local coordinate
>system.  Both are calibrated in pixels.  The global
>coordinate system (I think) is tied to the hardware, with
>the origin [0,0] representing the upper left hand corner of
>the screen.  The lower right hand corner would usually be
>[200,640] (with the vertical coord first, horizontal
>second).

Actually, nothing is tied to the hardware...the default port is placed
at the memory location which is screen memory, but that isn't to say that
I couldn't make a global co-ordinate system somewhere else...
The Global co-ordinate system is a reference...a large area which spans
from -16384 to +16383 in each direction.  There can be more than one
global coordinate system.

>The local coordinate system seems to be an imaginary
>coordinate system based on a theoretical underlying document
>size supplied by the user.  The underlying document is
>conceptualized as a rectangle.

The local co-ordinate system is as you say...a local system set relative
to any point you choose...Say I set up a global co-ordinate system with
origin [0,0] at the top corner of the screen.  The default local system
is also there.  However, I can set up a local co-ordinate system with
origin [0,0] in the middle of the screen (global co-ordinates [320,200])
and from then on I would access everything as if things to the left and top
of the middle of the screen were negative.

>When a window is defined, it is placed at a given location
>on the screen (based on the upper left hand corner) at a
>given size.  It can be placed there, and sized, via the
>global coordinate system.

Correct.  A window uses a local co-ordinate system within itself and is
placed within a global co-ordinate system (I think you can make another
local co-ordinate system a global one, but I'm not sure right off how it's
done)

>The content in the window shown on the screen is corresponds
>to a rectangular portion of the underlying document.  The
>size and placement of that portion, relative to the
>underlying document, is indicated by the scroll bars.

Right.

>PortRect seems to refer to the local coordinates of the
>vertices of the window.  But I'm uncertain what BoundsRect
>refers to.  Also, clearly there must be terminology
>referring to the size of the display screen (or desktop?)
>and the placement, in global coordinates, of the window on
>the desktop.  These initial coordinates are passed to the
>window manager when a window is defined, but the coordinates
>(global) change when the window is resized or moved, and I
>haven't recognized a reference to them.

ProtRect, If my memory serves me, is the absolute boundary of the port
(window).  BoundsRect is the boundary for the drawing region.
ClipRgn is the clipped region within the boundary rectangle. (why so
complex...well, I suppose it makes masking a *** of a lot easier...)

>ARPA:   stein%uconnvm.bitnet@mitvma.mit.edu        Alan H. Stein
>BITNET: STEIN@UCONNVM                          University of Connecticut
>UUCP:   ...ihnp4!psuvax1!UCONNVM.BITNET!STEIN        at Waterbury
>CompuServe: 71545,1500  Genie:  ah.stein       Department of Mathematics

Phoenix
LMB7421@RITVAX.BITNET
..rutgers!rochester!ritcv!ultb!lmb7421.UUCP
..rutgers!rochester!kodak!gizzmo!lazlo!loki!phoenix.UUCP (last resort)

"The opinions expressed above are, alas, not my own.  I was too tired when
 I wrote them to call them my own.  My subconsience must have dragged them
 in from some remote and fantastic world where 'look-and-feel' don't mean a
 thing."

wombat@nuchat.UUCP (Scott Lindsey) (04/15/88)

From article <8804122040.aa11841@SMOKE.BRL.ARPA>, by STEIN@UCONNVM.BITNET:
> 
> I've started playing around with assembly language using the
> GS Toolbox and am having some difficulty deciphering some
> facts about Quickdraw's coordinate system from the
> documentation I am using -- Michael Fischer's Apple IIGS
> Technical Reference and Gary Little's Exploring the Apple
> IIGS.  

In my opinion, the technical references published by Apple through
Addison-Wesley are far superior. (And they're finally available in bookstores)
They are still not without errors and just plain wrong information, but
they are much more current than Fischer's reference, which is based on
drafts of Apple's documentation.

	[various discussion on coordinates and rect's]

In a nutshell, the boundsRect defines the size of the document, or pixel
image.  The portRect defines the port (possibly a window) looking in on
the document.  If the two are equal, then the document fits in the port.
If not, you see a portion of the document in the port.  If the port is a
window with scrollbars, then the scrollbars reflect the ratio of the
portRect to the boundsRect (by the size of the thumbs) and the location of
the portRect on the boundsRect (by the location of the thumbs).
	The Apple IIGS Toolbox Reference Volume 2 offers a much more in
depth discussion.  One comment I think that should be made is the
documentation of the tool calls LineTo and MoveTo.  I have yet to see it
documented correctly.  These take LOCAL coordinates, not global as the
manual claims.  If that was the case, local coordinate systems would be
of far less use, and bloody near impossible to use.


-- 
 Scott Lindsey      uunet!nuchat!wombat  | These are my opinions.
 StyleWare, Inc.                         | No one else claims responsibility
 5250 Gulfton 2E                         | for them.  If you agree with them,
 Houston, TX 77081                       | then you're as sick as I am.