home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-29 | 1.3 KB | 52 lines | [TEXT/KAHL] |
- MkPort(GrafPort *newPort, Rect myRect)
- /* Create an off-screen port called newPort that is of size myRect */
- {
- QDPtr newSpace;
- int rwBytes;
-
- myRect.bottom = myRect.bottom - myRect.top; /* Set it to have size of */
- myRect.top = 0; /* myRect, but positioned at */
- myRect.right = myRect.right - myRect.left; /* top-left corner */
- myRect.left = 0;
-
- OpenPort(newPort);
- newPort->portRect = myRect;
- newPort->portBits.bounds = myRect;
- SetRectRgn(newPort->visRgn, 0, 0, myRect.right, myRect.bottom);
- SetRectRgn(newPort->clipRgn, 0, 0, myRect.right, myRect.bottom);
-
- rwBytes = ((myRect.right + 15) / 16) * 2;
- newSpace = NewPtr((long)rwBytes * myRect.bottom);
- if (MemErr)
- return;
-
- newPort->portBits.rowBytes = rwBytes;
- newPort->portBits.baseAddr = newSpace;
- SetPort(newPort);
- EraseRect(&(newPort->portRect));
- }
-
-
- GetWind(WindowPtr theWindow, GrafPort offPort)
- /* Copy bits from the off-screen port, into theWindow */
- {
- GrafPtr oldPort;
-
- GetPort(&oldPort); /* Save old port info */
- SetPort(theWindow); /* Set port to drawing window */
-
- CopyBits(&offPort.portBits, &theWindow->portBits,
- &theWindow->portRect, &theWindow->portRect,
- srcCopy, 0L);
-
- SetPort(oldPort); /* Restore old port info */
- }
-
-
- ClearOff(GrafPort offPort)
- /* Erase all of the off-screen port, offPort */
- {
- EraseRect(&(offPort.portBits.bounds));
- }
-
-