MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / fromHSL

Function fromHSL

sourcecommon/gr.cpp:17–35  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

15}
16//---------------------------------------------------------------------------
17TColor fromHSL(double h,double s,double l){
18 double r, g, b;
19
20 if(s == 0){
21 r = g = b = l;
22 } else{
23 double q = l < 0.5 ? l * (s + 1) : l + s - l * s;
24 double p = 2 * l - q;
25 r = hue2rgb(p, q, h + 1.0/3);
26 g = hue2rgb(p, q, h);
27 b = hue2rgb(p, q, h - 1.0/3);
28 }
29
30 int rr=r*255+0.5;
31 int gg=g*255+0.5;
32 int bb=b*255+0.5;
33
34 return (TColor) RGB(rr, gg, bb);
35}
36//---------------------------------------------------------------------------
37void toHSL(TColor color,double *hh,double *ss,double *ll){
38try // catch division by zero

Callers 1

FillVolumeFunction · 0.85

Calls 1

hue2rgbFunction · 0.85

Tested by

no test coverage detected