bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#25890: `color-values` gives wrong value


From: Eli Zaretskii
Subject: bug#25890: `color-values` gives wrong value
Date: Sat, 04 Mar 2017 10:43:01 +0200

> Date: Fri, 3 Mar 2017 13:18:12 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: michael_heerdegen@web.de, 25890@debbugs.gnu.org, rasmus@gmx.us
> 
> You said:
> 
> > The bug is in hexrgb-int-to-hex: it incorrectly assumes that it should
> > produce the LSB part of the number, while it actually should produce
> > the MSB part.
> 
> `hexrgb-int-to-hex' just converts integer RGB to hex RGB.
> And it converts integer 57568 to E0E0, which you now agree
> is correct.
> 
> Perhaps you can elaborate a bit on what you think the bug is?

I already did, but you didn't want to hear, claiming that I repeat
myself.

Here it is again: the problem is in hexrgb-int-to-hex.  It does this:

  (substring (format (concat "%0" (int-to-string nb-digits) "X") int) (- 
nb-digits))

which assumes that the digits to be produced, if n in the %0nX format
is too small and doesn't allow to produce all of them, are the
least-significant digits of the number.  It should instead produce the
most-significant digits.  IOW, when #FFFFFF is converted to 16-bit per
color component, it should yield #FF00FF00FF00, not #FFFFFFFFFFFF.





reply via email to

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