[AD] An example of HLS colour-space |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Here is a program that demonstrates the use of the HLS colour-space and compares it to HSV colour-space. It is based on the improved exrgbhsv I submitted a month or so ago. It lets you select the colour using the HLS colour-space as well as the RGB and HSV colour-spaces. The code also contains non-optimised implementations of the following-four functions (I'm currently working on optimised versions): hls_to_rgb() rgb_to_hls() sv_to_ls() ls_to_sv() The latter two convert between HSV and HLS colour-spaces (the hue in both spaces is equivalent so it is not used in these two functions as it is the same property). To see the difference, drag the leftmost S slider (HSV) all the way to the right. Then you will be able to see the differences between HSV and HSL by looking at the colour-bars. When the colour is at it's most colourful-ness, the HSV saturation drifts to white, and the HLS saturation drifts to medium-grey. V is from black to red, and L is from black to white via red. Apart from getting different results when interpolating in the HSV and HLS colour-spaces, the V (value or brightness) and the L (lightness or luminance) represent two different concepts. Brightness corresponds to percieved intensity of a coloured-light, and luminance corresponds to the quantity of light used. Brightness is also a property of self-illuminating objects, and lightness is a property of reflecting objects. AE.
Attachment:
excolspc.zip
Description: Zip compressed data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |