2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function InitMasks()
8 #include <graphics/gels.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
12 /*****************************************************************************
15 #include <proto/graphics.h>
17 AROS_LH1(void, InitMasks
,
20 AROS_LHA(struct VSprite
*, vs
, A0
),
23 struct GfxBase
*, GfxBase
, 21, Graphics
)
26 Creates the standard BorderLine and CollMask masks of the VSprite.
27 VSprites and Bobs are treated accordingly.
30 vs = pointer to VSprite structure
41 InitGels(), InitGMasks(), graphics/gels.h
47 *****************************************************************************/
51 LONG depth
, WordsPerPlane
, WordsPerLine
, count
;
52 /* is this a Bob or a VSprite? */
53 if (0 != (vs
-> Flags
& VSPRITE
))
55 /* assumption: vs -> Widtht = 16 (or 32 on a better chipset??)*/
56 WordsPerLine
= vs
-> Width
>> 4; /* Width:16 */
57 depth
= 2; /* standard */
61 WordsPerLine
= vs
-> Width
;
64 WordsPerPlane
= (vs
-> Height
) * WordsPerLine
;
67 /* create the standard collision mask by or'ing all bitplanes */
68 for (count
= 0; count
< WordsPerPlane
; count
++)
70 WORD
* PlaneData
= vs
-> ImageData
;
71 WORD Data
= PlaneData
[count
];
73 for (z
= 1; z
< depth
; z
++)
74 Data
|= PlaneData
[count
+ z
*WordsPerPlane
];
75 (vs
-> CollMask
)[count
] = Data
;
78 /* create the standard BorderLine from the collision mask by or'ing all
80 for (count
= 0 ; count
< WordsPerLine
; count
++)
82 WORD
* CollMask
= vs
-> CollMask
;
83 WORD Data
= CollMask
[count
];
85 for (z
= 1; z
< vs
-> Height
; z
++)
86 Data
|= CollMask
[count
+ z
*WordsPerLine
];
87 (vs
-> BorderLine
)[count
] = Data
;