From: "Mattias Engdegård" <mattiase@acm.org>
To: Alan Third <alan@idiocy.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Use 65535 as scale factor for color-values on NS
Date: Sat, 6 Jun 2020 11:57:03 +0200 [thread overview]
Message-ID: <144C70D7-33AA-4840-89A6-205F1EDF4847@acm.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Alan, it seems that only NS uses 65280 as scale factor for 'color-values'; all other back-ends use 65535. Do you know if there is any reason for keeping it this way? Otherwise, I propose we change it (see patch).
It is probably just a relic from when colour components were scaled from 8 to 16 bits by multiplication with 256 instead of 257; this seems to have been fixed everywhere else.
[-- Attachment #2: 0001-Use-65535-as-color-values-scale-value-in-the-NS-back.patch --]
[-- Type: application/octet-stream, Size: 2246 bytes --]
From fba2c0d5f93c05db580b3aa7c8eda7a282411796 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Sat, 6 Jun 2020 11:23:48 +0200
Subject: [PATCH] Use 65535 as color-values scale value in the NS backend
* src/nsfns.m (Fxw_color_values): Scale with 65535 instead of 65280, for
uniformity with other backends.
* lisp/faces.el (color-values): Update doc string.
* doc/lispref/frames.texi (Color Names): Update examples.
---
doc/lispref/frames.texi | 6 +++---
lisp/faces.el | 2 +-
src/nsfns.m | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 6bf5db2aa1..966f620558 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -3975,11 +3975,11 @@ Color Names
(color-values "black")
@result{} (0 0 0)
(color-values "white")
- @result{} (65280 65280 65280)
+ @result{} (65535 65535 65535)
(color-values "red")
- @result{} (65280 0 0)
+ @result{} (65535 0 0)
(color-values "pink")
- @result{} (65280 49152 51968)
+ @result{} (65535 49344 52171)
(color-values "hungry")
@result{} nil
@end example
diff --git a/lisp/faces.el b/lisp/faces.el
index e707f6f4b6..f4a9dedd79 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1822,7 +1822,7 @@ color-values
string specifying a color's RGB components (e.g. \"#ff12ec\").
Return a list of three integers, (RED GREEN BLUE), each between 0
-and either 65280 or 65535 (the maximum depends on the system).
+and 65535 inclusive.
Use `color-name-to-rgb' if you want RGB floating-point values
normalized to 1.0.
diff --git a/src/nsfns.m b/src/nsfns.m
index 273fb5f759..5e8d572d8f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2329,8 +2329,8 @@ Frames are listed from topmost (first) to bottommost (last). */)
[[col colorUsingDefaultColorSpace]
getRed: &red green: &green blue: &blue alpha: &alpha];
unblock_input ();
- return list3i (lrint (red * 65280), lrint (green * 65280),
- lrint (blue * 65280));
+ return list3i (lrint (red * 65335), lrint (green * 65535),
+ lrint (blue * 65535));
}
--
2.21.1 (Apple Git-122.3)
next reply other threads:[~2020-06-06 9:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-06 9:57 Mattias Engdegård [this message]
2020-06-06 11:17 ` Use 65535 as scale factor for color-values on NS Mattias Engdegård
2020-06-06 18:57 ` Alan Third
2020-06-07 8:39 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=144C70D7-33AA-4840-89A6-205F1EDF4847@acm.org \
--to=mattiase@acm.org \
--cc=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).