This "getting started" guide tells you just enough to install Pan on your computer and get started making your own image effects. The Functional Images paper goes into more detail, though the notation is not precise. Pan's central principle is that images are functions from (continuous & infinite) 2D space to colors (with partial opacity). Images are not bitmaps (finite, discrete and rectangular), but may be reconstructed from bitmaps and rendered into bitmaps. Since images are functions, a functional language, and Haskell in particular, makes for a natural host language. Here's are brief Pan language tutorial. Pan is implemented as an optimizing compiler, generating C++ code, which is then compiled with a C++ compiler. The Compiling Embedded Languages paper describes the ideas behind this implementation. Currently, the only C++ compiler we support is Microsoft Visual C++ (MSVC). If you add support for another, please let us know. You will need to augment some of your environment variables, as follows, where "<msvc>" refers to your MSVC installation. (To change your environment variables in Win2000 go to Control Panel, Start/Settings/Control Panel/System/Advanced/Environment. Similarly in WinNT. For Win9x, modify your autoexec.bat.)
It shouldn't be very hard to support compilers other than MSVC. Less straightforward, but also doable would be to target platforms other than Windows. We strongly invite such additions to the implementation. You can get the full release here. Compile some Pan demos
The Pan distribution contains many other examples in the DemoSrc directory. Simple.hs is a good place to start. It contains a few simple examples, including ripple, shown above. In addition to defining the examples, each demo module ends by defining a command "makeAll", which compiles all of the module's examples for all of the backends, and "makeAllFor", which compiles all examples for a given list of backends. Compiler variationsThe Pan compiler handles several different types of image effects:
where ImageC = Image ColorE. For each of these effect types, there is a corresponding compiler entry point:
The ToColor type class contains types that can be converted to color. Currently Pan provides instances for types ColorE, BoolE (black&white), and FloatE (really [0,1] for greyscale). You can add more instances. There are also four compiler backends, producing binaries suitable for different settings:
We recommend using the "component" backend. Each of the compiler entry points listed above (compileImage, etc) runs all four backends, but there are variations for selecting just the desired backend subset.
So, for example, to generate just a PhotoShop filter for our ripple example, type the following at the Hugs prompt.
Compiled demos are stored in the subdirectories of <installdir>/demos, called standalone, component, control, dxt, plugins. Making your own effectsWe do not yet have a manual on the Pan library/language, but here's a tutorial. See the papers also. Conal Elliott
|