It looks like when building VTK against the system libpng >= 1.4, it's still trying to use the old 1.3 API for png_set_gray_1_2_4_to_8.<br><br>I propose the following patch deal with this accordingly. Comments, criticisms?<br>
<br>- Chuck<br><br><span style="font-family: courier new,monospace;">From 110f26909454b8b51672fb246b992e93cd723276 Mon Sep 17 00:00:00 2001</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">From: Chuck Atkins <<a href="mailto:chuck.atkins@kitware.com">chuck.atkins@kitware.com</a>></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Date: Wed, 21 Apr 2010 13:59:49 -0400</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Subject: [PATCH] ENH: Accommodate libpng API change from 1.3 -> 1.4</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">A macro was added to replace calls to png_set_gray_1_2_4_to_8 with calls to</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">png_set_expand_gray_1_2_4_to_8 as per the API change in libpng 1.3 -> libpng</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1.4. The macro preserves backwards compatibility with 1.3 and should only</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">take effect when using the system libpng instead of the included libpng.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">---</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> IO/vtkPNGReader.cxx | 9 +++++++++</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 1 files changed, 9 insertions(+), 0 deletions(-)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">diff --git a/IO/vtkPNGReader.cxx b/IO/vtkPNGReader.cxx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">index 9ef592c..465b007 100644</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--- a/IO/vtkPNGReader.cxx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+++ b/IO/vtkPNGReader.cxx</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -20,6 +20,15 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #include "vtkPointData.h"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> #include "vtk_png.h"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+// If the system libpng is newer than 1.3 then adjust the set_gray call</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+// to conform to the new API</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+#if !defined(png_set_gray_1_2_4_to_8) && \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ defined(PNG_LIBPNG_VER_MAJOR) && defined(PNG_LIBPNG_VER_MINOR) && \</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (PNG_LIBPNG_VER_MAJOR > 1 || \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+#define png_set_gray_1_2_4_to_8 png_set_expand_gray_1_2_4_to_8</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+#endif</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkCxxRevisionMacro(vtkPNGReader, "1.27");</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> vtkStandardNewMacro(vtkPNGReader);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1.7.0.5</span><br style="font-family: courier new,monospace;">
<br>