diff options
| author | Julien Danjou | 2013-01-11 15:04:24 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-01-11 15:04:24 +0000 |
| commit | 43b2e2e71ab2e9748cc879bb784d9337535a35d3 (patch) | |
| tree | 3837ac7e3c91a8d07fe4d63da4daa86d63772115 | |
| parent | 6020559a093bf243be6cd6a866933b4368ea67cc (diff) | |
| download | emacs-43b2e2e71ab2e9748cc879bb784d9337535a35d3.tar.gz emacs-43b2e2e71ab2e9748cc879bb784d9337535a35d3.zip | |
color.el: fix color-rgb-to-hsv computing
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/color.el | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bbabcfb6ee2..502cc2ff8c0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-01-11 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * color.el (color-rgb-to-hsv): Fix conversion computing in case min and | ||
| 4 | max are almost equal. Also return the correct value for V which is | ||
| 5 | already between 0 and 1. | ||
| 6 | |||
| 1 | 2013-01-11 Dmitry Antipov <dmantipov@yandex.ru> | 7 | 2013-01-11 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 8 | ||
| 3 | * emacs-lisp/ert.el (ert-run-test): Use point-max-marker. | 9 | * emacs-lisp/ert.el (ert-run-test): Use point-max-marker. |
diff --git a/lisp/color.el b/lisp/color.el index 63326e7c5b3..50f6675bf4b 100644 --- a/lisp/color.el +++ b/lisp/color.el | |||
| @@ -130,7 +130,7 @@ inclusive." | |||
| 130 | (max (max r g b)) | 130 | (max (max r g b)) |
| 131 | (min (min r g b))) | 131 | (min (min r g b))) |
| 132 | (if (< (- max min) 1e-8) | 132 | (if (< (- max min) 1e-8) |
| 133 | (list 0.0 0.0 0.0) | 133 | (list 0.0 0.0 min) |
| 134 | (list | 134 | (list |
| 135 | (/ (* 2 float-pi | 135 | (/ (* 2 float-pi |
| 136 | (cond ((and (= r g) (= g b)) 0) | 136 | (cond ((and (= r g) (= g b)) 0) |
| @@ -146,7 +146,7 @@ inclusive." | |||
| 146 | (+ 240 (* 60 (/ (- r g) (- max min))))))) | 146 | (+ 240 (* 60 (/ (- r g) (- max min))))))) |
| 147 | 360) | 147 | 360) |
| 148 | (if (= max 0) 0 (- 1 (/ min max))) | 148 | (if (= max 0) 0 (- 1 (/ min max))) |
| 149 | (/ max 255.0))))) | 149 | max)))) |
| 150 | 150 | ||
| 151 | (defun color-rgb-to-hsl (red green blue) | 151 | (defun color-rgb-to-hsl (red green blue) |
| 152 | "Convert RGB colors to their HSL representation. | 152 | "Convert RGB colors to their HSL representation. |