From: ellman AT xs4all DOT nl () Newsgroups: comp.os.msdos.djgpp Subject: Re: RGB HSV functions that "actually work" Date: 25 Oct 1997 15:25:28 GMT Organization: XS4ALL Message-ID: <62t318$269$1@news2.xs4all.nl> References: <199710202348 DOT TAA00340 AT delorie DOT com> <62pai0$8p3 AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: xs2.xs4all.nl Lines: 33 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <62pai0$8p3 AT freenet-news DOT carleton DOT ca>, Paul Derbyshire wrote: > >"Andrei 'old boy' Ellman" (ellman AT xs4all DOT nl) writes: >> + RGB <-> HSV functions that actually work, as well as RGB <-> HLS >> functions. > >Is something wrong with the ones in Allegro?? Allegro's RGB <-> HSV functions often don't procuce the correct results. This is because whoever wrote them forgot to properly convert floats in the range [0...1] to ints in the range [0...63]. Instead, they just cast the float directly into an int. When Shawn added this to Allegro 2.2, he did not test it, and the result was a buggy set of RGB <-> HLS functions. (I think there may have been another bug as well)> The ones in AllegroPak are a slight modification from the ones in Principals of Computer Graphics by Foley & VanDam. The difference is that they are less strict about the inputs (eg. they don't return an error if saturation is 0.0 and hue is not UNDEFINED). Also, the RGB <-> HLS functions which are not in Allegro at all, have had a bug fixed that appeared in Foley & VanDam (the transition of L values from 0 to 1 is smoother). Allegro 3.0 WIP includes corrected RGB <-> HSV functions, but I'm not sure if Shawn used my fix or not. AE. Andrei Ellman -- URL: http://www.xs4all.nl/~ellman/ae-a -- ae1 AT york DOT ac DOT uk "All I wanna do is have some fun :-) || ae-a AT minster DOT york DOT ac DOT uk I've got the feeling I'm not the only one" || mailto:ellman AT xs4all DOT nl -- Sheryl Crow :-) || It's what you make of it.