If you need a portable .NET solution for converting RGB to HLS and vice versa there are libraries around to do it. For Windows only using the Shell Lightweight Utility Functions is a simpler alternative.

static extern int ColorHLSToRGB(int H, int L, int S);
static extern void ColorRGBToHLS(int RGB, ref int H, ref int L, ref int S);
ColorRGBToHLS(ColorTranslator.ToWin32(rgbColor, ref h, ref l, ref s);
Color rgbColor=ColorTranslator.FromWin32(ColorHLSToRGB(h, l, s));

0 comment(s) :

Newer Post Older Post Home

Blogger Syntax Highliter