Impactnetworking


Borland C ++ Builder FAQ
The content The last update: 12/12/2008

Color (TColor) - the general questions

The author (): KAV, OlegGG, trainer
The initial link: - - -

How to receive TColor, having values of red, dark blue and green components?
int red = random (255);		//a red component 
int blue = random (255);		//a dark blue component 
int green = random (255);	//a green component 
Label1-> Font-> Color = (TColor) RGB (red, green, blue); 

How having TColor, to receive values of red, dark blue and green components?
TColor color =...; 
unsigned red = GetRValue (color);//a red component 
unsigned green = GetGValue (color);//a green component 
unsigned blue = GetBValue (color);//a dark blue component 

How to learn brightness of color?
TColor color =...; 
unsigned luminosity = (GetRValue (color) *77 + GetGValue (color) *151 + GetBValue (color) *28)>> 8;