wwlisp2dimage Reference Manual

Version 1.2 - November 2008


What is wwlisp2dimage? wwlisp2dimage is a library which adds to wwlisp the capability to create image objects and to draw lines, shapes or other images on them. The GD library is used as base for the image manipulation functions and the existence of a GUI on the computer is not needed. The wwlisp2dimage and GD libraries are well suited to work for example on a server. Several classes are added to the native wwlisp class hierarchy, the most important being gdimage. Besides the image handling capabilities provided by the GD library to the gdimage class, the most frequently used Turtle Graphics functions of the Logo language have been transplanted to the gdimage class. With them, the programmer can draw very quickly geometrically defined shapes which can be repeated, rotated or moved according to arguments or formulas. The resulting image can then be exported to a file, sent to the ouput of a web server, or displayed directly from memory as an image widget thanks to a GUI add-on library to wwlisp (see wwlispkdialog). Finally, this library can evolve to contain more classes and more options to better express the capabilities of the GD library or to add new functionnalities, but this depends mostly on you, the Users! Give me a feedback, your critics, your suggestions and maybe we could make this humble tool quite useful for the community.
Index of The Classes and Classless Functions
The class definitions describe the methods specific to each class. In each class, all the methods defined in its ancestor classes are also callable, but they are not repeated in the documentation.

How to Load the Library

Simple Explanation

Do (use "2dimage") to load and initialize the library.

Detailed Explanation

wwlisp must be installed as well as the wwlisp2dimage library. Usually, they are installed in /usr/local/bin. The library is a standard Linux shared object which must be loaded in the wwlisp process by calling the dlopen system call. This is done by the wwlisp library class constructor. Once the library has been loaded in the process and a library object has been returned to wwlisp, the new functions and classes contained in the library must still be linked to the global environment of the calling wwlisp thread. This is done by using the foreign function interface and calling an initialization function of the library. Then only all the classes, methods and classless functions are available to the user, as native compiled functions. Actually the procedure is quite simple, just start the wwlisp interpreter and then evaluate the following forms:
(setq gdlib(make-instance library "/usr/local/bin/wwlisp2dimage"))
(call gdlib "int initialize()")

If you intend to spawn threads in your application, initialize first the library and then only start other threads. This garantees that the library is loaded and initialized only once and avoids unexpected results.

Snapshots

A Demo Drawing

The following snapshot shows a PNG image generated randomly and displayed as a label in a dialog scripted with wwlispkdialog.



Updated 1 July 2008 Copyright © 2008 Walther Waeles

SourceForge.net Logo