home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define BlockSize 10
- #define CorrectTime 3
-
- void Scissors(GrafPtr);
-
- /* A region in two parts, starting at the top of the left and right sides and
- moving down the sides and together towards the middle of the bottom side. */
-
- void Scissors(GrafPtr sourceGrafPtr)
- {
- RgnHandle curregion;
- Rect source,dest;
- int cx,gap,lastx,lasty;
-
- cx = MAIN_WINDOW_WIDTH / 2;
-
- curregion=NewRgn();
- source.top=source.left=0;
- source.bottom=MAIN_WINDOW_HEIGHT;
- source.right=MAIN_WINDOW_WIDTH;
-
- gap=BlockSize;
- lasty=0;
- do
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,0);
- OpenRgn();
- LineTo(MAIN_WINDOW_WIDTH,lasty); /* get the right half */
- LineTo(MAIN_WINDOW_WIDTH,gap);
- LineTo(cx,0);
- LineTo(0,lasty); /* get the left half */
- LineTo(0,gap);
- LineTo(cx,0);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lasty=gap;
- gap+=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap<MAIN_WINDOW_HEIGHT+BlockSize);
-
- lastx=MAIN_WINDOW_WIDTH;
- gap=MAIN_WINDOW_WIDTH-BlockSize;
- do
- {
- StartTiming();
- SetEmptyRgn(curregion);
- MoveTo(cx,0);
- OpenRgn();
- LineTo(lastx,MAIN_WINDOW_HEIGHT); /* get the right half on bottom side */
- LineTo(gap,MAIN_WINDOW_HEIGHT);
- LineTo(cx,0);
- LineTo(MAIN_WINDOW_WIDTH-lastx,MAIN_WINDOW_HEIGHT); /* left 1/2 on bottom */
- LineTo(MAIN_WINDOW_WIDTH-gap,MAIN_WINDOW_HEIGHT);
- LineTo(cx,0);
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
- lastx=gap;
- gap-=BlockSize;
- TimeCorrection(CorrectTime);
- }
- while (gap>MAIN_WINDOW_WIDTH/2);
-
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, 0L); /* if we missed any bits */
-
- DisposeRgn(curregion);
- }
-