Hex Converter
#1

Hey,

I need to convert this hex code:
Код:
#RRGGBBAA
to:
Код:
0xAARRGGBBB
And please, do not give me these kind of functions:
Код:
stock HexToInt(string[]) // By DracoBlue
{
  	if (string[0]==0) return 0;
 	new i;
  	new cur=1;
  	new res=0;
  	for (i=strlen(string);i>0;i--) {
  	  	if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
    	cur=cur*16;
  	}
  	return res;
}

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

stock RGBA2ARGB(rgba)
{
    new src[4];
    for(new j = 0; j < 4; j++) src[j] = (!(24-(8*j)) ? rgba : (rgba >> (24-(8*j)))) & 0x000000FF;
    return (src[3] * 16777216) + (src[0] * 65536) + (src[1] * 256) + src[2];
}

stock RGBAToARGB( rgba )
    return rgba >>> 8 | rgba << 24;
I tried these all, never succeed converting it.

Thanks in advance, Ran
Reply


Messages In This Thread
Hex Converter - by ranme15 - 26.05.2015, 23:01
Re: Hex Converter - by Jefff - 26.05.2015, 23:23
Re: Hex Converter - by ranme15 - 26.05.2015, 23:40
Re: Hex Converter - by ranme15 - 28.05.2015, 19:06
Re: Hex Converter - by Vince - 28.05.2015, 19:42
Re: Hex Converter - by sammp - 28.05.2015, 19:42
Re: Hex Converter - by ranme15 - 28.05.2015, 19:45
Re: Hex Converter - by sammp - 28.05.2015, 19:55
Re: Hex Converter - by Jefff - 28.05.2015, 20:39

Forum Jump:


Users browsing this thread: 3 Guest(s)