• Welcome to Dark Bit Factory & Gravity.
 

fairly quick alpha thingy

Started by Stonemonkey, June 17, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Stonemonkey

Here's a little #define alpha thing, give it a source and destination and it takes the alpha component ot the source to blend with the destination value



#define alpha(s,d) ((((s and &hff00ff)*(s shr 24)+(d and &hff00ff)*(256-(s shr 24)))and &hff00ff00)or(((s and &hff00)*(s shr 24)+(d and &hff00)*(256-(s shr 24)))and &hff0000))shr 8





'if an array is used for the screen
screen(pixel)=alpha(argb_source,screen(pixel))

'or if using pointers
*pixel_pointer=alpha(argb_source,*pixel_pointer)

'or can just be used on individual variables
argb_out=alpha(argb0_in,argb1_in)



Shockwave

Nice one Fryer :) Thanks.
Shockwave ^ Codigos
Challenge Trophies Won:

Stonemonkey

No problem Shockwave, I think it should be pretty quick. Let me know if it's any use or if there's any problems or if there's any other types of blending you can think of.