Advertisement

Alpha Blending

Started by August 09, 2000 07:24 PM
0 comments, last by headache 24 years, 4 months ago
I was reading the areicle at http://www.gamedev.net/reference/articles/article817.asp on MMX alpha blending but er I''m really confused, there is a line in his seccond attempt that I just don''t get. Result = ( (sTemp & 0xF7DE) >> 1) + ( (dTemp & 0xF7DE) >> 1); how does that make a 50/50 pixel ? anyone got any ideas?
Basically what it's doing is dividing each color element by 2, to produce half the amount of each color.

Here's what I mean:

0xF7DE is the mask for the low bit of each color in 565 mode. It's different for 555 mode; Here's a pure white pixel in 565 mode:

1111111111111111 (RGB 32,64,32)

When you mask off the low bits by doing:

1111111111111111 & 0xF7DE, you get:

1111011111011110

Then, when you shift it by 2 you get

0111101111101111 (RGB 16,32,16)

Effectively dividing each color value by 2, without any interference from the other color values.

Then you add them in order to combine the 50% values of each of the pixels. This puts together one pixel with those two values combined.

I hope this was clear enough.

Edited by - Qoy on August 10, 2000 2:27:55 AM

This topic is closed to new replies.

Advertisement