GNU bug report logs - #6918
Colors of xbm image are swapped on Windows

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Kazuhiro Ito <kzhr@HIDDEN>; dated Thu, 26 Aug 2010 08:47:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Aug 2010 08:46:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 26 04:46:11 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OoY67-0007mQ-19
	for submit <at> debbugs.gnu.org; Thu, 26 Aug 2010 04:46:11 -0400
Received: from mx10.gnu.org ([199.232.76.166])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <kzhr@HIDDEN>) id 1OoY1U-0007jc-Cw
	for submit <at> debbugs.gnu.org; Thu, 26 Aug 2010 04:41:25 -0400
Received: from lists.gnu.org ([199.232.76.165]:45445)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <kzhr@HIDDEN>) id 1OoY2r-0000xs-6k
	for submit <at> debbugs.gnu.org; Thu, 26 Aug 2010 04:42:49 -0400
Received: from [140.186.70.92] (port=46004 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OoY2p-00015t-Oe
	for bug-gnu-emacs@HIDDEN; Thu, 26 Aug 2010 04:42:48 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
	autolearn=unavailable version=3.3.1
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <kzhr@HIDDEN>) id 1OoY2o-0006K1-Mh
	for bug-gnu-emacs@HIDDEN; Thu, 26 Aug 2010 04:42:47 -0400
Received: from msa105.auone-net.jp ([61.117.18.165]:39407)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <kzhr@HIDDEN>) id 1OoY2o-0006Il-7O
	for bug-gnu-emacs@HIDDEN; Thu, 26 Aug 2010 04:42:46 -0400
Received: from MJOLNIR.tigers-net.com (dhcp-sch-f7-211-148.med.osaka-cu.ac.jp
	[160.193.211.148])
	by msa105.auone-net.jp (au one net msa) with ESMTP id 32E962C803A;
	Thu, 26 Aug 2010 17:42:32 +0900 (JST)
Date: Thu, 26 Aug 2010 17:42:31 +0900
Message-ID: <82tymhzrwo.wl%kzhr@HIDDEN>
From: Kazuhiro Ito <kzhr@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Colors of xbm image are swapped on Windows
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka)
	FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/23.2.50
	(i386-mingw-nt5.1.2600) MULE/6.0 (HANACHIRUSATO)
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Content-Type: multipart/mixed; boundary="Multipart_Thu_Aug_26_17:42:31_2010-1"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
	seldom 2.4 (older, 4)
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 26 Aug 2010 04:46:09 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.1 (-----)

--Multipart_Thu_Aug_26_17:42:31_2010-1
Content-Type: text/plain; charset=US-ASCII

When I evaluate below expression with Emacs on Windows, colors of the
second image are swapped.  With Emacs on other environment
(e.g. Debian), second image is identical to first image.


(let ((image "#define default_width 8
#define default_height 16
static char default_bits[] = {
0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18,
 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};")
      (face 'default)
      (string "_"))
  (set-text-properties 0 (length string) `(face ,face) string)
  (with-temp-buffer
    (switch-to-buffer (current-buffer))
    (insert-image
     (create-image image 'xbm t) string)
    (sit-for 1)
    (insert-image
     (create-image image 'xbm t
		   :foreground (face-foreground face)
		   :background (face-background face)
		   ) string)
    (sit-for 3)))


Attached patch would fix problem.  But I don't know this patch is
correct, because this swapping seems intended.

> 2007-06-21  Jason Rumney  <jasonr@HIDDEN>
> 	* image.c (convert_mono_to_color_image): Swap fore and background.

I guess this swapping has become unnecessary anymore by later change.

> 2007-12-05  Jason Rumney  <jasonr@HIDDEN>
> 	* image.c (xbm_load) [WINDOWSNT]: Shuffle the bits of directly
> 	specified XBMs.

-- 
Kazuhiro Ito

--Multipart_Thu_Aug_26_17:42:31_2010-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="image.c.diff"
Content-Transfer-Encoding: 7bit

=== modified file 'src/image.c'
--- src/image.c	2010-06-19 19:43:47 +0000
+++ src/image.c	2010-08-26 07:35:54 +0000
@@ -2643,8 +2643,8 @@
   new_prev = SelectObject (new_img_dc, new_pixmap);
   /* Windows convention for mono bitmaps is black = background,
      white = foreground.  */
-  SetTextColor (new_img_dc, background);
-  SetBkColor (new_img_dc, foreground);
+  SetTextColor (new_img_dc, foreground);
+  SetBkColor (new_img_dc, background);
 
   BitBlt (new_img_dc, 0, 0, img->width, img->height, old_img_dc,
 	  0, 0, SRCCOPY);


--Multipart_Thu_Aug_26_17:42:31_2010-1--




Acknowledgement sent to Kazuhiro Ito <kzhr@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6918; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

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