From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: sRGB color support in NS port [PATCH] Date: Sat, 21 Dec 2013 17:16:00 +0100 Message-ID: <3C0A35C3-5D2B-4E6A-9C63-9EE98056DC3A@swipnet.se> References: <23825B39C60F460E80B59C5ADF04F637@gmail.com> <83zjnv9yrp.fsf@gnu.org> <16B838CD-13DC-468E-94D1-108EBFE68F6D@swipnet.se> <7FA1C0353EC248D28B9E7242BA7BDFCC@gmail.com> <933E75DF-F665-46C0-8D82-111186A809B1@sanityinc.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1387642590 13911 80.91.229.3 (21 Dec 2013 16:16:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Dec 2013 16:16:30 +0000 (UTC) Cc: Eli Zaretskii , Bozhidar Batsov , emacs-devel To: Steve Purcell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 21 17:16:32 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VuPE5-0001wW-Ks for ged-emacs-devel@m.gmane.org; Sat, 21 Dec 2013 17:16:29 +0100 Original-Received: from localhost ([::1]:54715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPE5-0007Zp-6B for ged-emacs-devel@m.gmane.org; Sat, 21 Dec 2013 11:16:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPDw-0007Yr-SC for emacs-devel@gnu.org; Sat, 21 Dec 2013 11:16:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuPDq-0007EA-RL for emacs-devel@gnu.org; Sat, 21 Dec 2013 11:16:20 -0500 Original-Received: from mailfe09.swipnet.se ([212.247.155.1]:47336 helo=swip.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPDk-0007DW-5d; Sat, 21 Dec 2013 11:16:08 -0500 X-T2-Spam-Status: No, hits=0.0 required=5.0 Original-Received: from hosdjarv.se (account mj138573@tele2.se [46.59.42.57] verified) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 289514937; Sat, 21 Dec 2013 17:16:04 +0100 In-Reply-To: <933E75DF-F665-46C0-8D82-111186A809B1@sanityinc.com> X-Mailer: Apple Mail (2.1827) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 212.247.155.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:166702 Archived-At: Hello. This has been done in another way in trunk. Customize ns-use-srgb-colorspace to use sRGB. Default is to use = calibrated space. Note that images still don't use sRGB color space. Nor do they with the = patch below. Also, this is not what the documentation says is the right way to = display colors on OSX. Jan D. 21 dec 2013 kl. 15:10 skrev Steve Purcell : > commit 3b63b2c6e9e93adab09eace60750ed981a8e528f > Author: Steve Purcell > Date: Sat Dec 21 11:44:12 2013 +0000 >=20 > Treat hex colors as sRGB under OS X >=3D 10.7 >=20 > diff --git a/src/nsterm.m b/src/nsterm.m > index 733c05a..0c79186 100644 > --- a/src/nsterm.m > +++ b/src/nsterm.m > @@ -1373,6 +1373,13 @@ ns_fullscreen_hook (struct frame *f) > Color management >=20 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = */ > +#if defined(NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >=3D = MAC_OS_X_VERSION_10_7 > +#define NS_COLOR_FROM_RGB(r, g, b) [NSColor colorWithSRGBRed: r = green: g blue: b alpha: 1.0] > +#define NS_COLOR_AS_RGB(c) [c colorUsingColorSpace: [NSColorSpace = sRGBColorSpace]] > +#else > +#define NS_COLOR_FROM_RGB(r, g, b) [NSColor colorWithCalibratedRed: r = green: g blue: b alpha: 1.0] > +#define NS_COLOR_AS_RGB(c) [c colorUsingColorSpaceName: = NSCalibratedRGBColorSpace] > +#endif >=20 >=20 > NSColor * > @@ -1551,7 +1558,7 @@ ns_get_color (const char *name, NSColor **col) >=20 > if (r >=3D 0.0F) > { > - *col =3D [NSColor colorWithCalibratedRed: r green: g blue: b = alpha: 1.0]; > + *col =3D NS_COLOR_FROM_RGB(r, g, b); > unblock_input (); > return 0; > } > @@ -1583,7 +1590,7 @@ ns_get_color (const char *name, NSColor **col) > } >=20 > if (new) > - *col =3D [new colorUsingColorSpaceName: = NSCalibratedRGBColorSpace]; > + *col =3D NS_COLOR_AS_RGB(new); > unblock_input (); > return new ? 0 : 1; > } > @@ -1624,7 +1631,7 @@ ns_color_to_lisp (NSColor *col) > return build_string ((char *)str); > } >=20 > - [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace] > + [NS_COLOR_AS_RGB(col) > getRed: &red green: &green blue: &blue alpha: &alpha]; > if (red =3D=3Dgreen && red =3D=3Dblue) > { > @@ -4252,10 +4259,9 @@ ns_term_init (Lisp_Object display_name) > name =3D SSDATA (XCAR (color)); > c =3D XINT (XCDR (color)); > [cl setColor: > - [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) = / 255.0 > - green: GREEN_FROM_ULONG = (c) / 255.0 > - blue: BLUE_FROM_ULONG = (c) / 255.0 > - alpha: 1.0] > + NS_COLOR_FROM_RGB(RED_FROM_ULONG (c) / 255.0, > + GREEN_FROM_ULONG (c) / 255.0, > + BLUE_FROM_ULONG (c) / 255.0) > forKey: [NSString stringWithUTF8String: name]]; > } > [cl writeToFile: nil];