home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-01-14 | 9.0 KB | 362 lines | [TEXT/CWIE] |
- ///--------------------------------------------------------------------------------------
- // BlitPixie.h
- //
- // Description: This is the include file for all the BlitPixie source files.
- ///--------------------------------------------------------------------------------------
-
-
- #ifndef __BLITPIXIE__
- #define __BLITPIXIE__
-
- #ifndef __SWCOMMON__
- #include "SWCommonHeaders.h"
- #endif
-
- #ifndef __QUICKDRAW__
- #include <QuickDraw.h>
- #endif
-
- #ifndef __SPRITEFRAME__
- #include "SpriteFrame.h"
- #endif
-
- #ifndef __SPRITE__
- #include "Sprite.h"
- #endif
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
-
- ///--------------------------------------------------------------------------------------
- // type definitions & conditional macros
- ///--------------------------------------------------------------------------------------
-
-
- #if !SW_PPC
- #define START_32_BIT_MODE \
- { \
- SInt8 mmuMode; \
- if (gSWmmuMode != true32b) \
- { \
- mmuMode = true32b; \
- SwapMMUMode(&mmuMode); \
- }
- #define END_32_BIT_MODE \
- if (gSWmmuMode != true32b) \
- { \
- SwapMMUMode(&mmuMode); \
- } \
- }
- #else
- #define START_32_BIT_MODE // always 32-bit mode on PPC
- #define END_32_BIT_MODE
- #endif
-
-
- #define BP_CLIP_RECT(frameRect, srcRect, dstRect) \
- /* clip off the top so we don't write into random memory */ \
- if (dstRect.top < frameRect.top) { \
- srcRect.top += frameRect.top - dstRect.top; \
- dstRect.top = frameRect.top; \
- } \
- /* clip off the bottom */ \
- if (dstRect.bottom > frameRect.bottom) { \
- srcRect.bottom -= dstRect.bottom - frameRect.bottom; \
- dstRect.bottom = frameRect.bottom; \
- } \
- /* clip off the left */ \
- if (dstRect.left < frameRect.left) { \
- srcRect.left += frameRect.left - dstRect.left; \
- dstRect.left = frameRect.left; \
- } \
- /* clip off the right */ \
- if (dstRect.right > frameRect.right) { \
- srcRect.right -= dstRect.right - frameRect.right; \
- dstRect.right = frameRect.right; \
- } \
- /* Make sure height is valid */ \
- if (dstRect.bottom <= dstRect.top) \
- return; \
- /* Make sure width is valid */ \
- if (dstRect.right <= dstRect.left) \
- return;
-
-
- #define BP_CLIP_RECT_INTERLACED(frameRect, srcRect, dstRect) \
- /* clip off the top so we don't write into random memory */ \
- if (dstRect.top < frameRect.top) { \
- srcRect.top += frameRect.top - dstRect.top; \
- dstRect.top = frameRect.top; \
- } \
- /* clip off the bottom */ \
- if (dstRect.bottom > frameRect.bottom) { \
- srcRect.bottom -= dstRect.bottom - frameRect.bottom; \
- dstRect.bottom = frameRect.bottom; \
- } \
- /* clip off the left */ \
- if (dstRect.left < frameRect.left) { \
- srcRect.left += frameRect.left - dstRect.left; \
- dstRect.left = frameRect.left; \
- } \
- /* clip off the right */ \
- if (dstRect.right > frameRect.right) { \
- srcRect.right -= dstRect.right - frameRect.right; \
- dstRect.right = frameRect.right; \
- } \
- /* If first line is not on an even number, skip it. */ \
- if ((dstRect.top - frameRect.top) & 1) { \
- srcRect.top++; \
- dstRect.top++; \
- } \
- /* Make sure height is valid */ \
- if (dstRect.bottom <= dstRect.top) \
- return; \
- /* Make sure width is valid */ \
- if (dstRect.right <= dstRect.left) \
- return;
-
- typedef unsigned long PixelChunk, *PixelChunkPtr, **PixelChunkHdl;
-
- #define BytesToChunks(b) ((b) >> 2)
- #define ChunksToBytes(b) ((b) << 2)
-
-
- typedef unsigned long* PixelPtr;
-
- typedef struct StarArray
- {
- short horizLoc; // Current horizontal position of the star
- short vertLoc; // Current vertical position of the star
- short oldHorizLoc; // Horizontal position of star the previous frame
- short oldVertLoc; // Vertical position of star the previous frame
- short horizSpeed; // To be used by the user to move the star
- short vertSpeed; // To be used by the user to move the star
- unsigned short color; // Current color of the star
- Boolean needsToBeErased; // If drawn last frame, then it needs to be erased.
- short userData; // Reserved for user
- } StarArray;
-
-
- ///--------------------------------------------------------------------------------------
- // Function prototypes for DoubleRect blitters
- ///--------------------------------------------------------------------------------------
-
- SW_FUNC void BlitPixie8BitDoubleRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRectA,
- Rect* dstRectA,
- Rect* srcRectB,
- Rect* dstRectB);
-
- SW_FUNC void BP8BitInterlacedDoubleRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRectA,
- Rect* dstRectA,
- Rect* srcRectB,
- Rect* dstRectB);
-
- SW_FUNC void BlitPixie16BitDoubleRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRectA,
- Rect* dstRectA,
- Rect* srcRectB,
- Rect* dstRectB);
-
- SW_FUNC void BP16BitInterlacedDoubleRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRectA,
- Rect* dstRectA,
- Rect* srcRectB,
- Rect* dstRectB);
-
-
- ///--------------------------------------------------------------------------------------
- // Function prototypes for all-bit blitters
- ///--------------------------------------------------------------------------------------
-
- SW_FUNC void BlitPixieAllBitRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BPAllBitInterlacedRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- SW_FUNC void BlitPixieAllBitMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BlitPixieAllBitPartialMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BPAllBitInterlacedMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- SW_FUNC void BPAllBitInterlacedPartialMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- void BlitPixieAllBit(
- register PixelPtr srcPixelP,
- register PixelPtr dstPixelP,
- unsigned long rowsToCopy,
- unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride,
- register unsigned long srcExtraStart,
- register unsigned long dstExtraStart,
- register unsigned long dstExtraEnd);
-
- void BlitPixieAllBitMask(
- register PixelPtr srcPixelP,
- register PixelPtr dstPixelP,
- register PixelPtr maskPixelP,
- unsigned long rowsToCopy,
- unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride,
- register unsigned long srcExtraStart,
- register unsigned long dstExtraStart,
- register unsigned long dstExtraEnd);
-
- void BlitPixieAllBitPartialMask(
- register PixelPtr srcPixelP,
- register PixelPtr dstPixelP,
- register PixelPtr maskPixelP,
- unsigned long rowsToCopy,
- unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride,
- register unsigned long srcExtraStart,
- register unsigned long dstExtraStart,
- register unsigned long dstExtraEnd);
-
-
-
- ///--------------------------------------------------------------------------------------
- // Function prototypes for 8-bit blitters
- ///--------------------------------------------------------------------------------------
-
- SW_FUNC void BlitPixie8BitRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BP8BitInterlacedRectDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- SW_FUNC void BlitPixie8BitMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BlitPixie8BitPartialMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC void BP8BitInterlacedMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- SW_FUNC void BP8BitInterlacedPartialMaskDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect* srcRect,
- Rect* dstRect);
-
- SW_FUNC void CompiledSprite8BitDrawProc(
- FramePtr srcFrameP,
- FramePtr dstFrameP,
- Rect *srcRect,
- Rect *dstRect);
-
- SW_FUNC unsigned char BlitPixie8BitGetPixel(
- FramePtr srcFrameP,
- Point thePoint );
-
- SW_FUNC void BlitPixie8BitSetPixel(
- FramePtr srcFrameP,
- Point thePoint,
- unsigned char theColor);
-
- SW_FUNC void SWAnimate8BitStarField(
- SpriteWorldPtr spriteWorldP,
- StarArray *starArray,
- short numStars,
- unsigned short backColor);
-
- SW_FUNC void BlitPixie8BitFlipSprite(
- SpritePtr srcSpriteP );
-
- void BlitPixie8Bit(
- register PixelChunkPtr srcPixelP,
- register PixelChunkPtr dstPixelP,
- register unsigned long rowsToCopy,
- register unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride);
-
- void BlitPixieMask8Bit(
- register PixelPtr srcPixelP,
- register PixelPtr dstPixelP,
- register PixelPtr maskPixelP,
- register unsigned long rowsToCopy,
- register unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride);
-
- void BlitPixiePartialMask8Bit(
- register PixelPtr srcPixelP,
- register PixelPtr dstPixelP,
- register PixelPtr maskPixelP,
- register unsigned long rowsToCopy,
- register unsigned long numBytesPerRow,
- register unsigned long srcRowStride,
- register unsigned long dstRowStride);
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __BLITPIXIE__ */
-