Postscript

From Citizendium
Revision as of 19:26, 30 January 2009 by imported>Dmitrii Kouznetsov (example)
Jump to navigation Jump to search

PostScript (PS) is a programming language designed for description of two-dimentional objects desigend 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 pahe is supposed to be 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 elast, 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. Usially, the image encoded in the EPS format, has name *.eps or *.EPS . The EPS format and the size of the image are indicates 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 , . Values should be substituted instead of a for the execution. Usually, , but some advanced software recognizes also positeve and sometimes even negative values of these parameters. However at , 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 with only with some specific software.

Vector representation of figures

The EPS-reproduction of the Black Square by K.Malevich

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 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

Example of a roster image

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 [1].

Use of postscript

Several manuals on the postscript are available online; they allows to use the postsctipt without any preliminary learning. [2]

External sources

http://en.wikipedia.org/wiki/PostScript

References