This is a basic PNG decoder I made for educational purposes. I really just wanted to see how involved the process is. I also wanted to make it open to others, so that it might help people who are also curious and might want to try their hands at a decoder. Therefore, parts of the code might be more heavily commented than I otherwise would've made it.
The decoder supports a PNG image that:
- Is in TrueColor.
- Has a RGBA format (That is, each pixel is described by a red, green, and blue value with an additional alpha component).
- Has a bit-depth (The number of bits for each color component) of 8.
- Is not interlaced.
I wrote the software in C++, and made it in an object-oriented style.
I haven't made any kind of fancy Cmake for the project. I've just uploaded the source code. Therefore, you'll need to create your own project with the dependencies (listed below) if you want to compile it. Also, the code is not completely cross-platform friendly. I use a few specific windows functions, however I've tried my best to make it easy to port if you are interested.
I've really only used one external library for this project, which is zlib. I use zlib to for the inflate algorithm, as the image data within a PNG file is decompressed using the zlib format.
You can download the zlib library at: http://www.zlib.net/
I used Visual Studio 2015, running Windows 10 while creating this project. I have not tested it on any other machine.
Here's a quick screenshot of a sprite rendering I did in OpenGL, using my own decoder to load the image data :)
