Important: The information in this document is obsolete and should not be used for new development.
SetOrigin
To change the coordinates of the window origin of the port rectangle of the current graphics port (basic or color), use theSetOrigin
procedure.
PROCEDURE SetOrigin (h,v: Integer);
h
- The horizontal coordinate of the upper-left corner of the port rectangle.
v
- The vertical coordinate of the upper-left corner of the port rectangle.
DESCRIPTION
TheSetOrigin
procedure changes the coordinates of the upper-left corner of the current graphics port's port rectangle to the values supplied by theh
andv
parameters. All other points in the current graphics port's local coordinate system are calculated from this point. All subsequent drawing and calculation routines use the new coordinate system.The
SetOrigin
procedure does not affect the screen; it does, however, affect where subsequent drawing inside the graphics port appears. TheSetOrigin
procedure does not offset the coordinates of the clipping region or the graphics pen, which therefore change position on the screen (unlike the boundary rectangle, port rectangle, and visible region, which don't change position onscreen).Because
SetOrigin
does not move the window's clipping region, use theGetClip
procedure to store your clipping region immediately after your first call toSetOrigin
--if you use clipping regions in your windows. Before calling your own window-drawing routine, use theClipRect
procedure to define a new clipping region--to avoid drawing over your scroll bars, for example. After calling your own window-drawing routine, use theSetClip
procedure to restore the original clipping region. You can then callSetOrigin
again to restore the window origin to a horizontal coordinate of 0 and a vertical coordinate of 0 with your original clipping region intact.All other routines in the Macintosh Toolbox and Operating System preserve the local coordinate system of the current graphics port. The
SetOrigin
procedure is useful for readjusting the coordinate system after a scrolling operation.
- Note
- The Window Manager and Control Manager always assume the window's upper-left point has a horizontal coordinate of 0 and a vertical coordinate of 0 when they draw in a window. Therefore, if you use
SetOrigin
to change the window origin, be sure to useSetOrigin
again to return the window origin to a horizontal coordinate of 0 and a vertical coordinate of 0 before using any Window Manager or Control Manager routines.SEE ALSO
"Scrolling the Pixels in the Port Rectangle" beginning on page 2-18 provides a general discussion of the use ofSetOrigin
, and Listing 2-5 on page 2-19 illustrates how to useSetOrigin
when scrolling through a document in a window.