bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56182: 28.1; Display of SVG file with transparent background is inco


From: Alan Third
Subject: bug#56182: 28.1; Display of SVG file with transparent background is incorrect
Date: Mon, 11 Sep 2023 20:10:24 +0100

On Sat, Sep 09, 2023 at 01:09:44PM +0100, Alan Third wrote:
> On Tue, Jun 28, 2022 at 08:38:11PM +0200, Pascal Quesseveur wrote:
> > From what I understand the way to deal with background transparency of
> > SVG images has changed in version 28.1 in function svg_load_image
> > (comments about opacity are still there but I think they are
> > irrelevant). Now the SVG image is encapsulated in another SVG image in
> > which a rect element is defined with the background color of the
> > image.
> > 
> > I don't know why it doesn't work on the W10 computers I work on. I
> > don't know if the problem comes from this modificatino either. It
> > seems to me that the displayed color is BGR instead of RGB and the
> > screen gamma correction is not applied.
> 
> Apologies for leaving this so long.
> 
> Is this an issue for *all* Windows machines? The documentation for
> COLORREF[1] suggests that Windows uses a byte format for *all* colours
> of 0x00BBGGRR, which would explain this, but I thought it worked fine
> on some machines?
> 
> Alternatively, I'm looking at the wrong documentation, however it
> appears the code in w32term.c uses this COLORREF for colours as
> defined in a face, so I think it's the right thing.
> 
> If this is right and Windows always uses this format, all we need to
> do is format the SVG colour differently on Windows.
> 
> [1] 
> https://learn.microsoft.com/en-gb/windows/win32/gdi/colorref?redirectedfrom=MSDN

I've checked with the one Windows box I have available to me and it
looks like this is the same there, so I've attached a patch that I
hope will fix this. All it's doing is reversing bytes 1 and 3 (from
the right) of the colours, so when it's used in the SVG code it should
display correctly.

I can't check it as I don't have a Windows development box. If someone
can confirm that this 1. compiles and 2. fixes the problem that would
be great.

I found it easy to check by setting the theme to "light blue" and
loading etc/images/down.svg. The correct result should have a black
triangle on a blue background, but incorrect is a black triangle on a
yellow background.
-- 
Alan Third

Attachment: 0001-Fix-SVG-colors-bug-56182.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]