Graphics
Transformations With Postscript
In this tutorial, we will preform multiple transformations on graphics. A text editor will be used to write postscript (notepad is sufficient). GSview will also be used to view our files. How Transformations Work So far we have done all our PostScript
programming using the Default User Coordinate System. Today we will
be applying transformations to the coordinate system. These transformations
effect everything we do from the time we apply them. translate changes
the position of the coordinate system rotate rotates
the coordinate system by degrees scale compresses
or expands the x and/or y axis gsave saves
state grestore restores
state First lets set the font and create a procedure that will print something out:
Now we will use a repeat loop to show the application of the translation: 8Now move to 0,0 and try to print something and see where is ends up. Rotate Try the following rotation Scale Scale changes the coodinates where you are working as well as the
size of what you are working with. 0 0 moveto Putting It All Together The three transformation function can be powerful graphically when combined. Especially when used in combination with gsave and grestore. Lets try a simple combination.
Now lets create a couple of related procedures to use: /ps2But if we use them as they are, the state of the coordinate system will just pick up where it left off and we will just be printing out very tiny letters. So, we need to insert gsave and grestore command at the appropriate places: %! Try this code out! |
||||||||||||||||||||||||
The
PostScript Tutorial Concieved and Created by Dann Ormond & Will Munn.
Inspired by Mike Grady PhD. Website Design by NiftySites.com. |