COS 426 Computer Graphics - Fall 1997
|
|||||
![]() COS 426 Home ![]() Projects
|
![]() |
![]() PostScript hints (Part of this text was adapted from Appendix 1 of Computer Graphics by Francis Sandy Hill Jr.) ![]() PostScript is a page description language that can be used to drive many graphics devices in use today. It is particularly effective for laser printers, many of which contain a microprocessor-based interpreter that can receive and translate PostScript commands into patterns of ink. ![]() ![]() ![]() ![]() ![]() ![]() To do this, we have to setup a transformation that maps points on the screen coordinate system to the paper coordinate system. The first thing to do is to scale the coordinates in x by 1.125 (10 in = 720 pts, and 720 / 640 = 1.125). Accidentally, we have to scale the coordinates in y by the same factor (7 1/2 in = 540 pts, and 540 / 480 = 1.125). If the factors in x and y were different, we would have to scale both in x and y by the smaller factor, to avoid aspect ratio distortion. Then we have to rotate the coordinates by 90 degrees to print in landscape orientation, and translate the origin of the coordinate system to the lower right corner of the paper. All these transformations can be done with the following PostScript code. ![]() 576 36 translate 90 rotate 1.125 dup scale ![]() ![]() ![]() 0 0 moveto 639 479 lineto ![]() ![]() ![]() %!PS-Adobe-1.0 ![]() and finishes with ![]() stroke showpage ![]() ![]() ![]() %!PS-Adobe-1.0 576 36 translate 90 rotate 1.125 dup scale 0 0 moveto 639 479 lineto stroke showpage ![]() ![]() To learn more about PostScript and how to print more complex shapes, you might want to take a look at PostScript Language: Tutorial and Cookbook by Adobe Systems Incorporated. There is also plenty of on-line information about PostScript. |
![]() |
||
|
|||||
Last update: Sun Nov 30 18:09:15 EST 1997 |