From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: color.el Date: Sun, 20 Feb 2011 13:07:12 +0900 Message-ID: <877hcvtklr.fsf@catnip.gol.com> References: <87sjvjj2mz.fsf@stupidchicken.com> <8762sfv7c6.fsf@catnip.gol.com> <3028FDD10C5A4C1A8BF109BAA0CA773B@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298174852 4227 80.91.229.12 (20 Feb 2011 04:07:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 20 Feb 2011 04:07:32 +0000 (UTC) Cc: 'Chong Yidong' , emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 20 05:07:22 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pr0Zt-0000zQ-Ex for ged-emacs-devel@m.gmane.org; Sun, 20 Feb 2011 05:07:21 +0100 Original-Received: from localhost ([127.0.0.1]:33925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pr0Zt-0004MR-6X for ged-emacs-devel@m.gmane.org; Sat, 19 Feb 2011 23:07:21 -0500 Original-Received: from [140.186.70.92] (port=50922 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pr0Zo-0004M9-It for emacs-devel@gnu.org; Sat, 19 Feb 2011 23:07:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pr0Zn-0004nj-CW for emacs-devel@gnu.org; Sat, 19 Feb 2011 23:07:16 -0500 Original-Received: from smtp12.dentaku.gol.com ([203.216.5.74]:43335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pr0Zn-0004nd-1s; Sat, 19 Feb 2011 23:07:15 -0500 Original-Received: from 218.231.234.87.eo.eaccess.ne.jp ([218.231.234.87] helo=catnip.gol.com) by smtp12.dentaku.gol.com with esmtpa (Dentaku) (envelope-from ) id 1Pr0Zl-0007SA-D5; Sun, 20 Feb 2011 13:07:13 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id 99082DFA0; Sun, 20 Feb 2011 13:07:12 +0900 (JST) System-Type: x86_64-unknown-linux-gnu In-Reply-To: <3028FDD10C5A4C1A8BF109BAA0CA773B@us.oracle.com> (Drew Adams's message of "Sat, 19 Feb 2011 19:19:57 -0800") Original-Lines: 42 X-Virus-Scanned: ClamAV GOL (outbound) X-Abuse-Complaints: abuse@gol.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 203.216.5.74 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136263 Archived-At: "Drew Adams" writes: >> Radians seem cleaner; an argument range of 0-360 only seems >> useful if an interface is primarily user-level (e.g. a spec >> in a web page or something). > > Cleaner than what? than [0,360]? than [0,1]? than both? > And why? In particular, why would [0,2*pi] be cleaner than [0,1]? Actually I was just comparing to 0-360; I agree that 0-1 is probably the best of them all. [A possible exception might be if you're trying very hard to avoid consing; then maybe any use of floats is undesirable. It doesn't seem that's considered an issue with this API tho...] > I agree (if you are saying this) that the input and return values of these > functions should not assume only or even primarily user-level use cases (e.g. > web-page color spec). They should be general functions. This is essentially a > utility library of building-block functions. Agree. > IMO, the values should be of the same type (a) for all components (r,g,b,h,s,v), > and (b) for both input and return values. We should not be sometimes passing in > [0,1] for RGB and other times passing in [0,255] for RGB. Similarly for return > values. And we should not use [0,360] for H but [0,1] for S and V. I agree. I'd rather not ever use 0-255 in the interface though. _If_ it's sometimes desirable to use integers instead of floats for color components, 0-65535 gives higher resolution, is already in use by Emacs color functions (`color-values'), and can be efficiently (without division) converted to 0-255 internally when that range is desirable (for backends or whatever). -Miles -- Dinanzi a me non fuor cose create se non etterne, e io etterno duro. Lasciate ogne speranza, voi ch'intrate.