whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

41 Visitors Online


 
...get the grayscale from a RGB color?
Autor: H.Kniebusch@gmx.de
Homepage: http://www.the-admin.de.vu
[ Print tip ]  

Tip Rating (3):  
     


{
  The following function helps you to convert a RGB Color to Grayscale.
  It works after the american NTSC (National Televisision Standards Committee)
  system.
}

{
  Mit Hilfe des folgenden Codes lässt sich die Graustufe einer
  beliebigen RGB Farbe herausfinden. Das System arbeitet nach dem
  vom amerikanischem NTSC (National Televisision Standards Committee)
  vorgelschlagenem System.
  Es kann unteranderem dazu verwendet werden ein Bild in Graustufen
  darzustellen. (siehe dazu Tipp http://www.swissdelphicenter.ch/de/showcode.php?id=437)
}


function GetGreyScale(red, blue, green: TColor): TColor;
var 
  
Color: Integer;
begin
  
Color := Round(red * 0.56 + green * 0.33 + blue * 0.11);
  Result := RGB(Color, Color, Color);
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners