PostScript Operatoren



  • [
  • ]
  • =
  • = =
  • abs
  • add
  • aload
  • anchorsearch
  • and
  • arc
  • arcn
  • arcto
  • array
  • ashow
  • astore
  • atan
  • awidthshow
  • banddevice
  • begin
  • bind
  • bitshift
  • bytesavailable
  • cachestatus
  • ceiling
  • charpath
  • clear
  • cleartomark
  • clip
  • clippath
  • closefile
  • closepath
  • concat
  • concatmatrix
  • copy
  • copypage
  • cos
  • count
  • countdictstack
  • countexecstack
  • counttomark
  • currentcacheparams
  • currentdash
  • currentdict
  • currentfile
  • currentflat
  • currentfont
  • currentgray
  • currenthsbcolor
  • currentlinecap
  • currentlinejoin
  • currentlinewidth
  • currentmatrix
  • currentmiterlimit
  • currentpacking
  • currentpoint
  • currentrgbcolor
  • currentscreen
  • currenttransfer
  • curveto
  • cvi
  • cvlit
  • cvn
  • cvr
  • cvrs
  • cvs
  • cvx
  • def
  • defaultmatrix
  • definefont
  • dict
  • dictstack
  • div
  • dtransform
  • dup
  • echo
  • end
  • eoclip
  • eofill
  • eq
  • erasepage
  • errordict
  • exch
  • exec
  • execstack
  • executeonly
  • exit
  • exp
  • false
  • file
  • fill
  • findfont
  • flattenpath
  • floor
  • flush
  • flushfile
  • FontDirectory
  • for
  • forall
  • framedevice
  • ge
  • get
  • getinterval
  • grestore
  • grestoreall
  • gsave
  • gt
  • identmatrix
  • idiv
  • idtransform
  • if
  • ifelse
  • image
  • imagemask
  • index
  • initclip
  • initgraphics
  • initmatrix
  • invertmatrix
  • itransform
  • known
  • kshow
  • le
  • length
  • lineto
  • ln
  • load
  • log
  • loop
  • lt
  • makefont
  • mark
  • matrix
  • maxlength
  • mod
  • moveto
  • mul
  • ne
  • neg
  • newpath
  • noaccess
  • not
  • null
  • nulldevice
  • or
  • packedarray
  • pathbbox
  • pathforall
  • pop
  • print
  • prompt
  • pstack
  • put
  • putinterval
  • quit
  • rand
  • rcheck
  • rcurveto
  • read
  • readhexstring
  • readline
  • readonly
  • readstring
  • renderbands
  • repeat
  • resetfile
  • restore
  • reversepath
  • rlineto
  • rmoveto
  • roll
  • rotate
  • round
  • rrand
  • run
  • save
  • scale
  • scalefont
  • search
  • setcachedevice
  • setcachelimit
  • setcacheparams
  • setcharwidth
  • setdash
  • setflat
  • setfont
  • setgray
  • sethsbcolor
  • setlinecap
  • setlinejoin
  • setlinewidth
  • setmatrix
  • setmiterlimit
  • setpacking
  • setrgbcolor
  • setscreen
  • settransfer
  • show
  • showpage
  • sin
  • sqrt
  • srand
  • stack
  • StandardEncoding
  • start
  • status
  • stop
  • stopped
  • store
  • string
  • stringwidth
  • stroke
  • strokepath
  • sub
  • systemdict
  • token
  • transform
  • translate
  • true
  • truncate
  • type
  • userdict
  • usertime
  • version
  • vmstatus
  • wcheck
  • where
  • widthshow
  • write
  • writehexstring
  • writestring
  • xcheck
  • xor

  • Operator: add

    num1 num2 add num3

    This operator returns the addition of the two arguments.

    See also:

    Operator: arc

    x-coord y-coord r ang1 ang2 arc -

    This operator adds an arc to the current path. The arc is generated by sweeping a line segment of length r, and tied at the point (x-coord y-coord), in a counter-clockwise direction from an angle ang1 to an angle ang2. Note: a straight line segment will connect the current point to the first point of the arc, if they are not the same.

    Operator: begin

    dict begin -

    This operator pushes the dictionary dict onto the dictionary stack. Where it can be used for def and name lookup. This operator allows an operator to set up a dictionary for its own use (e.g. for local variables).


    Operator: bind

    procedure1 bind procedure2

    The bind operator goes through procedure1 and replaces any operator names with their associate operators. Names which do not refer to operators are left alone. Operators within procedure1 which have unrestricted access will have bind called on themselves before they are inserted into the procedure. The new procedure with operators instead of operator names is returned on the stack as procedure2.

    The main effect and use of this operator is to reduce the amount of name lookup done by the interpreter. This speeds up execution and ties down the behavior of operators.


    Operator: clip

    - clip -

    This operator intersects the current clipping path with the current path and sets the current clipping path to the results. Any part of a path drawn after calling this operator which extends outside this new clipping area will simply not be drawn. If the given path is open, clip will treat it as if it were closed. Also, clip does not destroy the current path when it is finished... it may be used for other activities.

    It is important to note that there is no easy way to restore the clip path to a larger size once it has been set. The best way to set the clip path is to wrap it in a gsave and grestore pair.


    Operator: closepath

    - closepath -

    This operator adds a line segment to the current path from the current point to the first point in the path. This closes the path so that it may be filled.


    Also see the following operators:

    Operator: charpath

    string bool charpath -

    This operator takes the given string and appends the path which the characters define to the current path. The result is can be used as any other path for stroking, filling, or clipping.

    The boolean argument informs charpath what to do if the font was not designed to be stoked. If the boolean is true, the path will be modified to be filled and clipped (but not stroked). If the boolean is false, the path will be suitable to be stroked (but not filled or clipped).

    See also:

    Operator: curveto

    x1 y1 x2 y2 x3 y3 curveto -

    This operator draws a curve from the current point to the point (x3, y3) using points (x1, y1) and (x2, y2) as control points. The curve is a Bézier cubic curve. In such a curve, the tangent of the curve at the current point will be a line segment running from the current point to (x1, y1) and the tangent at (x3, y3) is the line running from (x3, y3) to (x2, y2).

    See also:

    Operator: def

    name value def -

    This operator associates the name with value in the dictionary at the top of the dictionary stack. This operator essentially defines names to have values in the dictionary and is used to define variables and operators.


    Operator: div

    num1 num2 div num3

    This operator returns the result of dividing num1 by num2. The result is always a real.

    See also:

    Operator: dup

    object dup object object

    This operate pushes a second copy of the topmost object on the operand stack. If the object is a reference to an array, string, or similar composite object, only the reference is duplicated; both references will still refer to the same object.

    See also:


    Operator: end

    - end -

    This operator pops the topmost dictionary off of the dictionary stack. The dictionary below it becomes the new current dictionary.


    Operator: exch

    value1 value2 exch value2 value1

    This operator simply exchanges the top two items on the operand stack. It does not matter what the operands are.

    See also:


    Operator: fill

    - fill -

    This operator closes and fills the current path with the current color. Any ink within the path is obliterated. Note that fill blanks out the current path as if it had called newpath. If you want the current path preserved, you should use gsave and grestore to preserve the path.


    Operator: findfont

    name findfont font

    This operator looks for the named font in the font dictionary. If it finds the font, it pushes the font on the stack for later processing. It signals an error if the font can not be found.


    Also see the following operators:

    Operator: for

    initial increment limit proc for -

    This operator will execute proc repeatedly. The first time proc is executed, it will be given initial as the top operand. Each time it is executed after that, the top operand will be incremented by increment. This process will continue until the argument would have exceeded limit.

    See also:

    Operator: grestore

    - grestore -

    Sets the current graphics state to the topmost graphics state on graphics state stack and pops that state off the stack. This operator is almost always used in conjunction with gsave.

    Operator: gsave

    - gsave -

    This operator pushes a copy of the current graphics state onto the graphics state stack. 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.


    Operator: if

    bool proc if -

    This operator will execute proc if bool is true.

    Operator: ifelse

    bool proc1 proc2 ifelse -

    This operator will execute proc1 if bool is true and proc2 otherwise.

    Operator: index

    value_n ... value_0 n index value_n ... value_0 value_n

    This operator grabs the nth item off the operand stack (item 0 is the one just under the index you push on the stack for the operator) and pushes it on top of the stack.

    See also:


    Operator: lineto

    x-coord y-coord lineto -

    This operator adds a line into the path. The line is from the current point to the point (x-coord y-coord). After the line is added to the path, the current point is set to (x-coord y-coord). It is an error to call lineto without having a current point.


    Also see the following operators:

    Operator: moveto

    x-coord y-coord moveto -

    This operator moves the current point of the current path to the given point in user space. If a moveto operator immediately follows another moveto operator, the previous one is erased.


    Also see the following operators:

    Operator: mul

    value1 value2 mul product

    This operator multiplies the first two operands on the stack and pushes the result back onto the stack. The result is an integer if both operands are integers and the product is not out of range. If the product is too big, or one of the operands is a real, the result will be a real.


    Operator: newpath

    - newpath -

    The newpath operator clears out the current path and prepares the system to start a new current path. This operator should be called before starting any new path, even though some operators call it implicitly.

    Operator: pop

    value pop -

    This operator just removes the top-most item off of the operand stack.

    See also:


    Operator: restore

    state restore -

    This restores the total state of the PostScript system to the state saved in state.


    See also:

    Operator: rlineto

    dx dy rlineto -

    This operator adds a line into the path. The line is from the current point to a point found by adding dx to the current x and dy to the current y. After line is added to the path, the current point is set to the new point. It is an error to call lineto without having a current point.


    Also see the following operators:

    Operator: rmoveto

    dx dy rmoveto -

    This operator moves the current point of the current path by adding dx to the current x and dy to the current y.


    Also see the following operators:

    Operator: rotate

    angle rotate -

    This operator has the effect of rotating the user space counter-clockwise by angle degrees (negative angles rotate clockwise). The rotation occurs around the current origin.

    See also:

    Operator: save

    - save state

    This operator gathers up the complete state of the PostScript system and saves it in state. Errors:

    See Also:

    Operator: 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.

    See also:

    Operator: scalefont

    font size scalefont font

    This operator takes the given font and scales it by the given scale factor. The resulting scaled font is pushed onto the stack. A size of one produces the same sized characters as the original font, 0.5 produces half-size characters, and so on.


    Also see the following operators:

    Operator: setfont

    font setfont -

    This operator sets the current font to be font. This font can be the result of any font creation or modification operator. This font is used in all subsequent character operations like show.

    Also see:

    Operator: 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 stroked or filled onto the page. This applies even to path components created before the call to setgray as long as they have not yet been stroked.

    Operator: setlinewidth

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

    Operator: show

    string show -

    This operator draws the given string onto the page. The current graphics state applies, so the current font, fontsize, gray value, and current transformation matrix all apply.

    The location for the text is set by the current point. The current point will specify the leftmost point of the baseline for the text.

    See also:

    Operator: showpage

    - showpage -

    This operator commits the current page to print and ejects the page from printing device. showpage also prepares a new blank page.

    Operator: stroke

    - stroke -

    This operator draws a line along the current path using the current settings. This includes the current line thickness, current pen color, current dash pattern, current settings for how lines should be joined, and what kind of caps they should have. These settings are the settings at the time the stroke operator is invoked.

    A closed path consisting of two or more points at the same location is a degenerate path. A degenerate path will be drawn only if you have set the line caps to round caps. If your line caps are not round caps, or if the path is not closed, the path will not be drawn. If the path is drawn, it will appear as a filled circle center at the point.


    Operator: sub

    num1 num2 sub num3

    This operator returns the result of subtracting num2 from num1.

    See also:

    Operator: translate

    x-coord y-coord translate -

    This operator has the affect of moving the origin to the point (x-coord, y-coord) in the current user space.

    See also:

    © Holger Gehringer, Dezember 1998