Page 1 of 1

alphablend optimization?

PostPosted: Jul 31, 2005 @ 3:22pm
by jaguard
An idea crossed my mind - what if we create specific blit fuctions for several alphablends where it is possible to optimize it? Like display->Blit50() (equal to setblending(127)), display->Blit25() (setblending(63)) ?

This can be useful to draw big objects which you want to be transparent somehow, i.e. clouds.

And also, we can optimize PixelAlphaBlend to be less accurate but one multiplication less in a way that fast_rx done it in his alphablit fuction. I'm not entirely undestand every part of his code, so it's a little trouble to me..

What do you think? Any code snippets are highly appreciated ;).

PostPosted: Jul 31, 2005 @ 3:58pm
by Presto
Why not just do:

display->SetBlending(127);
display->Blit(x,y,pCloudImg);
display->SetDefaultShader();

Now, if it's a true alpha image, then the alpha layer will determine how much blending each pixel in the image gets. Using SetBlending would be optional to make it even more transparent than what the alpha layer says to.

Perhaps I don't understand what you're trying to do.

-John

PostPosted: Jul 31, 2005 @ 4:07pm
by jaguard

PostPosted: Jul 31, 2005 @ 5:05pm
by fast_rx