[REP++] PROBLEM ! HEX TO ARGB
#5

Quote:
Originally Posted by buburuzu19
Посмотреть сообщение
Hello guys, i can't figure out how to convert hex to ARGB.
I need this for SetObjectMaterialText , the colors of the font must be 0xFFFFFFFF and i am getting them from my database as HEX like FF0000.
I tried to get them as ARGB from the mysql database (0xFFFFFFFF) but the text won't appear because i get them as string. (VARCHAR in the database)
Can someone help?
Thanks !
SA-MP has no ARGB pattern, but RGBA.
Here's a little piece of code that I wrote for You:
pawn Код:
stock addAlpha(&basecolor, amount)
    return (basecolor<<8)+amount;
Example:
pawn Код:
new hex = 0xFF0000;
    printf("Before: %x after: %x", hex, addAlpha(hex, 255));
Will print:
Код:
Before: FF0000 after: FF0000FF
Greetings.

-- Nevermind, didn't noticed that You are storing Your color as VARCHAR, my bad
Reply


Messages In This Thread
Solved. - by buburuzu19 - 13.08.2015, 14:33
AW: [REP++] PROBLEM ! HEX TO ARGB - by Kaliber - 13.08.2015, 14:37
Re: [REP++] PROBLEM ! HEX TO ARGB - by buburuzu19 - 13.08.2015, 14:40
Re: [REP++] PROBLEM ! HEX TO ARGB - by Vince - 13.08.2015, 14:53
Re: [REP++] PROBLEM ! HEX TO ARGB - by LetsOWN[PL] - 13.08.2015, 14:54
Re: [REP++] PROBLEM ! HEX TO ARGB - by buburuzu19 - 13.08.2015, 14:59
Re: [REP++] PROBLEM ! HEX TO ARGB - by ikkentim - 13.08.2015, 15:18
Re: [REP++] PROBLEM ! HEX TO ARGB - by buburuzu19 - 13.08.2015, 15:29
Re: [REP++] PROBLEM ! HEX TO ARGB - by buburuzu19 - 13.08.2015, 15:53
Re: [REP++] PROBLEM ! HEX TO ARGB - by Jefff - 13.08.2015, 16:01

Forum Jump:


Users browsing this thread: 3 Guest(s)