cs349 - s10 - Lecture 32

CS349 - Implementing User Interfaces - Spring 2010

Public Service Annoucements

  1. Assignment 4.

Lecture 32 - PostScript

PostScript was created as a `page description language', which means that it was designed to have the ability to put onto the output of a printer anything that the printer can print. `Anything that a printer can print' has an easy definition:

What does this mean?

Once upon a time this was a big deal, but not any more

Actually, it means something much more serious

In practice this is a serious problem for the printer maker

  1. All kinds of `secret' information about your printer has to be made available to the maker of the operating system.
  2. The quality of the operating system implementation determines the quality that users obtain from your printer.

Printer makers promoted a different model

Very attractive feature of this model is

Obviously, there's a `natural monopoly' among competing `printer command languages'.

General principles

Pen-based drawing model: why "drawing model"? why "pen"?

  1. current page (drawing surface)
  2. current coordinate system
  3. current clipping region
  4. current path
  5. current position
  6. current coordinate system
  7. current graphics context
  8. current dictionary

Two distinct coordinate systems

  1. User coordinate system
  2. Device coordinate system

Examples

  1. Draw a square
    newpath
      0 0 moveto
      1 0 lineto
      1 1 lineto
      0 1 lineto
      closepath
      stroke
    showpage

    Comments

  2. Define a filled square
    /square
    { newpath
        0 0 moveto
        1 0 lineto
        1 1 lineto
        0 1 lineto
        closepath
        fill } def
        

    Comments

  3. Draw many squares
    /square
    { newpath
        0 0 moveto
        1 0 lineto
        1 1 lineto
        0 1 lineto
        closepath
        fill } def
    square
    100 100 translate
    square
    100 100 translate
    square
    showpage
        

    Comments

Giving arguments to a procedure

/square 
{ newpath
     0 0 moveto
     1 0 lineto 
     1 1 lineto
     0 1 lineto
     closepath
     fill } def
 /translatedSquare
 { translate
   square } def
0 0 translatedSquare
100 100 translatedSquare
100 100 translatedSquare
    

Comments:

square is executed


Return to: