Chapters 13, 14 and 15 of PNG: The Definitive Guide discuss three cross-platform demo programs that show how to use the libpng reference library: rpng, rpng2 and wpng. rpng and rpng2 are viewers; the first is a very simple example that that shows how a standard file-viewer might use libpng, while the second is designed to process streaming data and shows how a web browser might be written. wpng is a simple command-line program that reads binary PPM files (the ``raw'' RGB subset of NetPBM) and converts them to PNG.
The source code for all three demo programs currently compiles under Unix, OpenVMS and 32-bit Windows. It has been tested with gcc 2.7.x, 2.8.1 and 2.95.3 under Linux, Solaris, Irix and FreeBSD, and with Microsoft Visual C++ 5.0 under Windows 95, 98 and NT. (OpenVMS modifications and testing were done by Martin Zinser, and FreeBSD testing was done by Miguel Angel Vicente.) Instructions for compiling the programs are included in the README file and are summarized at the top of the makefiles; Makefile.unx is the Unix version, Makefile.w32 is (you guessed it!) the version for 32-bit Windows, and makevms.com is the build script for OpenVMS. libpng and zlib are required; see the libpng home page for links to source code and binaries.
Other than the difference in line endings and packaging, the contents of the two archives are identical. In particular, both archives include both makefiles, but libpng and zlib are not included. (You can find pointers to them on the libpng home page.) If and when the programs are ported to other operating systems, Greg will update the archives with the new ports.
Binaries for Windows, Linux, FreeBSD, Solaris, Irix, and SCO OpenServer are also available, although only the first two are up to date:
Here are half-scale screenshots of all 16 of rpng2's automatically generated background patterns, plus two of its 16 million solid background colors. Three of the individual patterns can be clicked on to see their full-scale versions, and the entire group is available as a 379k full-scale PNG image. The diamond-shaped pattern was created by Adam M. Costello, and the radial/spiral color-bars are courtesy of Pieter S. van der Meulen.
The source code to the demo programs may be used and distributed freely (even if you didn't buy the book--but feel free to do so at any time, if you can still find it...), subject to the terms of either the original BSD-like license or the GNU GPL:
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. The contents of this file are DUAL-LICENSED. You may modify and/or redistribute this software according to the terms of one of the following two licenses (at your option): LICENSE 1 ("BSD-like with advertising clause"): Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
LICENSE 2 (GNU GPL v2 or later): This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Here are the other web pages related to PNG: The Definitive Guide:
Copyright © 1999-2008 Greg Roelofs.