home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / SpriteFight 2002 v2.0a1 / Frame.h < prev    next >
Encoding:
Text File  |  1994-04-25  |  4.2 KB  |  135 lines  |  [TEXT/KAHL]

  1. ///--------------------------------------------------------------------------------------
  2. //    Frame.h
  3. //
  4. //    Created:    Wednesday, October 28, 1992 at 8:39:10 PM
  5. //    By:        Tony Myles
  6. //
  7. //    Copyright: © 1991-94 Tony Myles, All rights reserved worldwide
  8. //
  9. //    Description:    constants, structures, and prototypes for frames
  10. ///--------------------------------------------------------------------------------------
  11.  
  12.  
  13. #ifndef __FRAME__
  14. #define __FRAME__
  15.  
  16. #ifndef __SWCOMMON__
  17. #include "SWCommonHeaders.h"
  18. #endif
  19.  
  20. #ifndef __QDOFFSCREEN__
  21. #include <QDOffscreen.h>
  22. #endif
  23.  
  24. #ifndef __SPRITECOMPILER__
  25. #include "SpriteCompiler.h"
  26. #endif
  27.  
  28.  
  29. ///--------------------------------------------------------------------------------------
  30. //    frame type definitions
  31. ///--------------------------------------------------------------------------------------
  32.  
  33. typedef struct FrameRec FrameRec;
  34. typedef FrameRec *FramePtr, **FrameHdl;
  35.  
  36.  
  37. ///--------------------------------------------------------------------------------------
  38. //    frame data structure
  39. ///--------------------------------------------------------------------------------------
  40.  
  41. struct FrameRec
  42. {
  43.     union
  44.     {
  45.         CGrafPtr colorGrafP;            // color port for the frame image
  46.         GrafPtr monoGrafP;            // mono port for the frame image
  47.     } framePort;
  48.  
  49.     union
  50.     {
  51.         PixMapPtr pixMapP;            // pointer color pix map (valid only while locked)
  52.         BitMapPtr bitMapP;            // pointer mono bit map (valid only while locked)
  53.     } framePix;
  54.  
  55.     char* frameBaseAddr;                // base address of pixel data (valid only while locked)
  56.     unsigned long frameRowBytes;    // number of bytes in a row of the frame
  57.     unsigned long frameRowLongs;    // number of long words in a row of the frame
  58.     short leftAlignFactor;            // used to align the rect.left to the nearest long word 
  59.     short rightAlignFactor;            // used to align the rect.right to the nearest long word
  60.     Boolean isFrameLocked;            // has the frame been locked?
  61.     Boolean isColor;                    // is this a color frame?
  62.  
  63.     Rect frameRect;                    // source image rectangle
  64.     Point offsetPoint;                // image offset factor relative to destination rectangle
  65.     RgnHandle maskRgn;                // image masking region
  66.  
  67.     union
  68.     {
  69.         CGrafPtr colorGrafP;            // color port for the mask image
  70.         GrafPtr monoGrafP;            // mono port for the mask image
  71.     } maskPort;
  72.  
  73.     union
  74.     {
  75.         PixMapPtr pixMapP;            // pointer to color pix map (valid only while locked)
  76.         BitMapPtr bitMapP;            // pointer to mono bit map (valid only while locked)
  77.     } maskPix;
  78.  
  79.     char* maskBaseAddr;                // base address of mask pixel data (valid only while locked)
  80.     Boolean isMaskLocked;            // has the mask been locked?
  81.  
  82.     unsigned short useCount;        // number of sprites using this frame
  83.  
  84.     unsigned short numScanLines;
  85.     unsigned long* scanLinePtrArray;
  86.  
  87.     PixelCodeHdl pixCodeH;
  88.     BlitFuncPtr frameBlitterP;
  89. };
  90.  
  91.  
  92. ///--------------------------------------------------------------------------------------
  93. //    frame flags constants
  94. ///--------------------------------------------------------------------------------------
  95.  
  96. typedef enum
  97. {
  98.     kNoMask = 0,
  99.     kPixelMask = 1,
  100.     kRegionMask = 2,
  101.     kCompiledMask = 4,
  102.     kFatMask = (kPixelMask + kRegionMask),
  103.     kCompiledFatMask = (kPixelMask + kRegionMask + kCompiledMask)
  104. } MaskType;
  105.  
  106.  
  107. ///--------------------------------------------------------------------------------------
  108. //    frame function prototypes
  109. ///--------------------------------------------------------------------------------------
  110.  
  111. #ifdef __cplusplus
  112. extern "C" {
  113. #endif
  114.  
  115. SW_FUNC OSErr SWCreateFrame(FramePtr* newFrameP, CGrafPtr srcGrafP, Rect* frameRect);
  116. SW_FUNC OSErr SWCreateFrameFromCIconResource(FramePtr* newFrameP, short iconResID, MaskType maskType);
  117. SW_FUNC OSErr SWCreateFrameFromPictResource(FramePtr* newFrameP, short pictResID, short maskResID, MaskType maskType);
  118. SW_FUNC void SWDisposeFrame(FramePtr oldFrameP);
  119.  
  120. SW_FUNC void SWSetFrameGWorld(FramePtr srcFrameP, GWorldPtr frameGWorldP);
  121. SW_FUNC void SWSetFrameMaskRgn(FramePtr srcFrameP, RgnHandle maskRgn);
  122. SW_FUNC void SWSetFrameMaskGWorld(FramePtr srcFrameP, GWorldPtr maskGWorldP);
  123. SW_FUNC RgnHandle SWGetFrameMaskRgn(FramePtr srcFrameP);
  124. SW_FUNC void SWSetFrameRect(FramePtr srcFrameP, Rect* newFrameRect);
  125.  
  126. SW_FUNC void SWLockFrame(FramePtr srcFrameP);
  127. SW_FUNC void SWUnlockFrame(FramePtr srcFrameP);
  128.  
  129. SW_FUNC void SWCopyFrame(FramePtr srcFrameP, FramePtr dstFrameP);
  130.  
  131. #ifdef __cplusplus
  132. };
  133. #endif
  134.  
  135. #endif    /* __FRAME__ */