the returned RGB values are floats,so you'll prob have to convert to integers if you want to use them in the rgb() command
`glbals for HSL/RGB conversion
`involved in the fadeout
type pixel
H as float
S as float
L as float
endtype
dim pixel(0) as pixel
sync on:sync rate 0
hsl2rgb(0,1,0.5)
do
text 10,10,"R:"+str$(pixel(0).R)+" G:"+str$(pixel(0).G)+" B:"+str$(pixel(0).B)
sync
loop
`thanks to EASYRGB.COM and WIKIPEDIA
function hsl2rgb(H#,S#,L#)
if ( S# = 0 ) `HSL values = 0 ÷ 1
rR# = L# * 255 `RGB results = 0 ÷ 255
rG# = L# * 255
rB# = L# * 255
else
if ( L# < 0.5 )
var_2# = L# * ( 1 + S# )
else
var_2# = ( L# + S# ) - ( S# * L# )
endif
var_1# = (2 * L#) - var_2#
pixel(0).R = 255 * Hue_2_RGB( var_1#, var_2#, H# + ( 1.0 / 3.0 ) )
pixel(0).G = 255 * Hue_2_RGB( var_1#, var_2#, H# )
pixel(0).B = 255 * Hue_2_RGB( var_1#, var_2#, H# - ( 1.0 / 3.0 ) )
endif
endfunction
Function Hue_2_RGB( v1#, v2#, vH# )
if ( vH# < 0 ) then vH# = vH# + 1
if ( vH# > 1 ) then vH# = vH# - 1
if ( ( 6 * vH# ) < 1 ) then res#=( v1# + ( v2# - v1# ) * 6.0 * vH# ): exitfunction ( res# )
if ( ( 2 * vH# ) < 1 ) then exitfunction ( v2# )
if ( ( 3 * vH# ) < 2 ) then res#=( v1# + ( v2# - v1# ) * ( ( 2.0 / 3.0 ) - vH# ) * 6.0 ):exitfunction ( res# )
Endfunction v1#
A study done by William Speyer, who was a victim of prison rape in 1989, shows that 34% of [prison] rape victims released from prison become child molestors.