Re: A89: More questions...(maybe somebody will answer them this time...)
[Prev][Next][Index][Thread]
Re: A89: More questions...(maybe somebody will answer them this time...)
In a message dated 11/29/98 4:09:29 PM Pacific Standard Time,
senoramor@yahoo.com writes:
<< 1) What is 'masking'?>>
Masking is a process for displaying sprites with transparency. It's kinda
hard to explain, so I'll give you an example.
0,1,1,0 Here is the bit pattern for your sprite (a circle with white
inside)
1,0,0,1 Zeroes represent white and ones represent black
0,1,1,0
NOTE: white ain't the same as transparent
1,1,1,1 Here is the small patch of area that you are going to
1,1,1,1 draw your circle onto.
1,1,1,1
If you put your sprite there without masking, and consider all the zeroes to
be transparent, it will stay all black. If you put it there without masking
and don't consider the zeroes to be transparent, it will look like this:
0,1,1,0 It might looks nice, but it is a misrepresentation.
1,0,0,1 The corners should be black, not white, because they are
0,1,1,0 supposed to be transparent
To solve this, you must use a mask. Here is what the mask for this sprite
should be.
0,1,1,0 Just put zeroes where it should be transparent
1,1,1,1 and ones where it should be white or black.
0,1,1,0
if you XOR this to the background you get the following
1,0,0,1
0,0,0,0
1,0,0,1
Then just AND the sprite to it, and it becomes:
1,1,1,1
1,0,0,1
1,1,1,1
Here you can see it is properly done because the black background is preserved
in the corners, and the white interior of the circle is there too.
I've only done this in higher level languages, so don't ask me about
specifically doing this stuff for 68K ASM.