GNU bug report logs - #9175
[PATCH] 24.0.50: Images colors on NextStep do not default correctly

Previous Next

Package: emacs;

Reported by: Alp Aker <alptekin.aker <at> gmail.com>

Date: Wed, 27 Jul 2011 19:11:01 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9175 in the body.
You can then email your comments to 9175 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9175; Package emacs. (Wed, 27 Jul 2011 19:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alp Aker <alptekin.aker <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 27 Jul 2011 19:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alp Aker <alptekin.aker <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 24.0.50: Images colors on NextStep do not default correctly
Date: Tue, 26 Jul 2011 14:44:17 -0400
Image types that support :foreground and :background keywords in their
image descriptors are supposed to default to the frame foreground and
background colors when the relevant colors aren't specified.  On NS,
however, these default to black.  An easy test case is provided by
visiting a mono PBM image file (such as etc/images/splash.pbm) in
image-mode; what one will see is simply a black square.

Diagnostic: The image loading functions in image.c take the default
colors from the frame's foreground_pixel and background_pixel fields,
but on NS the relevant frame parameter handlers don't set those
fields.  The following patch corrects that.

2011-07-25  Alp Aker  <alp.tekin.aker <at> gmail.com>

	* nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
	setting frame foreground color.
	(x_set_background_color): Likewise.

=== modified file 'src/nsfns.m'
--- src/nsfns.m	2011-07-08 15:39:40 +0000
+++ src/nsfns.m	2011-07-25 17:22:05 +0000
@@ -321,6 +321,7 @@
 x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
+  CGFloat r, g, b, alpha;

   if (ns_lisp_to_color (arg, &col))
     {
@@ -332,6 +333,10 @@
   [f->output_data.ns->foreground_color release];
   f->output_data.ns->foreground_color = col;

+  [col getRed: &r green: &g blue: &b alpha: &alpha];
+  FRAME_FOREGROUND_PIXEL (f) =
+    ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff),
(int)(b*0xff));
+
   if (FRAME_NS_VIEW (f))
     {
       update_face_from_frame_parameter (f, Qforeground_color, arg);
@@ -348,7 +353,7 @@
   struct face *face;
   NSColor *col;
   NSView *view = FRAME_NS_VIEW (f);
-  float alpha;
+  CGFloat r, g, b, alpha;

   if (ns_lisp_to_color (arg, &col))
     {
@@ -364,10 +369,14 @@
   [col retain];
   [f->output_data.ns->background_color release];
   f->output_data.ns->background_color = col;
+
+  [col getRed: &r green: &g blue: &b alpha: &alpha];
+  FRAME_BACKGROUND_PIXEL (f) =
+    ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff),
(int)(b*0xff));
+
   if (view != nil)
     {
       [[view window] setBackgroundColor: col];
-      alpha = [col alphaComponent];

       if (alpha != 1.0)
           [[view window] setOpaque: NO];




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9175; Package emacs. (Thu, 28 Jul 2011 18:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 9175 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Alp Aker <alptekin.aker <at> gmail.com>
Cc: 9175 <at> debbugs.gnu.org
Subject: Re: bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not
	default correctly
Date: Thu, 28 Jul 2011 14:29:19 -0400
Alp Aker <alptekin.aker <at> gmail.com> writes:

> Image types that support :foreground and :background keywords in their
> image descriptors are supposed to default to the frame foreground and
> background colors when the relevant colors aren't specified.  On NS,
> however, these default to black.  An easy test case is provided by
> visiting a mono PBM image file (such as etc/images/splash.pbm) in
> image-mode; what one will see is simply a black square.
>
> Diagnostic: The image loading functions in image.c take the default
> colors from the frame's foreground_pixel and background_pixel fields,
> but on NS the relevant frame parameter handlers don't set those
> fields.  The following patch corrects that.

Thanks, applied.




bug closed, send any further explanations to 9175 <at> debbugs.gnu.org and Alp Aker <alptekin.aker <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Thu, 28 Jul 2011 18:30:07 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.