nanogui: patch for microwindows in wdtv live
Subject:
RE: Re: Re: [nanogui] patch for microwindows in wdtv live
From:
####@####.####
Date:
26 Feb 2010 06:51:38 -0000
Message-Id: <ca41373d5cb243ca8503bc1ceb767ffd@i61800>
Hi, Greg
> o png alpha channel and BGR handling
> There is currently alpha channel support in
> 0.92RC2 that should work. However, there
> isn't support for conversion to BGR format.
> Is this to guarantee quick drawing the
> GdDrawImage routine, or for another reason?
> I would like a sample .png for testing.
image_png.c:GdDecodePNG() has some inconsistent part. ( it works well, but inconsistent. )
In spite of MWIMAGEHDR that returned from image_png.c:GdDecodePNG() has RGB RGB RGB ...,
MWIMAGEHDR's compression field has not MWIMAGE_RGB flag.( only if alpha channel exist.)
I attach modified diff file.
--------------------------------------------------------------------------
Hi, yut616
> [TAO] this png is 24bit, but with "tRNS Transparency"
> This is related to the libpng, just a special case for 24bit png (IHDR Bitdepth: 8 ).
> refer:
> http://www.libpng.org/pub/png/spec/1.1/png-1.1.pdf
> 4.2.12 tRNS Transparency
> According to PNG_EXPAND_tRNS to build in an alpha channel using trans_value.
> When the RGB is same as trans_value's RGB, it will set ALPHA to 0, otherwise it will set 0xFF.
> ======================
> libpng-1.2.14/pngrtran.c
> png_do_expand()
> (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value)
> ======================
I guess that 0.92RC2 do support that.
I think that the following code work for that. ( image_png.c:GdDecodePNG() )
============================================
if (png_get_valid(state, pnginfo, PNG_INFO_tRNS)) // if 'trans_value' exist, then this condition is true.
png_set_tRNS_to_alpha(state);
============================================
But, I am not sure. Can you suggest some sample png?
Regards.
[Content type application/x-gzip not shown. Download]