180 likes | 388 Views
Introduction . PostScript is known as a page description" programming language. ? it is commonly used to specify how a page should be printed.An important feature of PostScript: -. Its device independence.The usual way to work with PostScript is to use a text processor to fashion a Post
E N D
1. Appendixes4. An Introduction to PostScript® CVG Lab
2. Introduction PostScript® is known as a “page description” programming language.
? it is commonly used to specify how a page should be printed.
An important feature of PostScript:
-. Its device independence.
The usual way to work with PostScript is to use a text processor to fashion a PostScript, and then to submit the file to a PostScript printer.
-. The printer can be set to interpret the script and make a picture rather than simply print the script as text.
3. Introduction Ghostscript
-. Provide a convenient alternative.
-. Freely available and operates on a variety of PC and workstation platforms.
-. Interprets a PostScript script
-. Displays the picture on the PC monitor.
-. Can make debugging a script much easier ? immediately see the results of a script
4. About the PostScript Language Scripts in PostScript are readable by humans
Some Preliminares
Different character appearing in a sript take on different meanings.
-. Comments. All characters from ‘%’ to the end of the current line are comments and are ignored by the interpreter.
-. Case. Case is significant.
-. White space. Characters such as spaces, tabs, or newlines leave spaces on the script page, and are collectively called “white space.”
5. About the PostScript Language Numbers in PostScript
-. Numbers are written in the usual way, either with or without a decimal point.
PostScript Is “Stack based”
-. PostScript is similar to the language Forth in that it maintains a stack of objects called the operand stack.
6. About the PostScript Language
7. More Advanced Stack Operators
-. n index
counts down n items into the stack, and pushes a copy of the nth item on to the stack:
34 12 94 2 index ? 34 12 93 34
6 0 index ? 6 6 % same as dup
-. n copy
n copy pops the n and then pushes a copy of the top n elements of the stack:
12 6 2 copy ? 12 6 12 6
12 95 23 3 copy ? 12 95 23 12 95 23
About the PostScript Language
8. About the PostScript Language -. num shifts roll
num shifts roll pops shifts and num, and then does a circular shift of the top num elements shifts times
-3 144 78 3 1 roll ? 78 -3 144
-3 144 78 3 -1 roll ? 144 78 -3
23 12 -3 144 4 -2 roll ? 23 144 78 12 -3
-. count
count the number of items on the stack and pushes that value onto the stack.
12 35 121 count ? 12 35 121 3
9. Some Arithmetic Operators
-. Add: -5.2 12 add ? 6.8
-. subtract: - 5.2 12 sub ? -17.2
-. Multiply: -5.2 12 mul ? -62.4
-. Division: -27 8 div? -3.375
-. Integer Division: -27 8 idiv? -3
-. Modulo: 178 34 25 7 mod ? 178 34 4
178 18 2547 10 mod ? 178 18 7
-. and, or, exclusive or, complement (&, |, ^, and !)
-. abs, neg, floor, ceiling, truncate, round, sqrt, ln, log, cos, sin exp, atan
Random-number Generation About the PostScript Language
10. Graphics Operators in PostScript PostScript has operators that make it easy to draw lines, circles, Bezier curves, and many other figures.
Coordinate Systems and Transformations
11. Graphics Operators in PostScript Path Construction Verbs
-. Move to pops the top two items off of the stack and set the CP accordingly
x y moveto ? —
12. Graphics Operators in PostScript Arcs of Circles
-. Acrs of circles are drawn in PostScript by using one of the two verbs arc and acrn.
center.x center.y rad start_angle end_angle arc ? —
center.x center.y rad start_angle end_angle arcn ? —
13. Graphics Operators in PostScript Used for Painting Verbs
-. stroke
-. fill
-. setlinewidth
-. setgray
-. setrgbcolor
-. clip
-. setlinecap
-. setlinejoin
14. Graphics Operators in PostScript Coordinate Transformations
15. Automatic dodging-and burning
Bringing “up” selected dark regions or bringing “down” selected light regions to avoid loss of detail.
Dodging-and-burning is typically applied over an entire region bounded by large contrasts.
-. Chose a center-surround function derived from Blommaert’s model for brightness perception.
-. This function is constructed using circularly symmetric Gaussian profiles of the form: Algorithm
16. Algorithm
17. -. The center-surround function defined by; Algorithm
18. The luminance of a dark pixel in a relatively bright region will satisfy L<V1, so this operator will decrease the display luminance Ld, thereby increasing the contrast at that pixel. “dodging”
A pixel in a relatively dark region sill be compressed less. “burned” Algorithm