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 theSetOriginprocedure.
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
TheSetOriginprocedure changes the coordinates of the upper-left corner of the current graphics port's port rectangle to the values supplied by thehandvparameters. 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
SetOriginprocedure does not affect the screen; it does, however, affect where subsequent drawing inside the graphics port appears. TheSetOriginprocedure 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
SetOrigindoes not move the window's clipping region, use theGetClipprocedure 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 theClipRectprocedure to define a new clipping region--to avoid drawing over your scroll bars, for example. After calling your own window-drawing routine, use theSetClipprocedure to restore the original clipping region. You can then callSetOriginagain 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.
- 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
SetOriginto change the window origin, be sure to useSetOriginagain 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 useSetOriginwhen scrolling through a document in a window.