emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102532: color.el: Rename various rgb


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102532: color.el: Rename various rgb functions to srgb.
Date: Fri, 26 Nov 2010 11:19:00 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102532
author: Julien Danjou <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Fri 2010-11-26 11:19:00 +0000
message:
  color.el: Rename various rgb functions to srgb.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/color.el
  lisp/gnus/shr-color.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-26 11:03:16 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-26 11:19:00 +0000
@@ -1,3 +1,7 @@
+2010-11-26  Julien Danjou  <address@hidden>
+
+       * color.el: Rename various rgb functions to srgb.
+
 2010-11-26  Lars Magne Ingebrigtsen  <address@hidden>
 
        * nnimap.el (nnimap-get-groups): Allow non-quoted strings as mailbox

=== modified file 'lisp/gnus/color.el'
--- a/lisp/gnus/color.el        2010-11-25 14:51:51 +0000
+++ b/lisp/gnus/color.el        2010-11-26 11:19:00 +0000
@@ -53,7 +53,7 @@
 
 (defun color-rgb->hsv (red green blue)
   "Convert RED GREEN BLUE values to HSV representation.
-Hue is in radian. Saturation and values are between 0 and 1."
+Hue is in radian. Saturation and values are between [0,1]."
    (let* ((r (float red))
         (g (float green))
         (b (float blue))
@@ -106,8 +106,8 @@
          (/ delta (+ max min))))
      l)))
 
-(defun color-rgb->xyz (red green blue)
-  "Converts RED GREEN BLUE colors to CIE XYZ representation.
+(defun color-srgb->xyz (red green blue)
+  "Converts RED GREEN BLUE colors from the sRGB color space to CIE XYZ.
 RED, BLUE and GREEN must be between [0,1]."
   (let ((r (if (<= red 0.04045)
                (/ red 12.95)
@@ -122,8 +122,8 @@
           (+ (* 0.21266729 r) (* 0.7151522 g) (* 0.0721750 b))
           (+ (* 0.0193339 r) (* 0.1191920 g) (* 0.9503041 b)))))
 
-(defun color-xyz->rgb (X Y Z)
-  "Converts CIE X Y Z colors to RGB."
+(defun color-xyz->srgb (X Y Z)
+  "Converts CIE X Y Z colors to sRGB color space."
   (let ((r (+ (* 3.2404542 X) (* -1.5371385 Y) (* -0.4985314 Z)))
         (g (+ (* -0.9692660 X) (* 1.8760108 Y) (* 0.0415560 Z)))
         (b (+ (* 0.0556434 X) (* -0.2040259 Y) (* 1.0572252 Z))))
@@ -186,15 +186,15 @@
               (* yr Yr)                 ; Y
               (* zr Zr)))))             ; Z
 
-(defun color-rgb->lab (red green blue)
+(defun color-srgb->lab (red green blue)
   "Converts RGB to CIE L*a*b*."
-  (apply 'color-xyz->lab (color-rgb->xyz red green blue)))
+  (apply 'color-xyz->lab (color-srgb->xyz red green blue)))
 
 (defun color-rgb->normalize (color)
   "Normalize a RGB color to values between [0,1]."
   (mapcar (lambda (x) (/ x 65535.0)) (x-color-values color)))
 
-(defun color-lab->rgb (L a b)
+(defun color-lab->srgb (L a b)
   "Converts CIE L*a*b* to RGB."
   (apply 'color-xyz->rgb (color-lab->xyz L a b)))
 

=== modified file 'lisp/gnus/shr-color.el'
--- a/lisp/gnus/shr-color.el    2010-11-26 02:37:23 +0000
+++ b/lisp/gnus/shr-color.el    2010-11-26 11:19:00 +0000
@@ -330,8 +330,8 @@
     (if (or (null fg-norm)
            (null bg-norm))
        (list bg fg)
-      (let* ((fg-lab (apply 'color-rgb->lab fg-norm))
-            (bg-lab (apply 'color-rgb->lab bg-norm))
+      (let* ((fg-lab (apply 'color-srgb->lab fg-norm))
+            (bg-lab (apply 'color-srgb->lab bg-norm))
             ;; Compute color distance using CIE DE 2000
             (fg-bg-distance (color-cie-de2000 fg-lab bg-lab))
             ;; Compute luminance distance (substract L component)
@@ -351,10 +351,10 @@
                 bg
               (apply 'format "#%02x%02x%02x"
                      (mapcar (lambda (x) (* (max (min 1 x) 0) 255))
-                             (apply 'color-lab->rgb bg-lab))))
+                             (apply 'color-lab->srgb bg-lab))))
             (apply 'format "#%02x%02x%02x"
                    (mapcar (lambda (x) (* (max (min 1 x) 0) 255))
-                           (apply 'color-lab->rgb fg-lab))))))))))
+                           (apply 'color-lab->srgb fg-lab))))))))))
 
 (provide 'shr-color)
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]