Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!panix!not-for-mail From: John Forkosh Newsgroups: comp.graphics.algorithms Subject: Re: decorative random colors algorithm Date: Thu, 5 Jul 2012 12:23:16 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 38 Message-ID: References: <34b5c6a0-c79e-4a8f-bf71-4d480c9a5dc3@googlegroups.com> NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1341490996 11292 166.84.1.3 (5 Jul 2012 12:23:16 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 5 Jul 2012 12:23:16 +0000 (UTC) User-Agent: tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (NetBSD/5.1.2 (i386)) Xref: csiph.com comp.graphics.algorithms:931 JohnF wrote: > > I think I got your (and Foley,van Dam's) algorithms right, > but have included the updated function below. For example, > I didn't have your limtab, and just clipped your single > r,g,b's to 1.0. Don't think that accounts for > any of the "diff difference". I realized that my snippet of clipping code > double r = l+u+u, g = l-u+v, b = l-u-v; > double rgbmax = (r>g? (r>b?r:b) : (g>b?g:b)); > if ( rgbmax > 1.0 ) { > r /= rgbmax; g /= rgbmax; b /= rgbmax; } > red = (int)(255.0*r + 0.5); > green = (int)(255.0*g + 0.5); > blue = (int)(255.0*b + 0.5); which I inferred from your Section 4.3 discussion Proportional clipping improves the quality m=max(r,g,b) If m>255 Then Begin s=255/m r=Round(r*s) g=Round(g*s) b=Round(b*s) End can't possibly be equivalent to your table clipping that you're doing in Section 8 rb:=LimTab^[ri]; { Limiter by table } gb:=LimTab^[gi]; bb:=LimTab^[bi]; since you're clipping each component independently, i.e., if LimTab^[ri] < ri gets clipped, the other two aren't (necessarily) affected at all. -- John Forkosh ( mailto: j@f.com where j=john and f=forkosh )