open.mp forum
[Library] RGB - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31)
---- Thread: [Library] RGB (/showthread.php?tid=1902)



RGB - AbyssMorgan - 2021-04-18

Include contain functions for color conversion



Code:
RGB.inc

Copyright ? 2021 Abyss Morgan. All rights reserved.



Website: https://adm.ct8.pl



Plugins: None

Modules: None



File Version: 2.5.0



Functions:

RGB::RGBAToHex(color,&red,&green,&blue,&alpha);

RGB::RGBToHex(color,&red,&green,&blue);

RGB::HexToRGBA(red,green,blue,alpha);

RGB::HexToARGB(red,green,blue,alpha);

RGB::HexToRGB(red,green,blue);

RGB::RGBAToRGB(color);

RGB::RGBToRGBA(color,alpha);

RGB::RGBToARGB(color,alpha);

RGB::ARGBToRGB(color);

RGB::RGBAToARGB(color);

RGB::ARGBToRGBA(color);

RGB::GetRFromRGBA(color);? ? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF R:0xFA000000

RGB::GetGFromRGBA(color);? ? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF G:0x00B00000

RGB::GetBFromRGBA(color);? ? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF B:0x0000A000

RGB::GetAFromRGBA(color);? ? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF A:0x000000FF

RGB::GetRHexFromRGBA(color);? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF R:0xFA

RGB::GetGHexFromRGBA(color);? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF G:0xB0

RGB::GetBHexFromRGBA(color);? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF B:0xA0

RGB::GetAHexFromRGBA(color);? ? ? ? ? ? ? ? ? ? //RGBA:0xFAB0A0FF A:0xFF

RGB::GetColorRGBA(color);? ? ? ? ? ? ? ? ? ? ? //Return {RGB}

RGB::GetColorRGB(color);? ? ? ? ? ? ? ? ? ? ? ? //Return {RGB}

RGB::GetColorARGB(color);? ? ? ? ? ? ? ? ? ? ? //Return {RGB}

RGB::AdjustColorLuminance(color,Float:adjust);



Download:

RGB.inc



Example 1:

Code:
new col = RGB::RGBAToARGB(0xFF6600FF); //return 0xFFFF6600;



Example 2:

Code:
new red, green, blue, alpha;

RGB::RGBAToHex(0xFF6600AA,red,green,blue,alpha); //return red = 0xFF; green = 0x66; blue = 0x00; alpha = 0xAA;



Example 3:

Code:
new r = RGB::GetRHexFromRGBA(0xFF6600AA); //return 0xFF;



Example 4:

Code:
new r = RGB::GetRFromRGBA(0xFF6600AA); //return 0xFF000000;