RGBtoHSL

 

Contents

Description

convert RGB color to HSL

Syntax

void RGBtoHSL( DWORD crRBG, double * hue, double * sat, double * light )

Parameters

crRBG
[input] rgb values to convert, can use RGB macro to generate
hue
[output] pointer to receive Hue between 0 and 1
sat
[output] pointer to receive Saturation between 0 and 1
light
[output] pointer to receive Lightness between 0 and 1

Return

Examples

EX1

void rgb2hsl_ex1(int rr, int gg, int bb)
{
    double hh, ss, ll;
    DWORD rgb = RGB(rr, gg, bb);
    RGBtoHSL(rgb, &hh, &ss, &ll);
    printf("%d %d %d\n", nint(hh*360),nint(ss*100),nint(ll*100));
}

Remark

See Also

HSLtoRGB

header to Included

origin.h

Reference