Docsity

PostScript Quick Reference: Graphics and Operators - Prof. Curtis E. Dyreson, Study notes of Programming Languages

Toggle sidebar
bg1
1
PostScript Quick Reference v2.0
Numercal operators
num1 num2add sum num1 + num2
num1 num2sub difference num1 - num2
num1 num2mul product num1 * num2
num1 num2div quotient num1 / num2
Stack operators
any pop - discard top element
any1 any2exch any2 any1exchange top two elements
any dup any any duplicate top element
Graphics state operators
-gsave - save graphics state
-grestore - restore graphics state
num setlinewidth - set current line width
num setlinecap - set shape of line ends
(0=butt, 1=round, 2=square)
num setlinejoin - set type of corners
(0=miter, 1=round, 2=bevel)
num setgray - set color to gray value
(0=black to 1=white)
Coordinate system operators
tx ty translate - translate user space
sx sy scale - scale user space
angle rotate - rotate user space
Path construction operators
x y moveto - set current point
dx dy rmoveto - relative moveto
x y lineto - append straight line
dx dy rlineto - relative lineto
x y r ang1 ang2arc - counterclockwise arc
-newpath - initialize path to empty
-closepath - connect subpath to starting point
string bool charpath - append character outline to path
-currentpoint x y return current point coordinate
pf2

Partial preview of the text

Download PostScript Quick Reference: Graphics and Operators - Prof. Curtis E. Dyreson and more Study notes Programming Languages in PDF only on Docsity!

PostScript Quick Reference v2.

Numercal operators

num 1 num 2 add sum num 1 + num 2 num 1 num 2 sub difference num 1 - num 2 num 1 num 2 mul product num 1 * num 2 num 1 num 2 div quotient num 1 / num 2

Stack operators

any pop - discard top element any 1 any 2 exch any 2 any 1 exchange top two elements any dup any any duplicate top element

Graphics state operators

  • gsave - save graphics state
  • grestore - restore graphics state num setlinewidth - set current line width num setlinecap - set shape of line ends (0=butt, 1=round, 2=square) num setlinejoin - set type of corners (0=miter, 1=round, 2=bevel) num setgray - set color to gray value (0=black to 1=white)

Coordinate system operators

tx ty translate - translate user space sx sy scale - scale user space angle rotate - rotate user space

Path construction operators

x y moveto - set current point dx dy rmoveto - relative moveto x y lineto - append straight line dx dy rlineto - relative lineto x y r ang 1 ang 2 arc - counterclockwise arc

  • newpath - initialize path to empty
  • closepath - connect subpath to starting point string bool charpath - append character outline to path
  • currentpoint x y return current point coordinate

Painting operators

  • stroke - draw line along current path
  • fill - fill path with current color
  • erasepage - paint current page white

Device setup and output operators

  • showpage - output and reset current page
  • copypage - output current page

Character and font operators

key findfont font return font dict font scale scalefont font' scale font to produce new font' font setfont - set font dictionary string show - print characters of string

Control operators

init incr lim proc for - execute proc with values from init by steps of incr to lim int proc repeat - repeat proc int times