Removing alpha from hex colors.
#1

Hello, I'm a bit stumped. Is there a function or easy way to remove alpha from an opaque color? I have a ganzone system and i think it looks very ugly on the map when a ganzone is an opaque color. So i need to do a calculation to remove alpha from the gangs color, and set the gangzone color based on that.

I'll give you an example of what i mean.
pawn Код:
//Is there a way to turn this;
0xFF6600FF
//To this;
0xFF660044
This is probably simple for someone who is good with hex numbers (unlike me).

Thanks in advance.
Reply
#2

pawn Код:
stock RGBAToHex(r, g, b, a) //By Betamaster
{
    return (r<<24 | g<<16 | b<<8 | a);
}

stock HexToRGBA(colour, &r, &g, &b, &a) //By Betamaster
{
    r = (colour >> 24) & 0xFF;
    g = (colour >> 16) & 0xFF;
    b = (colour >> 8) & 0xFF;
    a = colour & 0xFF;
}
??

Or maybe ****** topic can help you.
https://sampforum.blast.hk/showthread.php?tid=200876
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)