Difference between revisions of "ColorToRGB"
From SCAR Divi Manual
(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...") |
|||
Line 18: | Line 18: | ||
==Description== | ==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]]. | + | Converts a given color value '''Color''' to [http://en.wikipedia.org/wiki/RGB_color_model RGB] values and returns them in '''R''', '''G''' and '''B'''. The components can be joined back together into a color value using [[RGBToColor]]. |
==Example== | ==Example== |
Latest revision as of 17:39, 3 July 2011
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