Added WITH_PNG option to CMake to find libpng, plus code fixes for libpng16 and MSVC 2012.