ColorToRGB

From SCAR Divi Manual
Revision as of 15:02, 2 July 2011 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> procedure ColorToRGB(Color: Integer; var R, G, B: Integer); </source> ===Source Code=== <source lang="scar"> procedure ColorToR...")
(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