SA-MP Forums Archive
Adding Alpha value to hex color - 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: Adding Alpha value to hex color (/showthread.php?tid=448680)



Adding Alpha value to hex color - Mellnik - 05.07.2013

How do I make that 0x88CC44FF becomes for example 0x88CC4477?


Re: Adding Alpha value to hex color - Stylock - 05.07.2013

Pretty sure you need bitwise AND: &


Re: Adding Alpha value to hex color - Deathstalker - 05.07.2013

0xCC0000FF, the part being HEX. Woops, now that I tried it, the alpha/transparency does not work with it.


AW: Re: Adding Alpha value to hex color - Mellnik - 05.07.2013

Quote:
Originally Posted by Stylock
Посмотреть сообщение
Pretty sure you need bitwise AND: &
As far as I know bitwise AND is used for something else.


Re: Adding Alpha value to hex color - Deathstalker - 05.07.2013

This might help you.


Re: AW: Re: Adding Alpha value to hex color - Stylock - 05.07.2013

Quote:
Originally Posted by Mellnik
Посмотреть сообщение
As far as I know bitwise AND is used for something else.
Then you don't know far enough.

EDIT: ******, I think it's more difficult to understand how substraction works with hex than with normal numbers.


AW: Re: AW: Re: Adding Alpha value to hex color - Mellnik - 05.07.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
You want to make a number smaller? This is commonly known as "subtraction", and taught to school children when they are like 5!
Nice answer

Quote:
Originally Posted by Stylock
Посмотреть сообщение
Then you don't know far enough.
Sorry i thought they are used to compare something. Well how would you do it then?


Re: Adding Alpha value to hex color - Stylock - 05.07.2013

This returns alpha:
Код:
0x88CC4488 & 0x000000FF



Re: Adding Alpha value to hex color - Kar - 05.07.2013

I think you literally have to minus 8 from the number.. (F = 15 so 15 - 8 = 7)


Re: Adding Alpha value to hex color - Vince - 05.07.2013

0x88 to be precise, not 8 as a decimal.