PNG image viewer for Win32 |
|
Visual C++For a long, long time, PNG developments were mainly driven from the Unix world. To be fair, a couple of the major Windows apps supported PNG from the early beginning. But for developers there was little to start with, like the problematic Win32 support in libpng. However, things have changed for the better. Since version 1.0.7 libpng fully supports MicroSoft Visual-C++, both with static linking to .lib's and dynamic run-time linking of .dll's.VisualPng, a nice simple PNG image viewer, was developed to illustrate how these new libpng features can be used in a normal Win32 project. It is part of the libpng "contrib" distribution. If you just want the VisualPng executable, download it by clicking here. You can use VisualPng as it is now, but most probably you want to use it as a starting point and extend it for your own purposes. First download the VisualPng sources zip-file by (shift-)clicking on the download-icon on the left. Extract the files in the archive into a directory of your own choice, but for the sake of this explanation, lets presume your program will bear the name PingPing, so call your subdirectory <something>/PingPing. Next step is to obtain the libpng archive (version >= 1.0.7) and store that in a sub-directory called ...\PingPing\libpng. Also get zlib and put it in ...\PingPing\zlib. Now rename all the files VisualPng.* into PingPing.* and delete PingPing.dsw. Next, get the PingPing.c, PingPing.rc, and PingPing.dsp files into an editor and search/replace all occurances of VisualPng into PingPing. After this you can start VC++ by double-clicking PingPing.dsp, on which VisualC will (normally) ask if it should create PingPing.dsw: Great idea! The settings of the workspace / project are as required for the libpng contrib distribution. But our directory structure here is different, so before we go any further, there are a couple of settings to change:
When this all went well, sit back and relax, and start thinking about what you would like your PingPing to do. From here you are all on your own, but you don't have to worry about how to read and write you PNG-files. Have a look at PngFile.c, which contains functions for opening, reading and writing the PNG images. For the rest, as Nike says: JDI, or Just Do It !!!
|