PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

alphablend optimization?

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 ;).
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
Presto wrote:Why not just do:

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


It's too slow. What I'm trying is to speed it up.
John, are you suggesting to add something to SetDefaultShader? What?

The SetBlending could check to see if it's a multiple of 2 and use bit shifts and masking, but how it should be implented is another thing. I'm open to suggestions.