Rework readPNG.c to work with a more recent libpng

Direct access to the png_info struct is no longer possible.

Also, fixed a bunch of compiler warnings related to:
    * -Wformat
    * -Wpointer-to-int-cast
    * -Wint-to-pointer-cast