Download presentation
Presentation is loading. Please wait.
Published byPercival Bates Modified over 9 years ago
1
1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab.
2
2 What is Postscript? Programming language optimized for printing graphics and text Page description Language Introduced by Adobe in 1985 and Currently Version 3.0 Stack-based language
3
3 Syntax of Postscript Postscript commands obtain parameters from the stack. Postfix notation : 32 14 mul Data types such as reals, booleans, arrays and strings. User space resolution : 1 dot = 1 / 72 inch
4
4 Drawing with Postscript 1 Line drawing newpath : empties the current path. x y moveto : moves to the (x,y) position. x y lineto : constructs path from the previous position to the position (x,y). stroke : makes the line visible by stroke showpage : makes the page visible
5
5 Drawing with Postscript 2 Example newpath 144 72 moveto 0 216 rlineto 288 –216 rlineto -288 0 rlineto 10 setlinewidth stroke showpage (0, 0)
6
6 Variables and Procedures Variables and Procedures are declared using / and a name and ended with def. /inch {72 mul} def /grayshade 0 def Procedures have curly braces { } around the body.
7
7 Variables and Procedures Example % draw a 3, 4, 5 triangle /triangle {moveto 0 3 inch rlineto 4 inch 3 inch neg rlineto closepath fill } def
8
8 Transformations 1 Affine transformation –translate : move the origin of the drawing to the (x,y) positions –rotate : rotate the coordinate system by the specified number of degrees. –scale : scale the coordinate system by the x and y scale factors
9
9 Transformations 2 Example 0 inch 1 inch translate 45 rotate 0.5 0.5 scale /grayshade grayshade.2 add def grayshade setgray 0 0 triangle
10
10 Text printing Postscript brings the character information from special typeface files. Times family typeface : Times Roman, Italic and Bold, etc. How to use special font – Find the file of the font description show – Set the font size and print using show
11
11 Text printing 2 Example /Times-Roman findfont 30 scalefont setfont 1 inch 6 inch moveto (Times Roman) show
12
12 Curve Drawing Operators for drawing curevs –arc and arcn : clockwise and anticlock. –5 parameters for arc and arcn (x, y) of center of the arc arc radius the start angle and the end angle
13
13 Loops Loop control operators start incr end { body } for Example 0.95 -0.05 0 {setgray printken 1 0.5 translate} for
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.