- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Extracting RGB components of a color.

Question:

How do I extract the Red, Green, and Blue components of a given color?

Answer:

Use the Window API functions GetRValue(), GetGValue(), and
GetBValue().

Example:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form1.Canvas.Pen.Color := clRed;
  Memo1.Lines.Add('Red := ' +
                  IntToStr(GetRValue(Form1.Canvas.Pen.Color)));
  Memo1.Lines.Add('Red := ' +
                  IntToStr(GetGValue(Form1.Canvas.Pen.Color)));
  Memo1.Lines.Add('Blue := ' +
                  IntToStr(GetBValue(Form1.Canvas.Pen.Color)));
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile