Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.snarked.org!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.java.programmer Subject: Re: RGB vs HSV Followup-To: comp.lang.java.programmer Date: Tue, 10 May 2011 10:16:44 +1200 Organization: Geek Central Lines: 19 Message-ID: References: NNTP-Posting-Host: 118-92-95-178.dsl.dyn.ihug.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: lust.ihug.co.nz 1304979405 8155 118.92.95.178 (9 May 2011 22:16:45 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Mon, 9 May 2011 22:16:45 +0000 (UTC) User-Agent: KNode/4.4.7 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3878 In message , wrote: > On 5/8/2011 6:58 PM, Lawrence D'Oliveiro wrote: > >> Wikipedia has formulas for the conversion. Or you can use code like the >> HSVA class here >> . > > > I found this, the algorithm seems a bit more compact than yours. Might > want to give it a look: > > In what way more compact? The RGB-to-HSV seems to involve just as many comparisons (not counting the special case, where they return an out-of- ange value, while I don’t), and the hue calculation is written out three times, instead of just once. HSV-to-RGB seems to be no more simple than my version.