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 16:02:52 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1082119286 23838 80.91.224.253 (16 Apr 2004 12:41:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Apr 2004 12:41:26 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 16 14:41:11 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 1BESed-0001Ph-00 for ; Fri, 16 Apr 2004 14:41:11 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BESec-0005Mv-00 for ; Fri, 16 Apr 2004 14:41:11 +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 1BESYL-0006Qq-GH for emacs-devel@quimby.gnus.org; Fri, 16 Apr 2004 08:34:41 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BESQq-0004hd-5T for emacs-devel@gnu.org; Fri, 16 Apr 2004 08:26:56 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BESNP-0002fX-Fl for emacs-devel@gnu.org; Fri, 16 Apr 2004 08:23:55 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.30) id 1BES4B-00055x-QZ for emacs-devel@gnu.org; Fri, 16 Apr 2004 08:03:31 -0400 Original-Received: (qmail 40939 invoked from network); 16 Apr 2004 12:03:30 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 16 Apr 2004 12:03:30 -0000 Original-To: YAMAMOTO Mitsuharu In-Reply-To: Original-Lines: 53 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:21752 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21752 YAMAMOTO Mitsuharu writes: > >>>>> On 16 Apr 2004 02:21:11 +0200, David Kastrup said: > > > PNG images support transparency. Emacs can't make use of it. You > > can only have Emacs declare a particular color as transparent. This > > is dissatisfactory. It should tell the PNG decoding routines Emacs' > > background color for the purpose of transparency. > > As for PNG transparency, there was one thing that I noticed (and I've > been forgotten to tell about it) while I was porting image support to > Carbon Emacs. > > In png_load (image.c): > > user_bg.red = color.red >> PNG_BG_COLOR_SHIFT; > user_bg.green = color.green >> PNG_BG_COLOR_SHIFT; > user_bg.blue = color.blue >> PNG_BG_COLOR_SHIFT; > > fn_png_set_background (png_ptr, &user_bg, > PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); > > I think the background color should be specified in 8-bit depth here > (thus PNG_BG_COLOR_SHIFT should be 8 for all the platforms) because > the 4th argument (aka need_expand) for fn_png_set_background is 0 and > the image data has been normalized in 8-bit depth at this stage. I can indeed see that 8-bit shift is the right setting on X. > You > can observe the difference using > http://www.w3.org/Graphics/PNG/alphatest.png. The same thing is also > applied to the other place (in png_load) where fn_png_set_background > is called with its 4th argument 0. 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. 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. -- Kim F. Storm http://www.cua.dk