Hello, I have a code in c++ which calculate the alpha value for each pixel from a red screen background scene like that:
DWORD bits[1024x1024];
//some code here
for(int x=0;x<1024;x++)
for(int y=0;y<1024;y++)
{
DWORD a=255;
DWORD r = ((bits[1024*y+x]&0x00ff0000)>>16);
DWORD g = ((bits[1024*y+x]&0x0000ff00)>>8);
DWORD b = ((bits[1024*y+x]&0x000000ff)>>0);
if (r==255 && g==0 && b==0)
a=0;
bits[1024*y+x]=ARGB(a,r,g,b);
}
The problem with this code is than it doen't give smooth border, what I need is all red to be removed but smoothly, I mean a perfect red (255,0,0) will give a alpha of 0 a pink (255,0,200) willgive an alpha between 0 and 255.
I will preferably choose a coder who can give a assembly language code which I could add to my c++ code because I need the algorithm to be fast, but my priority is to have a working code even in c++, because all my tries gave either to much transparent or either red edges.
Thanks