MSRI Graphics School - Lecture 1 on PostScript
References
Basic commands
Stopping and starting
-
%! Correct start of every PS file
-
% Comment line
-
showpage Usually the correct end to every page
Building and drawing paths
-
newpath Start of every path
-
* * moveto Starts a path segment
-
* * lineto Continues a path segment
-
stroke Draws a path in the current color
-
fill Fills a path in the current color
-
* * * * * arc Builds an arc in positive direction
-
* * * * * arcn ... negative ...
-
closepath The correct way to end a closed path
Displaying stuff
-
= Displays and removes from stack
-
== Displays more and removes from stack
-
stack Displays the whole stack without removing stuff
Mathematical functions
-
* * add
-
* * sub
-
* * mul
-
* * div
-
* neg
-
* * atan y x
on the stack is replaced by the
angle of the point (x, y)
-
* * exp
-
* cos
-
* sin
Coordinate changes
-
* * scale
-
* * translate
-
* rotate
-
Other graphics state changes
* setlinewidth Sets the current linewidth in
the current units
-
gsave Makes a new copy of the current graphics state
and puts it on the graphics stack
-
grestore Removes the current graphics state
from the graphics stack
-
* setgray Sets the current color to a tone of gray
-
* * * setrgbcolor Sets RGB components
Definitions, local and global
-
/s * def Basic assignment of a value
-
* * exch Exchanges top two elements of the stack
-
/proc { 1 dict begin
/x exch def
... end } def The correct way to obtain local variables
inside a procedure
-
* { ... } repeat Repeats the procedure in between
|