emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 6e38b92: Fix color-distance docstring


From: Mark Oteiza
Subject: [Emacs-diffs] master 6e38b92: Fix color-distance docstring
Date: Fri, 15 Sep 2017 13:30:29 -0400 (EDT)

branch: master
commit 6e38b9253e3d67def0e16f90da574b4622d962a3
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    Fix color-distance docstring
    
    Also feed the translated color to the metric argument.
    * src/xfaces.c (color-distance): Reword docstring to be more helpful.
    Avoid duplicating effort in lcms2 by passing the translated 16 bit RGB
    instead of the function's color arguments.
---
 src/xfaces.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/xfaces.c b/src/xfaces.c
index 012de4e..b309c16 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4093,7 +4093,8 @@ DEFUN ("color-distance", Fcolor_distance, 
Scolor_distance, 2, 4, 0,
 COLOR1 and COLOR2 may be either strings containing the color name,
 or lists of the form (RED GREEN BLUE), each in the range 0 to 65535 inclusive.
 If FRAME is unspecified or nil, the current frame is used.
-If METRIC is unspecified or nil, a modified L*u*v* metric is used.  */)
+If METRIC is specified, it should be a function that accepts
+two lists of the form (RED GREEN BLUE) aforementioned. */)
   (Lisp_Object color1, Lisp_Object color2, Lisp_Object frame,
    Lisp_Object metric)
 {
@@ -4112,7 +4113,13 @@ If METRIC is unspecified or nil, a modified L*u*v* 
metric is used.  */)
   if (NILP (metric))
     return make_number (color_distance (&cdef1, &cdef2));
   else
-    return call2 (metric, color1, color2);
+    return call2 (metric,
+                  list3 (make_number (cdef1.red),
+                         make_number (cdef1.green),
+                         make_number (cdef1.blue)),
+                  list3 (make_number (cdef2.red),
+                         make_number (cdef2.green),
+                         make_number (cdef2.blue)));
 }
 
 



reply via email to

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