From unknown Fri Aug 22 01:33:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12559: color-hsl-to-rgb doesn't handle hue range overflow Resent-From: Julian Scheid Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Oct 2012 16:27:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 12559@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13491952155587 (code B ref -1); Tue, 02 Oct 2012 16:27:04 +0000 Received: (at submit) by debbugs.gnu.org; 2 Oct 2012 16:26:55 +0000 Received: from localhost ([127.0.0.1]:37952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TJ5J9-0001Rz-8L for submit@debbugs.gnu.org; Tue, 02 Oct 2012 12:26:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38730) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TJ2jH-0003Wk-Sq for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ2if-0006Er-Uq for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2if-0006El-S1 for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2iZ-0003wa-Im for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ2iY-0006D0-DM for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:40:59 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:48845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2iY-0006Bf-6V for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:40:58 -0400 Received: by weyu3 with SMTP id u3so3970272wey.0 for ; Tue, 02 Oct 2012 06:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=b4x/Jgo6/zrQ3tgnD1DSKrMSPkL6mdtgz7uRoUwuG1I=; b=zMekTn8eJ4/J/Qloyvs6gE+cJFPRQX7G4aSktSbHZFWK7G48Vc1NOWlRcccRCSF6N+ sg9iwVFwLnp9SvG5ky1gZUg6fH7sL6oLlPKwJlqi4XNNt/JoPnJKUqVapkkVqcsXbjkj Obl51psM288jGSF/el8x70Hx88abDWpbQC5VA4RXHvuXehzeklJNZC+1ASLzNoxSNk1C GvXqAXlCq7C70+gJ34qeCzm07zHbG6NT/R4FvNojJDxD1nyI8//svWKp+LXRgDBnFUez VKjZhchJHf2wVf4uT+QpK7l/El9vNuIVYLzIb6/4BSQxq+BO6/pXOWD8hjIxM9cSzOhh PvEg== Received: by 10.181.13.239 with SMTP id fb15mr22014966wid.22.1349185257205; Tue, 02 Oct 2012 06:40:57 -0700 (PDT) Received: from macbook.local (p57946129.dip.t-dialin.net. [87.148.97.41]) by mx.google.com with ESMTPS id fb20sm2514677wid.1.2012.10.02.06.40.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Oct 2012 06:40:56 -0700 (PDT) From: Julian Scheid Date: Tue, 02 Oct 2012 15:40:54 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -3.2 (---) X-Mailman-Approved-At: Tue, 02 Oct 2012 12:26:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) `color-hsl-to-rgb' manipulates hue without dealing with range overflow or underflow. This takes small and large hue values outside of the range expected by `color-hue-to-rgb' and causes incorrect results for such values: (color-rgb-to-hsl 0.65 0.25 0.75) ;; -> (0.7999999999999999 0.5 0.5) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.25 0.75)) ;; -> (0.25 0.25 0.75) (color-rgb-to-hsl 0.65 0.75 0.25) ;; -> (0.20000000000000004 0.5 0.5) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.75 0.25)) ;; -> (0.6499999999999999 0.75 -0.1499999999999998) The patch below makes the conversion work as expected: (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.25 0.75)) ;; -> (0.6499999999999999 0.25 0.75) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.75 0.25)) ;; -> (0.6499999999999999 0.75 0.25) 2012-10-02 Julian Scheid * color.el (color-hsl-to-rgb): Fix for incorrect results for small and large hue values. === modified file 'lisp/color.el' *** lisp/color.el 2012-08-13 19:10:35 +0000 --- lisp/color.el 2012-10-02 13:16:32 +0000 *************** Return a list (RED, GREEN, BLUE) which e *** 116,124 **** (- (+ L S) (* L S)))) (m1 (- (* 2.0 L) m2))) (list ! (color-hue-to-rgb m1 m2 (+ H (/ 1.0 3))) (color-hue-to-rgb m1 m2 H) ! (color-hue-to-rgb m1 m2 (- H (/ 1.0 3))))))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." --- 116,124 ---- (- (+ L S) (* L S)))) (m1 (- (* 2.0 L) m2))) (list ! (color-hue-to-rgb m1 m2 (mod (+ H (/ 1.0 3)) 1)) (color-hue-to-rgb m1 m2 H) ! (color-hue-to-rgb m1 m2 (mod (- H (/ 1.0 3)) 1)))))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." From unknown Fri Aug 22 01:33:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Julian Scheid Subject: bug#12559: closed (Re: bug#12559: color-hsl-to-rgb doesn't handle hue range overflow) Message-ID: References: <77lifk7328.fsf@fencepost.gnu.org> X-Gnu-PR-Message: they-closed 12559 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 12559@debbugs.gnu.org Date: Sat, 06 Oct 2012 02:23:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1349490183-18574-1" This is a multi-part message in MIME format... ------------=_1349490183-18574-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12559: color-hsl-to-rgb doesn't handle hue range overflow which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12559@debbugs.gnu.org. --=20 12559: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12559 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1349490183-18574-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12559-done) by debbugs.gnu.org; 6 Oct 2012 02:22:10 +0000 Received: from localhost ([127.0.0.1]:57414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKK1p-0004oL-DD for submit@debbugs.gnu.org; Fri, 05 Oct 2012 22:22:09 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:51803 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKK1m-0004oD-OF for 12559-done@debbugs.gnu.org; Fri, 05 Oct 2012 22:22:07 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TKK1Y-00043D-3j; Fri, 05 Oct 2012 22:21:52 -0400 From: Glenn Morris To: 12559-done@debbugs.gnu.org Subject: Re: bug#12559: color-hsl-to-rgb doesn't handle hue range overflow References: X-Spook: SHA Syria covert video weapons of mass destruction North X-Ran: mA`;!b)-x>HZX:,tiMF1!iS|HcM)SD(XO=n (Julian Scheid's message of "Tue, 02 Oct 2012 15:40:54 +0200") Message-ID: <77lifk7328.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 12559-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) Version: 24.3 Thanks; applied to trunk. ------------=_1349490183-18574-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Oct 2012 16:26:55 +0000 Received: from localhost ([127.0.0.1]:37952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TJ5J9-0001Rz-8L for submit@debbugs.gnu.org; Tue, 02 Oct 2012 12:26:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38730) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TJ2jH-0003Wk-Sq for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ2if-0006Er-Uq for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2if-0006El-S1 for submit@debbugs.gnu.org; Tue, 02 Oct 2012 09:41:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2iZ-0003wa-Im for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ2iY-0006D0-DM for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:40:59 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:48845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ2iY-0006Bf-6V for bug-gnu-emacs@gnu.org; Tue, 02 Oct 2012 09:40:58 -0400 Received: by weyu3 with SMTP id u3so3970272wey.0 for ; Tue, 02 Oct 2012 06:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=b4x/Jgo6/zrQ3tgnD1DSKrMSPkL6mdtgz7uRoUwuG1I=; b=zMekTn8eJ4/J/Qloyvs6gE+cJFPRQX7G4aSktSbHZFWK7G48Vc1NOWlRcccRCSF6N+ sg9iwVFwLnp9SvG5ky1gZUg6fH7sL6oLlPKwJlqi4XNNt/JoPnJKUqVapkkVqcsXbjkj Obl51psM288jGSF/el8x70Hx88abDWpbQC5VA4RXHvuXehzeklJNZC+1ASLzNoxSNk1C GvXqAXlCq7C70+gJ34qeCzm07zHbG6NT/R4FvNojJDxD1nyI8//svWKp+LXRgDBnFUez VKjZhchJHf2wVf4uT+QpK7l/El9vNuIVYLzIb6/4BSQxq+BO6/pXOWD8hjIxM9cSzOhh PvEg== Received: by 10.181.13.239 with SMTP id fb15mr22014966wid.22.1349185257205; Tue, 02 Oct 2012 06:40:57 -0700 (PDT) Received: from macbook.local (p57946129.dip.t-dialin.net. [87.148.97.41]) by mx.google.com with ESMTPS id fb20sm2514677wid.1.2012.10.02.06.40.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Oct 2012 06:40:56 -0700 (PDT) From: Julian Scheid To: bug-gnu-emacs@gnu.org Subject: color-hsl-to-rgb doesn't handle hue range overflow Date: Tue, 02 Oct 2012 15:40:54 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 02 Oct 2012 12:26:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) `color-hsl-to-rgb' manipulates hue without dealing with range overflow or underflow. This takes small and large hue values outside of the range expected by `color-hue-to-rgb' and causes incorrect results for such values: (color-rgb-to-hsl 0.65 0.25 0.75) ;; -> (0.7999999999999999 0.5 0.5) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.25 0.75)) ;; -> (0.25 0.25 0.75) (color-rgb-to-hsl 0.65 0.75 0.25) ;; -> (0.20000000000000004 0.5 0.5) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.75 0.25)) ;; -> (0.6499999999999999 0.75 -0.1499999999999998) The patch below makes the conversion work as expected: (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.25 0.75)) ;; -> (0.6499999999999999 0.25 0.75) (apply 'color-hsl-to-rgb (color-rgb-to-hsl 0.65 0.75 0.25)) ;; -> (0.6499999999999999 0.75 0.25) 2012-10-02 Julian Scheid * color.el (color-hsl-to-rgb): Fix for incorrect results for small and large hue values. === modified file 'lisp/color.el' *** lisp/color.el 2012-08-13 19:10:35 +0000 --- lisp/color.el 2012-10-02 13:16:32 +0000 *************** Return a list (RED, GREEN, BLUE) which e *** 116,124 **** (- (+ L S) (* L S)))) (m1 (- (* 2.0 L) m2))) (list ! (color-hue-to-rgb m1 m2 (+ H (/ 1.0 3))) (color-hue-to-rgb m1 m2 H) ! (color-hue-to-rgb m1 m2 (- H (/ 1.0 3))))))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." --- 116,124 ---- (- (+ L S) (* L S)))) (m1 (- (* 2.0 L) m2))) (list ! (color-hue-to-rgb m1 m2 (mod (+ H (/ 1.0 3)) 1)) (color-hue-to-rgb m1 m2 H) ! (color-hue-to-rgb m1 m2 (mod (- H (/ 1.0 3)) 1)))))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." ------------=_1349490183-18574-1-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 01 13:41:59 2012 Received: (at control) by debbugs.gnu.org; 1 Dec 2012 18:41:59 +0000 Received: from localhost ([127.0.0.1]:48774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tes0k-00009d-Tl for submit@debbugs.gnu.org; Sat, 01 Dec 2012 13:41:59 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:56960) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tes0j-00009X-FH for control@debbugs.gnu.org; Sat, 01 Dec 2012 13:41:57 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Terya-00024h-Rv for control@debbugs.gnu.org; Sat, 01 Dec 2012 13:39:45 -0500 Date: Sat, 01 Dec 2012 13:39:44 -0500 Message-Id: Subject: control message for bug 13047 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) unarchive 12559 forcemerge 12559 13047