Re: [AD] Problem loading 24bit PNG graphics when setting colordepth to 8.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I figured out the fix for my problem tonight. 

If I change the following code in loadpng.c (roughly line 209):

if( dest_bpp != bpp )
bmp = _fixup_loaded_bitmap(bmp, pal, dest_bpp);

to:

if( dest_bpp != bpp ){
	pal = NULL;
	bmp = _fixup_loaded_bitmap(bmp, pal, dest_bpp);
}

My PNG images work when running my application in 8bit color depth.
Previously I was getting a garbled display with what appeared to be random
color entries in the palette.

I've also discovered tonight that create_system_bitmap() fails to create any
bitmap on MAC fullscreen when running in 15bit color_depth().  The solution
is to use create_bitmap() when running in fullscreen at 15 bit color depth
on the Mac.  Note, however, that it's slower running at 15bit fullscreen
with create_bitmap() than running at 32bit fullscreen using
create_system_bitmap().


Kirk Black
President / Owner
Family Time! Interactive, L.L.C.
Mobile: 512.771.5762
Email: runesabre@xxxxxxxxxx
-----Original Message-----
From: alleg-developers-bounces@xxxxxxxxxx
[mailto:alleg-developers-bounces@xxxxxxxxxx] On Behalf Of Peter
Wang
Sent: Tuesday, June 13, 2006 3:26 AM
To: alleg-developers@xxxxxxxxxx
Subject: Re: [AD] Problem loading 24bit PNG graphics when setting colordepth
to 8.

On 2006-06-12, Kirk Black <runesabre@xxxxxxxxxx> wrote:
> I have an application that loaded 24bit BMP images and had Allegro color
> convert to 8, 16 or 32 bit as needed at load time using
> set_color_conversion(COLORCONV_TOTAL|COLORCONV_KEEP_TRANS).  
> 
>  
> 
> When I recently converted to using PNG images (and saving all the original
> BMP images to PNG) and using the handy LoadPNG library, only 16 and 32 bit
> color conversions work.  The 8bit color mode gets a messed up palette.
> 
>  
> 
> Is this a known issue with loadpng or using PNG graphics?
> 

Please send a test case, i.e. single .c file and a small .png.
Probably the rest of the list wouldn't appreciate it, so send it to my
email address.

Thanks.
Peter



-- 
https://lists.sourceforge.net/lists/listinfo/alleg-developers





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/