From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: no-spam@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Several suggestions for image support Date: 16 Apr 2004 18:59:26 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <407FD68E.50908@gnu.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1082128144 17422 80.91.224.253 (16 Apr 2004 15:09:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Apr 2004 15:09:04 +0000 (UTC) Cc: YAMAMOTO Mitsuharu , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 16 17:08:51 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BEUxW-0004w2-00 for ; Fri, 16 Apr 2004 17:08:50 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BEUxW-0007Jl-00 for ; Fri, 16 Apr 2004 17:08:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BEUpx-0004fg-5R for emacs-devel@quimby.gnus.org; Fri, 16 Apr 2004 11:01:01 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BEUpI-0004dQ-E1 for emacs-devel@gnu.org; Fri, 16 Apr 2004 11:00:20 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BEUok-0004V7-OQ for emacs-devel@gnu.org; Fri, 16 Apr 2004 11:00:17 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.30) id 1BEUoj-0004U9-V0 for emacs-devel@gnu.org; Fri, 16 Apr 2004 10:59:46 -0400 Original-Received: (qmail 57242 invoked from network); 16 Apr 2004 14:59:44 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 16 Apr 2004 14:59:44 -0000 Original-To: Jason Rumney In-Reply-To: <407FD68E.50908@gnu.org> Original-Lines: 50 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21774 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21774 Jason Rumney 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); to frame_background.red = GetRValue (color); frame_background.green = GetGValue (color); frame_background.blue = GetBValue (color); -- Kim F. Storm http://www.cua.dk