Re: [Sng-devel] sng 1.0.5 vs libpng 1.4
Textualize a PNG image, or turn a textualized image back to a PNG.
Brought to you by:
esr
From: Eric R. <es...@th...> - 2011-06-15 19:13:30
|
James Cloos <cl...@jh...>: > I tried to compile sng from git. I have libpng-1.4.7 installed. > > First, notwithstanding the recent commits, I had to pass > > --with-rgbtxt=/usr/share/X11/rgb.txt > > to get ./configure to complete. > > That is fixed by: > > diff --git a/configure.in b/configure.in > index b78df01..5dd6c4e 100644 > --- a/configure.in > +++ b/configure.in > @@ -44,7 +44,7 @@ if test -n "$with_rgbtxt" > then > AC_DEFINE_UNQUOTED(RGBTXT, "$with_rgbtxt", [Location of X color database]) > else > - for dir in /etc/X11/ /usr/share/X11/rgb.txt /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib > + for dir in /etc/X11/ /usr/share/X11/ /usr/X11R6/lib/X11 /usr/lib/X11 /usr/openwin/lib > do > if test -f ${dir}/rgb.txt > then That change is clearly correct. Taken. On the other hand... > Second, sngd.c fails to compile with 166 deprication warnings (52 unique) > and these errors: > > :; gcc -DHAVE_CONFIG_H -I. -g -MT sngd.o -MD -MP -MF .deps/sngd.Tpo -c -o sngd.o sngd.c 2>&1 |egrep -i error > sngd.c:797:48: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:801:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:802:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:803:15: error: ‘png_info’ has no member named ‘trans_values’ > sngd.c:807:33: error: ‘png_info’ has no member named ‘trans’ > > After reading libpng(3), I see that this patch is required: > > diff --git a/sngd.c b/sngd.c > index 248ac97..888d214 100644 > --- a/sngd.c > +++ b/sngd.c > @@ -794,17 +794,17 @@ static void dump_tRNS(FILE *fpout) > fprintf(fpout, "tRNS {\n"); > switch (info_ptr->color_type) { > case PNG_COLOR_TYPE_GRAY: > - fprintf(fpout, " gray: %u;\n", info_ptr->trans_values.gray); > + fprintf(fpout, " gray: %u;\n", info_ptr->trans_color.gray); > break; > case PNG_COLOR_TYPE_RGB: > fprintf(fpout, " red: %u; green: %u; blue: %u;\n", > - info_ptr->trans_values.red, > - info_ptr->trans_values.green, > - info_ptr->trans_values.blue); > + info_ptr->trans_color.red, > + info_ptr->trans_color.green, > + info_ptr->trans_color.blue); > break; > case PNG_COLOR_TYPE_PALETTE: > for (i = 0; i < info_ptr->num_trans; i++) > - fprintf(fpout, " %u", info_ptr->trans[i]); > + fprintf(fpout, " %u", info_ptr->trans_alpha[i]); > break; > case PNG_COLOR_TYPE_GRAY_ALPHA: > case PNG_COLOR_TYPE_RGB_ALPHA: ...this clearly relates to a libpng API change, and we need to figure out when it happened to conditionalize the code properly. Here's what I see in my png.h: #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_RELEASE 42 What do those constants look like for you? And does the libpng Changelog tell you when the the API break was? What I'm thinking is that I should define TRANS_ALPHA and TRANS_COLOR macros that are conditionally defined by version. -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> |