[Tux4kids-discuss] Modern libpng in t4k_common

Cheezmeister cheezmeister at gmail.com
Wed Jul 20 05:07:08 UTC 2016


All,

I found a few minutes to play with T4K and ran into a compiler error on 
our use of the `png_info` struct:
http://stackoverflow.com/questions/10507610/libpng-1-5-10-error-dereferencing-pointer-to-incomplete-type

Seems this struct was made internal as of libpng 1.5 (now on 1.6) and 
the "new" way of doing things is in the diff here:

-               info_ptr->width = surf->w;
-               info_ptr->height = surf->h;
-               info_ptr->bit_depth = 8;
-               info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-               info_ptr->interlace_type = 1;
-               info_ptr->valid = 0;    /* will be updated by various 
png_set_FOO() functions */
+                // Set image header
+                png_set_IHDR(png_ptr, info_ptr,
+                    surf->w,
+                    surf->h,
+                    8,
+                    PNG_COLOR_TYPE_RGB_ALPHA,
+                    PNG_INTERLACE_ADAM7,
+                    PNG_COMPRESSION_TYPE_DEFAULT,
+                    PNG_FILTER_TYPE_DEFAULT
+                );

(The PNG API is not generous with its vowels...) That's from 
do_png_save() in t4k_loaders.c. Before I go further I thought I'd toss 
it out to the list and see if there is any reason we should want or need 
to support libpng<1.5?

-B



More information about the Tux4kids-discuss mailing list