[Top][All Lists]

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

Re: Several suggestions for image support

From: YAMAMOTO Mitsuharu
Subject: Re: Several suggestions for image support
Date: Fri, 16 Apr 2004 18:29:05 +0900
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On 16 Apr 2004 02:21:11 +0200, David Kastrup <address@hidden> 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.  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.

                                     YAMAMOTO Mitsuharu

reply via email to

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