20.06.2011, 12:25
ANY_COLOR & 0x000000FF will return the alpha part only. This ranges from 0 (00) to 255 (FF)
So you could use this to set the alpha to whatever you like:
NEW_COL = ANY_COLOR - (ANY_COLOR & 0x000000FF) + new_alpha;
Where alpha should not be bigger than 255.
There might be more efficient methods, but this was the first one that came up in my mind.
So you could use this to set the alpha to whatever you like:
NEW_COL = ANY_COLOR - (ANY_COLOR & 0x000000FF) + new_alpha;
Where alpha should not be bigger than 255.
There might be more efficient methods, but this was the first one that came up in my mind.

