16.07.2013, 20:53
(
Последний раз редактировалось HuSs3n; 16.07.2013 в 22:22.
)
Make a color darker\lighter
(Amount used is 0.3)
input Hello this is red
LighterHello this is red
Darker Hello this is red
input Hello this is blue
LighterHello this is blue
Darker Hello this is blue
input Hello this is green
LighterHello this is green
Darker Hello this is green
input Hello this is yellow
LighterHello this is yellow
Darker Hello this is yellow
pawn Код:
stock ColorLighten(colour,Float:Amount)
{
new a = colour & 0xFF;
new r=min(255, ((colour >> 24) & 0xFF)+ floatround(255 * Amount));
new g=min(255, ((colour >> 16) & 0xFF)+ floatround(255 * Amount));
new b=min(255, ((colour >> 8) & 0xFF)+ floatround(255 * Amount));
return (r<<24 | g<<16 | b<<8 | a);
}
stock ColorDarken(colour,Float:Amount)
{
new a = colour & 0xFF;
new r=max(0, ((colour >> 24) & 0xFF)- floatround(255 * Amount));
new g=max(0, ((colour >> 16) & 0xFF)- floatround(255 * Amount));
new b=max(0, ((colour >> 8) & 0xFF)- floatround(255 * Amount));
return (r<<24 | g<<16 | b<<8 | a);
}
input Hello this is red
LighterHello this is red
Darker Hello this is red
input Hello this is blue
LighterHello this is blue
Darker Hello this is blue
input Hello this is green
LighterHello this is green
Darker Hello this is green
input Hello this is yellow
LighterHello this is yellow
Darker Hello this is yellow