Board index » delphi » Getting a RGB-value from a TCOLOR

Getting a RGB-value from a TCOLOR

Hi!

How do I convert an "unnormal" color, e.g. clWindow or clBtnFace, to an
RGB-value?

(what I'm really interested in is the luminance value of the color, but I
have a formula for that if I get the RGB-values).

Any ideas?

Thx. in advance
Poul Dige

dontspamme.tabu...@tabulex.dk
(guess what to remove from adress)

 

Re:Getting a RGB-value from a TCOLOR


var
  R, G, B: Integer;
  Clr: TColor;
begin
  Clr := clBtnFace;
  R := GetRValue(Clr);
  G := GetGValue(Clr);
  B := GetBValue(Clr);

PD <dontspamme.tabu...@tabulex.dk> skrev i en
nyhedsmeddelelse:7nn4vl$1d7...@news.net.uni-c.dk...

Quote
> How do I convert an "unnormal" color, e.g. clWindow or clBtnFace, to an
> RGB-value?

> (what I'm really interested in is the luminance value of the color, but I
> have a formula for that if I get the RGB-values).

Re:Getting a RGB-value from a TCOLOR


Quote
Finn Tolderlund wrote:

> var
>   R, G, B: Integer;
>   Clr: TColor;
> begin
>   Clr := clBtnFace;
>   R := GetRValue(Clr);
>   G := GetGValue(Clr);
>   B := GetBValue(Clr);

Finn, that's wrong. You have to write

  Clr := ColorToRGB(clBtnFace);

- Robert

Re:Getting a RGB-value from a TCOLOR


On Wed, 28 Jul 1999 18:31:12 +0200, Robert Rossmair
<Robert.Rossm...@t-online.de> scribbled:

Quote
>Finn Tolderlund wrote:

>> var
>>   R, G, B: Integer;
>>   Clr: TColor;
>> begin
>>   Clr := clBtnFace;
>>   R := GetRValue(Clr);
>>   G := GetGValue(Clr);
>>   B := GetBValue(Clr);

>Finn, that's wrong. You have to write

>  Clr := ColorToRGB(clBtnFace);

>- Robert

And declare Clr as a Longint :

var
  R, G, B: Integer;
  Clr: Longint;
begin
  Clr := ColorToRGB(clBtnFace);
  R := GetRValue(Clr);
  G := GetGValue(Clr);
  B := GetBValue(Clr);
end;

Dave.

--
Dave Hughes (d...@waveform.free-online.co.uk)
"What do you want?"...
"Yes, but what do you REALLY want?"...
"And then what do you want?" - Morden, B5

Re:Getting a RGB-value from a TCOLOR


Quote
> var
>   R, G, B: Integer;
>   Clr: Longint;
> begin
>   Clr := ColorToRGB(clBtnFace);
>   R := GetRValue(Clr);
>   G := GetGValue(Clr);
>   B := GetBValue(Clr);
> end;

or since tcolor is an integer then you can
  b:=clr mod 256;
  g:=(clr div 256) mod 256;
  r:=(clr div (256*256) mod 256;

--
 Mark Zwicker
 Computer Programmer
 Adventus INC.
 m...@adventus.com

Other Threads