Postscript: Difference between revisions
imported>Dmitrii Kouznetsov |
imported>Bruce M. Tindall mNo edit summary |
||
Line 1: | Line 1: | ||
{{subpages}} | |||
'''PostScript (PS)''' is a programming language designed for description of two-dimentional objects for visual observation by humans, characterized in that, that, in order to avoid the use of the group operation (parenthesis), the command (operator), in general, appears after the operands. | '''PostScript (PS)''' is a programming language designed for description of two-dimentional objects for visual observation by humans, characterized in that, that, in order to avoid the use of the group operation (parenthesis), the command (operator), in general, appears after the operands. | ||
PostScript is standard format for presentation of illustrations at the electronic submission of figures for the publication is the [[scientific journal]]s. | PostScript is standard format for presentation of illustrations at the electronic submission of figures for the publication is the [[scientific journal]]s. |
Revision as of 13:12, 7 February 2009
PostScript (PS) is a programming language designed for description of two-dimentional objects for visual observation by humans, characterized in that, that, in order to avoid the use of the group operation (parenthesis), the command (operator), in general, appears after the operands. PostScript is standard format for presentation of illustrations at the electronic submission of figures for the publication is the scientific journals.
The coordinate system
Originally, the postscript uses the default Cartesian coordinate system. The image is supposed to occupy the rectangle 8.5 inch by 11 inch, called also letter size. The left lower corner has coordinates (0,0). The upper right corner has coordinates (612, 792).
The extension of the postscript allows the change the size of the image, at least, while each size of the image does not exceed the default size. The corresponding format is called EPS, which means Encalsulated Post Script. In particular the EPS format is used in the small examples below, which has no need to occupy the whole page. Usually, the image encoded in the EPS format, has name *.eps or *.EPS . Usually, the EPS format and the size of the image are indicated with two lines at the beginning of the file:
%!PS-Adobe-2.0 EPSF-2.0 %%BoundingBox:
The first line indicates, that the default frame is sugnect to change.
The second line indicates that the region with coordinates satisfying
,
should be displayed.
Values should be substituted instead of variables for the execution.
Usually, , but some advanced software recognizes also positeve and sometimes even negative values of these parameters. At or , view of the image depends on the software used to interpret the EPS file; this can be used to reduce the portability of the image, allowing the viewing only with some specific software.
Vector representation of figures
Typically, the postscript uses the analytical description of figiure with simple objects (straight lines, circles and arcs of circles and ellipses, ploigons); similar representation is used also for letters. This allows the compact description of data and the strong (sometimes, orders of magintude) zooming-in, keeping the camera-ready quality of the figure. Some images allow efficient representation through the EPS format. For example, the code below reproduces the famous painting Black Square [1][2] by Kazimir Malevich (originally implemented with oil on canvas):
%!PS-Adobe-2.0 EPSF-2.0 %%BoundingBox: 0 0 100 100 /M {moveto} bind def /L {lineto} bind def /C {closepath} bind def /F {fill} bind def /RGB {setrgbcolor} bind def .96 .94 .85 RGB 0 0 M 100 0 L 100 100 L 0 100 L C F 0 0 0 RGB 10 10 M 90 10 L 90 90 L 10 90 L C F showpage %%Trailer
Roster representation of data
The bitmap representation of data is also supported, although for the roster representation, the advantages of the postscript are not so obvious. The sintax of postscript allows to generate the simple images with few lines, for example, the code
!PS-Adobe-2.0 EPSF-2.0 %%BoundingBox: 0 0 62 122 100 100 scale .1 .1 translate 4 4 1 [8 0 0 8 0 0] {<5a6a>} image .0 .6 translate 4 4 1 [8 0 0 8 0 0] {<5a5a>} image showpage %%Trailer
generates the figure shown at right. In the code above, the line with sequence "5a5a" produces the two vertical sticks at the top of the image.
The more complicated example with description can be found at [3].
Basic elements of the image
In Postscripts, the basic elements are lines and arcs.
Painting of circles
The painting Black Circle can be generated with code
%!PS-Adobe-2.0 EPSF-2.0 %%BoundingBox: 0 0 100 104 /M {moveto} bind def /L {lineto} bind def /S {stroke} bind def /C {closepath} bind def /F {fill} bind def /RGB {setrgbcolor} bind def .95 .9 .8 RGB 0 0 M 100 0 L 100 104 L 0 104 L C F 0 0 0 RGB 60 64 40 0 360 arc C F showpage %%Trailer
This code uses the command arc, that has following parameters: two coordimates of the center, radius, initial polar angle measured in degrees and final polar angle, measured in degrees. In this notation, one degree corresponfs to ; In particular, the pair of polar angles 0,360 produces the circle. As usually in Postscript, the operands of the operator are separated with spacebares, and the name of the operator is typed after the operands.
Drawing of lines
Even few lines can produce a product of art. For example, the reproduction (see the figure) of the painting Supermatizm by K.Malevich can be generated with the EPS code below:
%!PS-Adobe-2.0 EPSF-2.0 %%BoundingBox: 0 0 100 120 /M {moveto} bind def /L {lineto} bind def /S {stroke} bind def /C {closepath} bind def /F {fill} bind def /RGB {setrgbcolor} bind def .96 .94 .85 RGB 0 0 M 120 0 L 100 120 L 0 120 L C F 33 setlinewidth .6 .16 0 RGB 51 0 M 48 121 L S 0 0 0 RGB .01 72 M 100 72 L S showpage %%Trailer
Use of postscript
The postscript figures can be included in to the LaTeX texts. One writes the command
\usepackage{graphicz}
at the top of the latex soure; then, the command
\includegraphic{filename}
includes postscript (or PDF) version of the image into the printed version of the document.
Several manuals on the postscript are available online; they allows to use the postsctipt without any preliminary learning. [4]
In some cases, (for example, at work with Latex and DVI files) the postscript figures can be used directly; for other applications, for example, to include an image to a webpage, the postscript file should be converted to jpg or other acceptable format. In particular, the reproductions of the pintings by Malevich above were converted from EPS to jpg before the uploading.
External sources
http://en.wikipedia.org/wiki/PostScript
References
- ↑ Kazimir Malevich. Black Square. Russian Paintings, http://www.russianpaintings.net/doc.vphp?id=126
- ↑ AP Worldstream. Russian government to buy famous "Black Square" for dlrs 1 million. High Beam Research, April 26, 2002; http://www.highbeam.com/doc/1P1-52631971.html
- ↑ Example of the roster image of smile made in postscript, http://www.tailrecursive.org/postscript/image.html
- ↑ http://www.tailrecursive.org/postscript/postscript.html