swftools-common
[Top][All Lists]
Advanced

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

Re: [Swftools-common] PNG alpha


From: Matthias Kramm
Subject: Re: [Swftools-common] PNG alpha
Date: Sun, 16 May 2004 14:48:09 +0200
User-agent: Mutt/1.5.4i

On Thu, May 13, 2004 at 10:50:03PM -0400, Andrew Wason wrote:
> I noticed this comment in swftools-0.5.1/lib/modules/swfbits.c:
> 
>       Indeed: I haven't understood yet how flash player handles
>       alpha values different from 0 and 0xff in lossless bitmaps...
> 
> I think the flash player expects the alpha values to be premultiplied 
> (for both indexed and 32bit ARGB). So for a pixel A R G B, store
> A A/255*R A/255*G A/255*B

You are right!
I tried today with indexed, and that seems to work. 
It seems you get the graphic errors we encountered (which made
us believe that alpha is buggy) if one  of
    R+(255-A)>255
    G+(255-A)>255
    B+(255-A)>255
is true for any given pixel.
(OTOH, maybe you can get funny color transforms by deliberately triggering
 the overflow :))

I dimly recall that older flash player versions had bigger problems with
alpha though, especially in indexed mode, where one non fully
transparent pixel was messing up the whole scanline. Maybe Macromedia fixed this
somewhere between Flash 4 and Flash MX.

I'll also change png2swf so that any image is now again converted to
DEFINELOSSLESS(2). (Recently, 32 Bit Images with alpha were converted
to DEFINEJPEG3 to work around the alpha problems). (*sigh*, I wish I
still had the PNGs I originally tested this with).

Anyway, thanks for the tip. :)

Greetings

Matthias








reply via email to

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