Graphics State PostScript Commands

5.3.1 PostScript Graphics State Commands


[currentgray] [currentlinecap] [currentlinejoin] [currentlinewidth] [currentrgbcolor] [gsave] [grestore] [setgray] [setlinecap] [setlinejoin] [setlinewidth] [setrgbcolor] [scale]

currentgray

- currentgray gray-value

This operator returns a number corresponding to the current gray value setting.


currentlinecap

- currentlinecap number

This operator returns a number corresponding to the current line cap setting. For the meaning of the return value, see setlinecap.


currentlinejoin

- currentlinejoin number

This operator returns a number corresponding to the current line cap setting. For the meaning of the return value, see setlinejoin.


currentlinewidth

- currentlinewidth width

This operator returns the current line width in the current units.


currentrgbcolor

- currentrgbcolor red-value green-value blue-value

This operator returns the three numbers corresponding to the current RGB colour setting. For the meaning of the return values, see setrgbcolor.


gsave

- gsave -

This operator pushes saves a copy of the current graphics state The graphics state consists of (among other things):

gsave is typically used with grestore whenever you need to change the graphics state temporarily and return to the original.


grestore

- grestore -

Sets the current graphics state to the last graphics state saved with gsave.

scale

sx sy scale -

This operator has the effect of scaling the user coordinates. All coordinates will be multiplied by sx in the horizontal direction, and sy in the vertical.

The origin will not be affected by this operation.


setgray

gray-value setgray -

This operator sets the current intensity of the ink to gray-value. gray-value must be a number from 0 (black) to 1 (white). This will affect all markings drawn on the page, and will affect all objects drawn since the last stroke or fill command.


setlinecap

number setlinecap -

This operator sets the shape of line ends. The argument can be one of 0, 1, or 2 meaning respectively: butt ends, round ends, and square ends.


setlinejoin

number setlinejoin -

This operator sets the shape of corners of lines. The argument can be one of 0, 1, or 2 meaning respectively: miter corners, round corners, or bevel corners.


setlinewidth

width setlinewidth -

This operator sets the width of all lines to be stroked to width, which must be specified in the current units. A line width of zero is possible and is interpreted to be a hairline, as thin as can be rendered on the given device.


setrgbcolor

red-value green-value blue-value setrgbcolor -

This operator sets the current intensity of the ink to the color specified in red, green, and blue co-ordinates (red-value, green-value,blue-value). Each value must be a number between 0 and 1. Black is 0 0 0 and white is 1 1 1. This will affect all markings drawn on the page, and will affect all objects drawn since the last stroke or fill command.



David Maxwell, who is still writing this, would like to hear your comments and suggestions. And remember, parts of this manual are based on P.J. Weingartner's work: A First Guide to PostScript.