Removing alpha from hex colors. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Removing alpha from hex colors. (
/showthread.php?tid=280575)
Removing alpha from hex colors. -
iggy1 - 01.09.2011
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.
Re: Removing alpha from hex colors. -
=WoR=Varth - 03.09.2011
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