[comp.windows.ms.programmer] RGB and IHS controls

aew@eosvcr.wimsey.bc.ca (Alan Walford) (05/23/91)

Anybody know the conversions between RGB (red, green, blue) and IHS
(intensity, hue, saturation) ?  I know this is asked in various news
groups from time to time but I can't seem to find it around.

When specifying colours with 3 sliders (like the palatte control does)
it is often more intuitive to have the user control I, H and S as opposed
to R,G and B.

I know the formulas look something like this (for NTSC at least):

  I = 0.299 R + 0.587 G + 0.114 B
  H =  ?    R +   ?   G +   ?   B
  S =  ?    R +   ?   G +   ?   B

  R =  ?    I +   ?   H +   ?   S
  G =  ?    I +   ?   H +   ?   S
  B =  ?    I +   ?   H +   ?   S

Can anyone complete these ?  

Thanks, Alan
aew@eosvcr.wimsey.bc.ca
----------------------------------------------------------------------------
Alan Walford                                             Tel:   604-731-0703
 ...uunet!van-bc!eosvcr!aew    OR
 aew@eosvcr.wimsey.bc.ca

ronb@burklabs (Ron Burk ) (05/31/91)

aew@eosvcr.wimsey.bc.ca (Alan Walford) writes:

> 
> Anybody know the conversions between RGB (red, green, blue) and IHS
> (intensity, hue, saturation) ?

I think you want the Tektronix HLS (hue, lightness, saturation) model
(because I think that's what the Windows desktop uses).  In any case,
this and other models are supplied in "Fundamentals of Interactive
Computer Graphics", by Foley and Van Dam.  The algorithm they supply
is not the simple matrix multiplication you suggest.

Has anyone made a free HLS color slider for Windows apps that
everyone can use?