unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6918: Colors of xbm image are swapped on Windows
@ 2010-08-26  8:42 Kazuhiro Ito
  2019-09-26 17:59 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Kazuhiro Ito @ 2010-08-26  8:42 UTC (permalink / raw)
  To: 6918

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

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@gnu.org>
> 	* 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@gnu.org>
> 	* image.c (xbm_load) [WINDOWSNT]: Shuffle the bits of directly
> 	specified XBMs.

-- 
Kazuhiro Ito

[-- Attachment #2: image.c.diff --]
[-- Type: application/octet-stream, Size: 539 bytes --]

=== 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);


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-06 11:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-26  8:42 bug#6918: Colors of xbm image are swapped on Windows Kazuhiro Ito
2019-09-26 17:59 ` Lars Ingebrigtsen
2019-09-26 18:31   ` Eli Zaretskii
2019-09-26 18:34     ` Lars Ingebrigtsen
2019-09-26 18:44       ` Eli Zaretskii
2019-09-26 21:38         ` Jason Rumney
2019-09-27  5:30           ` Eli Zaretskii
2019-10-10  6:59             ` Jason Rumney
2019-10-10  8:17               ` Eli Zaretskii
2021-11-05 13:26                 ` Stefan Kangas
2021-11-06 11:35                   ` Eli Zaretskii

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).