Important: The information in this document is obsolete and should not be used for new development.
SetOriginTo change the coordinates of the window origin of the port rectangle of the current graphics port (basic or color), use the
PROCEDURE SetOrigin (h,v: Integer);
- The horizontal coordinate of the upper-left corner of the port rectangle.
- The vertical coordinate of the upper-left corner of the port rectangle.
SetOriginprocedure changes the coordinates of the upper-left corner of the current graphics port's port rectangle to the values supplied by the
vparameters. 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.
SetOriginprocedure does not affect the screen; it does, however, affect where subsequent drawing inside the graphics port appears. The
SetOriginprocedure 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).
SetOrigindoes not move the window's clipping region, use the
GetClipprocedure to store your clipping region immediately after your first call to
SetOrigin--if you use clipping regions in your windows. Before calling your own window-drawing routine, use the
ClipRectprocedure to define a new clipping region--to avoid drawing over your scroll bars, for example. After calling your own window-drawing routine, use the
SetClipprocedure to restore the original clipping region. You can then call
SetOriginagain 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
SetOriginprocedure is useful for readjusting the coordinate system after a scrolling operation.
- 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
SetOriginto change the window origin, be sure to use
SetOriginagain 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 of
SetOrigin, and Listing 2-5 on page 2-19 illustrates how to use
SetOriginwhen scrolling through a document in a window.