Table of Contents
1. Path Construction
Commands for building vector paths in PostScript. Paths are the fundamental building blocks for all graphics operations - they define shapes that can then be filled, stroked, or used for clipping.
2. Overview
Path construction in PostScript follows a three-step process:
-
Construct - Build the path using moveto, lineto, curveto, arc, etc.
-
Paint - Apply fill, stroke, or clip operations
-
Reset - Use newpath to start fresh
4. Common Patterns
4.3. Rounded Rectangle
/roundrect { % x y width height radius
/r exch def
/h exch def
/w exch def
/y exch def
/x exch def
newpath
x r add y moveto
x w add y x w add y h add r arcto 4 { pop } repeat
x w add y h add x y h add r arcto 4 { pop } repeat
x y h add x y r arcto 4 { pop } repeat
x y x w add y r arcto 4 { pop } repeat
closepath
} def
50 50 200 100 10 roundrect
5. See Also
-
Painting - Fill and stroke paths
-
Graphics State - Line parameters
-
Transformations - Coordinate systems