diff options
| author | Julien Danjou | 2010-11-26 11:19:00 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-11-26 11:19:00 +0000 |
| commit | f5462bae4eed999b82c24bbaf17373ddedbf06fd (patch) | |
| tree | 45f7d61063d25068c8cece86d1cd626b67c8547b | |
| parent | 36af6c6577177f2979f0f492b58c5d9634b2e859 (diff) | |
| download | emacs-f5462bae4eed999b82c24bbaf17373ddedbf06fd.tar.gz emacs-f5462bae4eed999b82c24bbaf17373ddedbf06fd.zip | |
color.el: Rename various rgb functions to srgb.
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/color.el | 16 | ||||
| -rw-r--r-- | lisp/gnus/shr-color.el | 8 |
3 files changed, 16 insertions, 12 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index ef08592cf96..3ae3c5bc740 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-11-26 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * color.el: Rename various rgb functions to srgb. | ||
| 4 | |||
| 1 | 2010-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org> | 5 | 2010-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 6 | ||
| 3 | * nnimap.el (nnimap-get-groups): Allow non-quoted strings as mailbox | 7 | * nnimap.el (nnimap-get-groups): Allow non-quoted strings as mailbox |
diff --git a/lisp/gnus/color.el b/lisp/gnus/color.el index 67ee9e79f10..4d3718bc8df 100644 --- a/lisp/gnus/color.el +++ b/lisp/gnus/color.el | |||
| @@ -53,7 +53,7 @@ RED GREEN BLUE must be values between [0,1]." | |||
| 53 | 53 | ||
| 54 | (defun color-rgb->hsv (red green blue) | 54 | (defun color-rgb->hsv (red green blue) |
| 55 | "Convert RED GREEN BLUE values to HSV representation. | 55 | "Convert RED GREEN BLUE values to HSV representation. |
| 56 | Hue is in radian. Saturation and values are between 0 and 1." | 56 | Hue is in radian. Saturation and values are between [0,1]." |
| 57 | (let* ((r (float red)) | 57 | (let* ((r (float red)) |
| 58 | (g (float green)) | 58 | (g (float green)) |
| 59 | (b (float blue)) | 59 | (b (float blue)) |
| @@ -106,8 +106,8 @@ RED, GREEN and BLUE must be between [0,1]." | |||
| 106 | (/ delta (+ max min)))) | 106 | (/ delta (+ max min)))) |
| 107 | l))) | 107 | l))) |
| 108 | 108 | ||
| 109 | (defun color-rgb->xyz (red green blue) | 109 | (defun color-srgb->xyz (red green blue) |
| 110 | "Converts RED GREEN BLUE colors to CIE XYZ representation. | 110 | "Converts RED GREEN BLUE colors from the sRGB color space to CIE XYZ. |
| 111 | RED, BLUE and GREEN must be between [0,1]." | 111 | RED, BLUE and GREEN must be between [0,1]." |
| 112 | (let ((r (if (<= red 0.04045) | 112 | (let ((r (if (<= red 0.04045) |
| 113 | (/ red 12.95) | 113 | (/ red 12.95) |
| @@ -122,8 +122,8 @@ RED, BLUE and GREEN must be between [0,1]." | |||
| 122 | (+ (* 0.21266729 r) (* 0.7151522 g) (* 0.0721750 b)) | 122 | (+ (* 0.21266729 r) (* 0.7151522 g) (* 0.0721750 b)) |
| 123 | (+ (* 0.0193339 r) (* 0.1191920 g) (* 0.9503041 b))))) | 123 | (+ (* 0.0193339 r) (* 0.1191920 g) (* 0.9503041 b))))) |
| 124 | 124 | ||
| 125 | (defun color-xyz->rgb (X Y Z) | 125 | (defun color-xyz->srgb (X Y Z) |
| 126 | "Converts CIE X Y Z colors to RGB." | 126 | "Converts CIE X Y Z colors to sRGB color space." |
| 127 | (let ((r (+ (* 3.2404542 X) (* -1.5371385 Y) (* -0.4985314 Z))) | 127 | (let ((r (+ (* 3.2404542 X) (* -1.5371385 Y) (* -0.4985314 Z))) |
| 128 | (g (+ (* -0.9692660 X) (* 1.8760108 Y) (* 0.0415560 Z))) | 128 | (g (+ (* -0.9692660 X) (* 1.8760108 Y) (* 0.0415560 Z))) |
| 129 | (b (+ (* 0.0556434 X) (* -0.2040259 Y) (* 1.0572252 Z)))) | 129 | (b (+ (* 0.0556434 X) (* -0.2040259 Y) (* 1.0572252 Z)))) |
| @@ -186,15 +186,15 @@ none is set, `color-d65-xyz' is used." | |||
| 186 | (* yr Yr) ; Y | 186 | (* yr Yr) ; Y |
| 187 | (* zr Zr))))) ; Z | 187 | (* zr Zr))))) ; Z |
| 188 | 188 | ||
| 189 | (defun color-rgb->lab (red green blue) | 189 | (defun color-srgb->lab (red green blue) |
| 190 | "Converts RGB to CIE L*a*b*." | 190 | "Converts RGB to CIE L*a*b*." |
| 191 | (apply 'color-xyz->lab (color-rgb->xyz red green blue))) | 191 | (apply 'color-xyz->lab (color-srgb->xyz red green blue))) |
| 192 | 192 | ||
| 193 | (defun color-rgb->normalize (color) | 193 | (defun color-rgb->normalize (color) |
| 194 | "Normalize a RGB color to values between [0,1]." | 194 | "Normalize a RGB color to values between [0,1]." |
| 195 | (mapcar (lambda (x) (/ x 65535.0)) (x-color-values color))) | 195 | (mapcar (lambda (x) (/ x 65535.0)) (x-color-values color))) |
| 196 | 196 | ||
| 197 | (defun color-lab->rgb (L a b) | 197 | (defun color-lab->srgb (L a b) |
| 198 | "Converts CIE L*a*b* to RGB." | 198 | "Converts CIE L*a*b* to RGB." |
| 199 | (apply 'color-xyz->rgb (color-lab->xyz L a b))) | 199 | (apply 'color-xyz->rgb (color-lab->xyz L a b))) |
| 200 | 200 | ||
diff --git a/lisp/gnus/shr-color.el b/lisp/gnus/shr-color.el index 779c30bc8f3..afb56ae38a7 100644 --- a/lisp/gnus/shr-color.el +++ b/lisp/gnus/shr-color.el | |||
| @@ -330,8 +330,8 @@ color will be adapted to be visible on BG." | |||
| 330 | (if (or (null fg-norm) | 330 | (if (or (null fg-norm) |
| 331 | (null bg-norm)) | 331 | (null bg-norm)) |
| 332 | (list bg fg) | 332 | (list bg fg) |
| 333 | (let* ((fg-lab (apply 'color-rgb->lab fg-norm)) | 333 | (let* ((fg-lab (apply 'color-srgb->lab fg-norm)) |
| 334 | (bg-lab (apply 'color-rgb->lab bg-norm)) | 334 | (bg-lab (apply 'color-srgb->lab bg-norm)) |
| 335 | ;; Compute color distance using CIE DE 2000 | 335 | ;; Compute color distance using CIE DE 2000 |
| 336 | (fg-bg-distance (color-cie-de2000 fg-lab bg-lab)) | 336 | (fg-bg-distance (color-cie-de2000 fg-lab bg-lab)) |
| 337 | ;; Compute luminance distance (substract L component) | 337 | ;; Compute luminance distance (substract L component) |
| @@ -351,10 +351,10 @@ color will be adapted to be visible on BG." | |||
| 351 | bg | 351 | bg |
| 352 | (apply 'format "#%02x%02x%02x" | 352 | (apply 'format "#%02x%02x%02x" |
| 353 | (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) | 353 | (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) |
| 354 | (apply 'color-lab->rgb bg-lab)))) | 354 | (apply 'color-lab->srgb bg-lab)))) |
| 355 | (apply 'format "#%02x%02x%02x" | 355 | (apply 'format "#%02x%02x%02x" |
| 356 | (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) | 356 | (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) |
| 357 | (apply 'color-lab->rgb fg-lab)))))))))) | 357 | (apply 'color-lab->srgb fg-lab)))))))))) |
| 358 | 358 | ||
| 359 | (provide 'shr-color) | 359 | (provide 'shr-color) |
| 360 | 360 | ||