emacs-devel
[Top][All Lists]
Advanced

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

define_color vs. xw-color-values, or pixel vs. red, green and blue


From: Juanma Barranquero
Subject: define_color vs. xw-color-values, or pixel vs. red, green and blue
Date: Wed, 14 Feb 2007 17:21:28 +0100

On Windows:

ELISP> (color-distance "black" "white")
584970
ELISP> (color-distance "black" (color-values "white"))
589568

1st case:
- color-distance calls define_color
- define_color calls w32_define_color
 - w32_define_color finds the XColor (through x_to_w32_color and
w32_color_map_lookup), then snaps its RGB components to the nearest
color in the default palette, and returns it
 - defined_color returns the XColor
 - color-distance passes it to color_distance, which uses the RGB components

2nd case:
 - color-values calls xw-color-values
 - xw-color-values calls w32_defined_color
- w32_defined_color does as above
 - xw-color-values ignores the RGB components, synthesizes a RGB list
by manipulating the pixel component of the XColor and returns it

So I suppose the question is: why does xw-color-values do

 return list3 (make_number ((GetRValue (foo.pixel) << 8)
                            | GetRValue (foo.pixel)),
               make_number ((GetGValue (foo.pixel) << 8)
                            | GetGValue (foo.pixel)),
               make_number ((GetBValue (foo.pixel) << 8)
                            | GetBValue (foo.pixel)));

instead of

 return list3 (make_number (foo.red),
               make_number (foo.green),
               make_number (foo.blue));

            Juanma




reply via email to

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