Hello,
I'm trying to write a cheap 'n' cheerful 24-bit alpha blending algorithm. I've so far got:-
This doesn't seem to give 100% of the desired effect unfortunately, as bright colours appear with increasing alpha. It's also worth noting that I'm testing this by using empty (Black) source data against a destination image (To fade the image). Might black blending be a special case?Code:(iAlpha is alpha level, 0 to 255) (lpSrc is an unsigned char pointer to source data) (Guess what lpDest is) int i; unsigned long ulColour; ("For each pixel:") for (i=0;i<3;i++) { ulColour = iAlpha * ((*(lpSrc++) - *lpDest) >> 8) + *lpDest; *(lpDest++) = (unsigned char)ulColour; }