README file for png, a Dylan app that creates a png file. DESCRIPTION =========== This is a toy application that creates a 100 pixel by 100 pixel image (in PPM or Portable Pixmap format) and then writes that image out as a .png file. This app also includes several (very) primitive drawing functions, such as draw-line, draw-filled-rectangle and draw-empty- rectangle. It also includes an example (at the bottom of png.dylan) that draws 10 lines and 3 rectangles in various colors. BACKGROUND ========== I've been aching for some kind of platform-independent graphic facility for Dylan for quite some time. After the dust had settled from the ICFP-2000, I took a look at some of the images there ... Ah, the Go game (http://caml.inria.fr/icfp00-contest/): to die for! I read that the images were processed from GML to PPM (http://www.cs.cornell.edu/icfp/). Hm! The Dylan Hacker entry output PPM, but my browser choked on it. As I had been dabbling with libpng, I went back to its documentation and found what a wanted: a ppm to png converter. That was all I needed to get started, and the result was this app: a producer of pieces of modern art for the discriminating collector. REQUIREMENTS ============ This app relies on wpng to do the conversion from PPM to .png format. Wpng (Write PNG) is an example program that demonstrates the capabilities of libpng, so you must also download and install libpng and zlib (as libpng depends on zlib). Wpng is available at http://www.libpng.org/pub/png/book/sources.html, and you may follow the links from that page to obtain libpng and zlib. You must have wpng built and on the PATH for this app to work. INSTALLATION ============ $ gzip -cd png.tar.gz | tar xvf - $ cd png $ make $ make run The last command will generate a j-random image and save it as modern.png for your viewing pleasure. TODO ==== * Add other kinds of drawing functions? Circles? Ellipses? * draw-line seems buggy ... or is it my browser? * As you can see from the source, this app simple calls wpng using system. What an inelegant approach! A better way would be to use libpng directly to convert a PPM matrix residing in memory to a .png file. ... Since I'm not volunteering to write Dylan wrappers around libpng (which uses callbacks here and there), nor am I familiar enough with libpng to convert an image in memory to png, this work is crying out for some other stout and strong-of- heart volunteer to carry on. * Once this baby is cleaned up and matured a bit, incorporate it into the cgi-lib. ISSUES ====== Hey, this is a prototype! Mine the sources for ideas, but (as they say in Java-speak) don't run a Nuclear reactor with it, okay? Questions? Problems? Wish-lists? Email me at dauclair@hotmail.com. Doug Auclair