Functional PostScript Tutorial
We will start by explaining the two basic objects in FPS: paths and pictures. Paths are abstract constructs of geometric points and lines Pictures are ink on paper. Together they are the two basic steps to drawing in FPS. First you lay out the paths, then you paint the paths to get a picture.
Paths are like stencils. A stencil is not a picture, but you can make many different pictures out of one stencil. Imagine you have a stencil of a goldfish, you can trace it with a red chalk or you can spray it with green spraypaint. Different tools and colors produce different pictures of the same goldfish path.
Here's a simple triangular path:
(define triangle-path (line (pt 0 0) (pt 100 100) (pt 200 0) (pt 0 0)))Now we make a picture by stroking, or painting along the path:
(define triangle-picture (stroke triangle-path))Every path and picture has a starting point, and ending point, and bounding box.
(start-pt <path | picture>) -> pt (end-pt <path | picture>) -> pt (bounding-box <path | picture>) -> bboxYou will find these information to be very useful when you are tranforming and composing objects.
Now we have a picture of a triangle, but how do we view it? We will explain picture showing in the next section. Please see the reference manual for documentation on other path and picture makers.
An important about points in FPS: a point equals to 1/72 inch. Therefore (line (pt 0 0) (pt 0 72)) gives you a one-inch long vertical line.
Related procedures in this section:
point - pt, pt:x, pt:y
basic path makers - line, rect, arc, tangent-arc, curve, close-path
picture makers - stroke, fill
start-pt, end-pt,
bounding-box, bounding-box:max, bounding-box:min
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