[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6918: Colors of xbm image are swapped on Windows
From: |
Lars Ingebrigtsen |
Subject: |
bug#6918: Colors of xbm image are swapped on Windows |
Date: |
Thu, 26 Sep 2019 19:59:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Kazuhiro Ito <kzhr@d1.dion.ne.jp> writes:
> 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.
[...]
> 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.
The code in question seems odd, indeed:
/* Windows convention for mono bitmaps is black = background,
white = foreground. */
SetTextColor (new_img_dc, background);
SetBkColor (new_img_dc, foreground);
Can anybody who works on Windows say whether this is the case?
In any case, it seems very odd that the test code (included below again
for easy C-x C-e) should produce image with different colours, since
they should just be two ways of specifying the same image. I think?
(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)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#6918: Colors of xbm image are swapped on Windows,
Lars Ingebrigtsen <=