This routine converts a color given in values of the RGB colorspace to its respective representation within the HSB/HSV colorspace.
Note that the results of this routine are returned as intended side effects through the given arguments, hence you must provide type LONG variables (signed or unsigned) for the results.
SYNTAX:
RGBtoHSB red~&, gre~&, blu~&, hue~&, sat~&, bri~&
INPUTS:
red~& (_UNSIGNED LONG)
- The red component of the color to convert in the range 0-65535.
gre~& (_UNSIGNED LONG)
- The green component of the color to convert in the range 0-65535.
blu~& (_UNSIGNED LONG)
- The blue component of the color to convert in the range 0-65535.
RESULT:
hue~& ((_UNSIGNED) LONG variable)
- The resulting Hue value, ranges from 0 for red over 21845 (&H5555) for green and 43690 (&HAAAA) for blue to 65535 (&HFFFF) red again.
sat~& ((_UNSIGNED) LONG variable)
- The resulting Saturation value, which is 0 for 0% to 65535 for 100%.
bri~& ((_UNSIGNED) LONG variable)
- The resulting Brightness value, which is 0 for 0% to 65535 for 100%.