Difference between revisions of "RGBToHSL"
From SCAR Divi Manual
(→See Also) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Definition== | ==Definition== | ||
<source lang="scar" lines="false"> | <source lang="scar" lines="false"> | ||
− | procedure | + | procedure RGBToHSL(R, G, B: Integer; var H, S, L: Extended); |
</source> | </source> | ||
Line 8: | Line 8: | ||
==Description== | ==Description== | ||
− | Converts [http://en.wikipedia.org/wiki/RGB_color_model RGB] values specified by '''R''', '''G''' and '''B''' to color components within the [http://en.wikipedia.org/wiki/HSL_and_HSV HSL] color space and returns them in '''H''', '''S''' and '''L'''. The HSL values are defined as percentages within the range 0..100. The | + | Converts [http://en.wikipedia.org/wiki/RGB_color_model RGB] values specified by '''R''', '''G''' and '''B''' to color components within the [http://en.wikipedia.org/wiki/HSL_and_HSV HSL] color space and returns them in '''H''', '''S''' and '''L'''. The HSL values are defined as percentages within the range 0..100. The resulting values can be converted back to RGB values using [[HSLToRGB]]. |
==Example== | ==Example== | ||
Line 16: | Line 16: | ||
begin | begin | ||
− | + | RGBToHSL(0, 255, 0, H, S, L); | |
WriteLn(FloatToStr(H) + ';' + FloatToStr(S) + ';' + FloatToStr(L)); | WriteLn(FloatToStr(H) + ';' + FloatToStr(S) + ';' + FloatToStr(L)); | ||
end. | end. |
Latest revision as of 10:07, 5 July 2011
Definition
procedure RGBToHSL(R, G, B: Integer; var H, S, L: Extended);
Availability
SCAR Divi 3.00 > Current
Description
Converts RGB values specified by R, G and B to color components within the HSL color space and returns them in H, S and L. The HSL values are defined as percentages within the range 0..100. The resulting values can be converted back to RGB values using HSLToRGB.
Example
var H, S, L: Extended; begin RGBToHSL(0, 255, 0, H, S, L); WriteLn(FloatToStr(H) + ';' + FloatToStr(S) + ';' + FloatToStr(L)); end.
Output:
33,3333343267441;100;50