Overview
Download
1 / 15

Overview - PowerPoint PPT Presentation


  • 94 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Overview' - morrisa


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Overview l.jpg
Overview

  • What is PostScript?

  • Types

  • Language Concepts

  • Control Operators

  • Examples


What is postscript l.jpg
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)


Types l.jpg
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


Types4 l.jpg
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


Language concepts l.jpg
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


Language concepts6 l.jpg
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 ...


Programming in postscript l.jpg
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


Control operators l.jpg
Control Operators

  • Conditional:

    • Comparisons:

    • Logical Operator:

      • And , or, not, xor

  • bool { op } if

  • bool {op1} {op2} ifelse


Control operator l.jpg
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


Slide10 l.jpg

/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


Slide12 l.jpg

/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


Refrences l.jpg
Refrences

  • http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF

  • http://www.tailrecursive.org/postscript/postscript.html


ad