[Top][All Lists]

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

Re: Several suggestions for image support

From: Kim F. Storm
Subject: Re: Several suggestions for image support
Date: 16 Apr 2004 18:59:26 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Jason Rumney <address@hidden> writes:

> Kim F. Storm wrote:
> > You are right.  Shifting 8 bits here as well on X fixes transparent bg.
> > I will commit a fix for X shortly.
> > However, on W32, it seems that it explicitly scales things to 16
> > bits
> > in both cases.  I cannot test this on W32, so I cannot say what's
> > the right thing to do.
> The W32 port scales to 16 bits in places because the native Windows
> COLORREF is 8 bits, while Emacs XColor is 16 bits. So in this case, 8
> bits is right, but alpha is currently coming out wrong. I suspect the
> use of COLOREF instead of XColor that you considered a bug when
> merging the image code (see comment around that location) was in fact
> not a bug.

But w32_defined_color has an XColor * as third arg, not COLORREF.
And w32_defined_color seems to return "properly scaled" values,
so it seems like it should be shifted >> 8 like the other ports.

> > Here is an easy way to test it -- after downloading the image you
> > mentioned:
> > (insert-image (create-image "alphatest.png"))
> > this should result in a light blue image with nice rounded
> > edges; a darker blue with rough edges indicates a problem.
> On Windows the image comes out with a black background and the image
> has rainbow colored stripes. Non-alpha PNGs look OK.

That is more or less as I expected.

Can you try to change in image.c around line 5454:

          frame_background.red = 256 * GetRValue (color);
          frame_background.green = 256 * GetGValue (color);
          frame_background.blue = 256 * GetBValue (color);


          frame_background.red = GetRValue (color);
          frame_background.green = GetGValue (color);
          frame_background.blue = GetBValue (color);

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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