1 / 13

Introduction to PostScript

Introduction to PostScript. Sep. 21 Dae-Eun Hyun 3D MAP Lab. 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. Syntax of Postscript.

sharis
Download Presentation

Introduction to PostScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab.

  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. 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. 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. Example newpath 144 72 moveto 0 216 rlineto 288 –216 rlineto -288 0 rlineto 10 setlinewidth stroke showpage Drawing with Postscript 2 (0, 0)

  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. 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. 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. 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. 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 • Set the font size and print using show

  11. Text printing 2 • Example /Times-Roman findfont 30 scalefont setfont 1 inch 6 inch moveto (Times Roman) show

  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. Loops • Loop control operators start incr end { body } for • Example 0.95 -0.05 0 {setgray printken 1 0.5 translate} for

More Related