ColorToRGB

From SCAR Divi Manual
Revision as of 18:39, 3 July 2011 by Freddy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

procedure ColorToRGB(Color: Integer; var R, G, B: Integer);

Source Code

procedure ColorToRGB(Color: Integer; var R, G, B: Integer);
begin
  R := Color and $FF;
  G := (Color shr 8) and $FF;
  B := (Color shr 16) and $FF;
end;

Availability

SCAR Divi 3.00 > Current

Description

Converts a given color value Color to RGB values and returns them in R, G and B. The components can be joined back together into a color value using RGBToColor.

Example

var
  r, g, b: Integer;

begin
  ColorToRGB(123456, r, g, b);
  WriteLn(IntToStr(r) + ',' + IntToStr(g) + ',' + IntToStr(b));
end.

Output:

64,226,1

See Also