home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-23 | 4.3 KB | 105 lines | [TEXT/CWIE] |
- {/--------------------------------------------------------------------------------------}
- { SpriteFrame.h}
- {}
- { Portions are copyright: © 1991-94 Tony Myles, All rights reserved worldwide.}
- {/--------------------------------------------------------------------------------------}
-
- unit SpriteFrame;
-
- interface
-
- uses
- {$IFC undefined THINK_Pascal}
- Types, Quickdraw,
- {$ENDC}
- QDOffscreen, SWCommonHeaders;
-
- {$PUSH}
- {$ALIGN MAC68K}
-
- {/--------------------------------------------------------------------------------------}
- { frame type definitions}
- {/--------------------------------------------------------------------------------------}
-
- type
- UInt32Array = array[0..0] of UInt32;
- UInt32ArrayPtr = ^UInt32Array;
- FrameRec = record
- framePort: GWorldPtr; { GWorld for the frame image}
- framePixHndl: PixMapHandle; { handle to pix map (saved for unlocking/locking)}
- framePix: PixMapPtr; { pointer color pix map (valid only while locked)}
-
- frameBaseAddr: Ptr; { base address of pixel data (valid only while locked)}
- frameRowBytes: LongInt; { number of bytes in a row of the frame}
- leftAlignFactor: Integer; { used to align the rect.left to the nearest long word }
- rightAlignFactor: Integer; { used to align the rect.right to the nearest long word}
- isFrameLocked: Boolean; { has the frame been locked?}
-
- frameRect: Rect; { source image rectangle}
- offsetPoint: Point; { image offset factor relative to destination rectangle}
- maskRgn: RgnHandle; { image masking region}
- tileMaskIsSolid: Boolean; { used by SWDrawTilesAboveSprite}
-
- maskPort: GWorldPtr; { GWorld for the mask image}
- maskPixHndl: PixMapHandle; { handle to pix map (saved for unlocking/locking)}
- maskPix: PixMapPtr; { pointer to color pix map (valid only while locked)}
-
- maskBaseAddr: Ptr; { base address of mask pixel data (valid only while locked)}
-
- sharesGWorld: Boolean; { shares GWorld with other frames}
-
- useCount: Integer; { number of sprites using this frame}
-
- numScanLines: Integer;
- worldRectOffset: Integer; { non-whole-byte offset for 1-bit blitter}
- scanLinePtrArray: UInt32ArrayPtr; { array of pointers to each scanline}
-
- pixCodeH: PixelCodeHdl; { handle to compiled sprite data}
- frameBlitterP: BlitFuncPtr; { procPtr to compiled sprite data}
- end;
- FramePtr = ^FrameRec;
- FrameHdl = ^FramePtr;
- FrameArray = array[0..0] of FramePtr;
- FrameArrayPtr = ^FrameArray;
-
- {/--------------------------------------------------------------------------------------}
- { frame flags constants}
- {/--------------------------------------------------------------------------------------}
-
- type
- MaskType = SignedByte;
- const
- kNoMask = 0;
- kPixelMask = 1;
- kRegionMask = 2;
- kFatMask = (kPixelMask + kRegionMask);
- kSolidMask = 4;
-
-
- function SWCreateWindowFrame (var newFrameP: FramePtr; var frameRect: Rect): OSErr;
- function SWCreateFrameFromCicnResource (destSpriteWorld: SpriteWorldPtr; var newFrameP: FramePtr; iconResID: Integer; maskKind: MaskType): OSErr;
- function SWCreateFrameFromPictResource (destSpriteWorld: SpriteWorldPtr; var newFrameP: FramePtr; pictResID: Integer; maskResID: Integer; maskKind: MaskType): OSErr;
- function SWCreateFrameFromGWorldAndRect (var newFrameP: FramePtr; pictGWorld: GWorldPtr; maskGWorld: GWorldPtr; var frameRect: Rect; maskKind: MaskType): OSErr;
-
- function SWCreateFrameFromGWorldAndRectStart (var tempMaskGWorld: GWorldPtr; maxWidth, maxHeight: integer ): OSErr;
- procedure SWCreateFrameFromGWorldAndRectFinish ( tempMaskGWorld: GWorldPtr );
- function SWCreateFrameFromGWorldAndRectPartial (var newFrameP: FramePtr; pictGWorld, maskGWorld, tempMaskGWorld: GWorldPtr; var frameRect: Rect; maskKind: MaskType): OSErr;
-
- function SWCreateFrame (theGDH: GDHandle; var newFrameP: FramePtr; var frameRect: Rect): OSErr;
- function SWCreateFrameFromDepth( var newFrameP: FramePtr; depth: integer; var frameRect: Rect): OSErr;
- function SWCloneFrame (cloneFrameP: FramePtr; var newFrameP: FramePtr): OSErr;
-
- procedure SWInitializeFrame (tempFrameP: FramePtr; depth: Integer);
- function SWDisposeFrame (oldFrameP: FramePtr): Boolean;
- procedure SWSetFrameMaskRgn (srcFrameP: FramePtr; maskRgn: RgnHandle);
- procedure SWLockFrame (srcFrameP: FramePtr);
- procedure SWUnlockFrame (srcFrameP: FramePtr);
-
- {$ALIGN RESET}
- {$POP}
-
- {$IFC not undefined THINK_Pascal}
- implementation
- {$ENDC}
- end.
-