From unknown Thu Jun 19 14:20:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly Resent-From: Alp Aker Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jul 2011 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9175 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 9175@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.131179382427039 (code B ref -1); Wed, 27 Jul 2011 19:11:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Jul 2011 19:10:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qm9Ut-000722-5x for submit@debbugs.gnu.org; Wed, 27 Jul 2011 15:10:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlmcF-0004d5-1J for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlmc8-00064i-Vj for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:35138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc8-00064e-OG for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc7-0006Bo-Pw for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlmc6-00064U-Ou for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:19 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:35802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc6-00064N-Mh for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:18 -0400 Received: by qyk32 with SMTP id 32so2038707qyk.0 for ; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=K2a08GdvN3CHtf9dSVUL6NOKoSKa8WXLJhCgWnM03Tw=; b=K5RF6XlMrt9JnepwE+8dfYJLRN+LBP5HJ5dEpxUDU30FC478heFxlj0LyiO2KNAvLN F5we1Uw6ujgUe3W6Om5PNhetZTyMJILLOR++OOkuxS+TGNieNBWHN5oBeSD96KOQ2rtb c8jq+s6EEEWX2Xr5Po7VyS1mLC0I05zyJ/d8k= MIME-Version: 1.0 Received: by 10.229.2.160 with SMTP id 32mr4472773qcj.280.1311705857353; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) Received: by 10.229.250.132 with HTTP; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) Date: Tue, 26 Jul 2011 14:44:17 -0400 Message-ID: From: Alp Aker Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Mailman-Approved-At: Wed, 27 Jul 2011 15:10:22 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.6 (-----) 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 * 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]; From unknown Thu Jun 19 14:20:52 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Jul 2011 18:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9175 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alp Aker Cc: 9175@debbugs.gnu.org Received: via spool by 9175-submit@debbugs.gnu.org id=B9175.13118777649700 (code B ref 9175); Thu, 28 Jul 2011 18:30:02 +0000 Received: (at 9175) by debbugs.gnu.org; 28 Jul 2011 18:29:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QmVKl-0002WO-A0 for submit@debbugs.gnu.org; Thu, 28 Jul 2011 14:29:23 -0400 Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QmVKj-0002WF-6r for 9175@debbugs.gnu.org; Thu, 28 Jul 2011 14:29:21 -0400 Received: from furball ([128.36.14.95]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p6SITK29017195 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 28 Jul 2011 14:29:20 -0400 From: Chong Yidong References: Date: Thu, 28 Jul 2011 14:29:19 -0400 In-Reply-To: (Alp Aker's message of "Tue, 26 Jul 2011 14:44:17 -0400") Message-ID: <87vcuml0n4.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Alp Aker 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 28 14:29:35 2011 Received: (at control) by debbugs.gnu.org; 28 Jul 2011 18:29:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QmVKx-0002Wl-5Q for submit@debbugs.gnu.org; Thu, 28 Jul 2011 14:29:35 -0400 Received: from vm-emlprdomr-06.its.yale.edu ([130.132.50.147]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QmVKv-0002We-A0 for control@debbugs.gnu.org; Thu, 28 Jul 2011 14:29:33 -0400 Received: from furball ([128.36.14.95]) (authenticated bits=0) by vm-emlprdomr-06.its.yale.edu (8.14.4/8.14.4) with ESMTP id p6SITWXs003241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Thu, 28 Jul 2011 14:29:32 -0400 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 9175 Date: Thu, 28 Jul 2011 14:29:31 -0400 Message-ID: <87pqkujm2c.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.147 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) close 9175 thanks