1 introduction to postscript sep. 21 dae-eun hyun 3d map lab
DESCRIPTION
3 Syntax of Postscript Postscript commands obtain parameters from the stack. Postfix notation : mul Data types such as reals, booleans, arrays and strings. User space resolution : 1 dot = 1 / 72 inchTRANSCRIPT
![Page 1: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/1.jpg)
1
Introduction to Introduction to PostScriptPostScript
Sep. 21 Dae-Eun Hyun
3D MAP Lab.
![Page 2: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/2.jpg)
2
What is Postscript?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
![Page 3: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/3.jpg)
3
Syntax of PostscriptSyntax of Postscript• Postscript commands obtain parameters
from the stack.• Postfix notation : 32 14 mul• Data types such as reals, booleans, arra
ys and strings.• User space resolution :
1 dot = 1 / 72 inch
![Page 4: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/4.jpg)
4
Drawing with Postscript Drawing with Postscript 11
• Line drawingnewpath : empties the current path.
x y moveto : moves to the (x,y) position. x y lineto : constructs path from the previ
ous position to the position (x,y). stroke : makes the line visible by stroke showpage : makes the page visible
![Page 5: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/5.jpg)
5
Drawing with Postscript Drawing with Postscript 22
• Example newpath 144 72 moveto 0 216 rlineto 288 –216 rlineto -288 0 rlineto 10 setlinewidth stroke showpage (0, 0)(0, 0)
![Page 6: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/6.jpg)
6
Variables and Variables and ProceduresProcedures
• 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.
![Page 7: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/7.jpg)
7
Variables and Variables and ProceduresProcedures
• Example % draw a 3, 4, 5 triangle /triangle { moveto
0 3 inch rlineto4 inch 3 inch neg rlinetoclosepathfill
} def
![Page 8: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/8.jpg)
8
Transformations 1Transformations 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
![Page 9: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/9.jpg)
9
Transformations 2Transformations 2
• Example 0 inch 1 inch translate 45 rotate 0.5 0.5 scale /grayshade grayshade .2 add def grayshade setgray 0 0 triangle
![Page 10: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/10.jpg)
10
Text printingText 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– Set the font size and print using showshow
![Page 11: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/11.jpg)
11
Text printing 2Text printing 2• Example
/Times-Roman findfont30 scalefontsetfont1 inch 6 inch moveto
(Times Roman) show
![Page 12: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/12.jpg)
12
Curve DrawingCurve 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
![Page 13: 1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab](https://reader036.vdocument.in/reader036/viewer/2022082621/5a4d1b5c7f8b9ab0599ab4ba/html5/thumbnails/13.jpg)
13
LoopsLoops
• Loop control operatorsstart incr end
{ body } for• Example
0.95 -0.05 0 {setgray printken 1 0.5 translate} for