Functional PostScript Tutorial

Functional PostScript Tutorial


Show and Channels

How does FPS produce viewable graphics from the Scheme interpreter? FPS renders graphics through objects called channels. A channel is an instance of a particular backend that knows how to turn FPS pictures into PostScript graphics. In this particular implementation, a PostScript Level 2 text backend is provided. This backend produces PostScript Level 2 text which can be saved in a file and sent to your printer or viewed with ghostview.

In the future there will be other backends to GhostScript and Display PostScript so that you can render directly on your screen. Here we create a channel which will send its output to the file named "test.ps":

	(define test-channel (ps2-text-channel "test.ps"))
Now we can render our picture of the triangle:

	(show test-channel triangle-picture)
There can be multiple show to a channel. Each show will render on a new page. When you are done showing, you must close the channel when you are done to flush all the output to the file and for cleanup.

	(close-channel test-channel)
There exists a short-hand which allows you show a single picture. Here's how we can use it to render the triangle-picture:

	(show-w/ps2-text-channel "test.ps" triangle-picture)
show-w/ps2-text-channel automatically creates the channel, calls show on the channel and picture, and then close the channel.

Related procedures in this section:
ps2-text-channel
close-channel
show-w/ps2-text-channel

FPS Home | Prev Section | Next Section

FPS Tutorial Content: Intro and The Idea | Getting Started | Paths and Pictures | Show and Channels | Transformation | Composition | Glyphpaths | Style | Color | Colormap | Clipping | Glyphnames | Other Topics