Changes by last author:

Added:
= rgb2hsl =

== Syntax ==

:int rgb2hsl(int r, int g, int b, int z)

== Arguments ==

:r

::Red value

:g

::Green value

:b

::Blue value

:z

::Determines which value is returned. z=0 for H (Hue), z=1 for S (Saturation), z=2 for L (Lightness)

== Return ==

:Returns the H, S or L value from 0 to 255 depending on the value of z

== Description ==

:Lets you convert RGB values to HSL values.

== Example ==

<code>

%ffp

ctl(0):"Adjust H",Range=(-255,255),val=0

ctl(1):"Adjust S",Range=(-255,255),val=0

ctl(2):"Adjust L",Range=(-255,255),val=0

ForEveryTile:{

int r,g,b,h,s,l;

for (y= y_start; y < y_end; y++){

if(updateProgress(y,y_end)) abort();

for (x = x_start; x < x_end; x++){

r = src(x,y,0);

g = src(x,y,1);

b = src(x,y,2);

h = rgb2hsl (r,g,b,0);

s = rgb2hsl (r,g,b,1);

l = rgb2hsl (r,g,b,2);

//Do the HSL adjustment

h = h + ctl(0);

s = s + ctl(1);

l = l + ctl(2);

pset( x, y, 0, hsl2rgb (h,s,l,0) );

pset( x, y, 1, hsl2rgb (h,s,l,1) );

pset( x, y, 2, hsl2rgb (h,s,l,2) );

}}

return true;

}

</code>

== Also see ==

:hsl2rgb

== Comments ==

:Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.