Table of Contents
2. Core Concepts
2.1. Stack Operations
PostScript uses a stack for all data manipulation. Understanding stack operations is fundamental:
% Push values
10 20 30
% Duplicate top
dup % Stack: 10 20 30 30
% Exchange top two
exch % Stack: 10 20 30 30
% Remove top
pop % Stack: 10 20 30
See Stack Manipulation Commands for complete reference.
2.2. Coordinate Systems
PostScript uses two coordinate systems:
User Space: Your drawing coordinates Device Space: Physical device pixels
% Default: 72 units = 1 inch
100 200 moveto % 100/72 inch right, 200/72 inch up
Transform user space with:
* translate - Move origin
* scale - Change unit size
* rotate - Rotate axes
2.3. Graphics State
The graphics state stores rendering parameters:
gsave % Save state
1 setlinewidth % Change line width
0.5 setgray % Change color
stroke % Draw
grestore % Restore state
3. Common Patterns
4. See Also
-
Command Reference - All operators
-
Advanced Usage - Advanced techniques
-
Examples - Code samples