home *** CD-ROM | disk | FTP | other *** search
- /*
- SFXProcs.h
-
- Special effects for Graphic Elements
-
- Copyright 1994 by Al Evans. All rights reserved.
-
- 6/9/94
-
- */
-
- #include "Rects.h"
- #include "SFXProcs.h"
-
- /*
- Special effects procs:
-
- There are two special cases for controller->currentStep.
-
- if (controller->currentStep == 0), the controller is being constructed, and the
- special effect procedure may allocate memory and do any setup it needs to do. It
- may store a pointer to its data in controller->sfxData.
-
- if (controller->currentStep == -1), the special effect is finished, and it should
- free any memory it has allocated.
- */
-
- pascal void SFXHWipe(SFXCtrlrPtr controller)
- {
- Rect destRect;
- CGrafPtr savePort;
- GDHandle gd;
- GrafElPtr element = (GrafElPtr) controller;
- short cpyWidth;
-
- switch(controller->currentStep) {
- case -1:
- break;
- case 0:
- break;
- default:
- GetGWorld(&savePort, &gd);
- SetGWorld(element->graphWorld, nil);
- destRect = element->graphRect;
- cpyWidth = RectWidth(&destRect) * controller->currentStep / controller->nSteps;
- if (controller->forward)
- destRect.right = destRect.left + cpyWidth;
- else
- destRect.left = destRect.right - cpyWidth;
- CopyBits(&((GrafPtr) controller->sfxSrc)->portBits,
- &((GrafPtr) element->graphWorld)->portBits,
- &destRect, &destRect, srcCopy, nil);
- SetGWorld(savePort, gd);
-
-
- break;
- }
- }
-
- pascal void SFXVWipe(SFXCtrlrPtr controller)
- {
- Rect destRect;
- CGrafPtr savePort;
- GDHandle gd;
- GrafElPtr element = (GrafElPtr) controller;
- short cpyHeight;
-
- switch(controller->currentStep) {
- case -1:
- break;
- case 0:
- break;
- default:
- GetGWorld(&savePort, &gd);
- SetGWorld(element->graphWorld, nil);
- destRect = element->graphRect;
- cpyHeight = RectHeight(&destRect) * controller->currentStep / controller->nSteps;
- if (controller->forward)
- destRect.bottom = destRect.top + cpyHeight;
- else
- destRect.top = destRect.bottom - cpyHeight;
- CopyBits(&((GrafPtr) controller->sfxSrc)->portBits,
- &((GrafPtr) element->graphWorld)->portBits,
- &destRect, &destRect, srcCopy, nil);
- SetGWorld(savePort, gd);
-
-
- break;
- }
- }
-
- pascal void SFXBlink(SFXCtrlrPtr controller)
- {
- GWorldPtr tmpGWorld;
-
- switch(controller->currentStep) {
- case -1:
- break;
- case 0:
- break;
- default:
- //Total number of switches must be even
- if ((controller->currentStep == controller->nSteps) && (controller->nSteps & 1))
- return;
- tmpGWorld = controller->sfxSrc;
- controller->sfxSrc = ((GrafElPtr) controller)->graphWorld;
- ((GrafElPtr) controller)->graphWorld = tmpGWorld;
- break;
- }
- }
-