Functional PostScript Tutorial

Functional PostScript Tutorial


Composition

You can compose paths and pictures together so that you can manipuate them as one big(ger) object. Here's an example:

	(compose triangle-picture
		 translated-triangle-picture)
compose collects the two pictures together to make a composition. When you call show on the composition, the pictures are rendered in sequence: triangle-picture is rendered, and then translated- triangle-picture is drawn right over it. The rendering sequence does not matter in this example since the two triangle pictures do not overlap, but if you have two overlapping pictures that are painted in different colors, you will have to think about the order in which you compose them together.

Please see the reference manual for details on other composition procedures such as join and link.

By simply knowing how to create lines and how to transform/compose them, you can already draw very complicated pictures. Many amazing fractals require no more than transforming and composing straight line segments together. See the the fractal and fractal-arrow programs in fps-examples.scm for more extended examples.

Related procedures in this section:
compose, join, link

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