1 / 15

Overview

Overview. What is PostScript? Types Language Concepts Control Operators Examples. What is PostScript. page description language : PostScript is a programming language optimized for printing graphics and text It was introduced by Adobe in 1985

morrisa
Download Presentation

Overview

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. Overview • What is PostScript? • Types • Language Concepts • Control Operators • Examples

  2. What is PostScript • page description language : • PostScript is a programming language optimized for printing graphics and text • It was introduced by Adobe in 1985 • The main purpose of PostScript was to provide a convenient language in which to describe images in a device independent manner. This device independence means that the image is described without reference to any specific device features (e.g. printer resolution)

  3. Types • String: • “This is a string” would be written as (This is a string). • Express a string as hexadecimal codes in angle brackets. “ABC” would be expressed as <414243>. • Boolean • Real • Array

  4. Types • Arrays: • One Dimensional • Object of different types in an array • /arrayName [ 12 (Twelve) True] def • /arrayName [ 1 2 4 add] def • /arrayName 10 array • Store and Fetch array elements: put, get • /anArray 10 array def • anArray 8 (language) put • anArray 8 get

  5. Language Concepts • Variable: /varName value def • Path: A path is a collection of (possibly disjoint) line segments and curves arranged on the page. • newpath 144 72 moveto 144 432 linto stroke showpage • Dictionary: is a table that associates pairs of objects <Key, Value> • System Dictionary : operator , action • User Dictionary : /var1Name Value def

  6. Language Concepts • Procedures: • /inch {72 mul} def • Stack: • Graphic Stack • Operand Stack (clear, dup, pop, roll, pstack) • Dictionary Stack • Operator: Every command in PostScript is an operator: add, mul, findfont, moveto ...

  7. Programming in PostScript • Postfix Notation in PostScript : One must first place the operands on stack and then call the operator. • 5+27 5 27 add • 8 –7 * 3 8 7 3 mul sub 7 3 mul 8 exch sub

  8. Control Operators • Conditional: • Comparisons: • Logical Operator: • And , or, not, xor • bool { op } if • bool {op1} {op2} ifelse

  9. Control Operator • Loops: • Repeat: • Iteration { loop_body_expression} repeat • For: • Loop_counter_init_value increment_value {op} for • { op }loop : end with “exit” • AnArray {op} forall

  10. /Times-Italic findfont 30 scalefont setfont /printZip { 0 0 moveto (Zip) show} def 320 400 translate .95 -.05 0 % start incr. end {setgray printZip -1 .5 translate } for 1 setgray printZip showpage

  11. /starside { 72 0 lineto %add line to path currentpoint translate %move origin -144 rotate } def %rotate coord. sys. /star %stack: x y { moveto currentpoint translate 4 {starside} repeat closepath gsave .5 setgray fill grestore stroke } def 200 200 star

  12. Refrences • http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF • http://www.tailrecursive.org/postscript/postscript.html

More Related