Previous Next


                                                          227
           SECTION 4.4                                                     Path Construction and Painting



OPERANDS              OPERATOR               DESCRIPTION

—                     h                      Close the current subpath by appending a straight line segment
                                             from the current point to the starting point of the subpath. If the
                                             current subpath is already closed, h does nothing.
                                             This operator terminates the current subpath. Appending another
                                             segment to the current path begins a new subpath, even if the new
                                             segment begins at the endpoint reached by the h operation.

x y width height      re                     Append a rectangle to the current path as a complete subpath, with
                                             lower-left corner (x, y) and dimensions width and height in user
                                             space. The operation
                                                  x y width height re

                                             is equivalent to
                                                  x y m
                                                  ( x + width ) y l
                                                  ( x + width ) ( y + height ) l
                                                  x ( y + height ) l
                                                  h


           Cubic Bézier Curves

           Curved path segments are specified as cubic Bézier curves. Such curves are de-
           fined by four points: the two endpoints (the current point P0 and the final point
           P3 ) and two control points P1 and P2 . Given the coordinates of the four points, the
           curve is generated by varying the parameter t from 0.0 to 1.0 in the following
           equation:
                            3                 2           2                  3
           R (t) = ( 1 – t ) P 0 + 3t ( 1 – t ) P 1 + 3t ( 1 – t )P 2 + t P 3

           When t = 0.0, the value of the function R (t) coincides with the current point P0 ;
           when t = 1.0, R (t) coincides with the final point P3 . Intermediate values of t gen-
           erate intermediate points along the curve. The curve does not, in general, pass
           through the two control points P1 and P2 .

Previous Next