PGPLOT PNG Driver Patch
Here you will find my PNG driver patch
to PGPLOT.
Important Note
As of PGPLOT version 5.2.1, this PNG driver is included in the normal
distribution. So you do not need the patch here for newer versions
of PGPLOT. However, if you have 5.2.1 or 5.2.2, there is a change to
the makemake in the distribution that will be required. Line
1028 of makemake (in 5.2.2, at least) is the following:
pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h
This line should be commented out before running the makemake script.
Additionally, if you're using the GNU compiler and linker, you may want
to change the output makefile so that the following values are set:
PGPLOT_LIB=-L`pwd` -lpgplot
CPGPLOT_LIB=-L`pwd` -lcpgplot -lpgplot
SHARED_LIB_LIBS= -Wl,-Bstatic -L/usr/X11R6/lib -lX11 -lpng -lz -lg2c -Wl,-Bdynamic
This will cause libpng, libz and libg2c to be statically linked into
libcpgplot, and makes linking of subsequent programs much simpler.
Features
- Normal (/PNG) and transparent-background (/TPNG)
PNG devices available.
- Caller may have as many simultaneous devices open as PGPLOT (eight as
of PGPLOT 5.2.0) will allow.
This is in contrast to other PGPLOT drivers such as Postscript and GIF
which allow only one open device at a time.
Instructions
- Download the PNG driver patch to PGPLOT 5.2.0
here.
- After unpacking the PGPLOT sources, change into the resulting PGPLOT
directory.
- Apply the patch:
$ patch -p1 < ../pgplot-png.diff.3
- While selecting drivers from the drivers.list file,
uncomment /PNG and /TPNG.
- After makemake creates the build makefile, manually
edit it to include the following:
- Add -lz -lpng to LIBS. For example,
#
# Loader library-flags
#
LIBS=-L/usr/X11R6/lib -lX11 -lz -lpng
- Add pndriv.o to DRIVERS. For example,
DRIVERS=gidriv.o nudriv.o ppdriv.o psdriv.o pndriv.o wddriv.o xwdriv.o
- Add a target rule for pndriv.o. For example,
psdriv.o: $(DRVDIR)/psdriv.f
$(FCOMPL) -c $(FFLAGC) $(DRVDIR)/psdriv.f
pndriv.o: $(DRVDIR)/pndriv.c
$(CCOMPL) -c $(CFLAGC) $(DRVDIR)/pndriv.c
- Build PGPLOT as usual.
Notes
- Both zlib
and libpng must be
installed to use this driver. Likewise, all applications using
PGPLOT must be linked with -lz -lpng.
Contact
pratzlaff@cfa.harvard.edu