Creating Paths

These are the general methods for creating paths for later use in PDF graphics operations.

FigureMaker methods

append_curve_to_path(x1, y1, x2, y2, x3, y3, _skip_log_check=False)  [ doc | example ]

Append a cubic Bezier curve to the current path.  The curve
extends from the current path end to the point given by the
figure coordinates (`x3`, `y3`), using (`x1`, `y1`) and (`x2`,
`y2`) as the Bezier control points (also in figure
coordinates).  The new path end is (`x3`, `y3`).  See also
`bezier_control_points()`.

Example

The illustration shows in dark blue the curve that is added for the control points given in red.

append_point_to_path(x, y, _skip_log_check=False)  [ doc ]

Append a straight line segment from the current path end to
the point given by the figure coordinates (`x`, `y`).  The new
path end point is (`x`, `y`).

append_points_to_path(x, y, _skip_log_check=False)  [ doc ]

The arguments `x` and `y` should be arrays of equal lengths
holding figure coordinates for points.  If there is an open
subpath already under construction, the first point is added
with `append_point_to_path()`, but if the path is empty or has
just been closed, then the first point is passed to
`move_to_point()` instead.  All subsequent points are used for
calls to `append_point_to_path()`.

append_points_with_gaps_to_path(x, y, gap, close_subpath=False, _skip_log_check=False)  [ doc ]

Like `append_points_to_path()`, but where there is a gap, it
does `move_to_point()` instead of `append_point_to_path()`.
If the flag `close_subpath` is True, then does `close_path()`
before doing the `move_to_point()` for each gap.  The array
`gap` holds integer indices in `x` and `y` for locations that
should be moved to.  This routine is useful with sources that
provide paths that may consist of many subpaths (such as
`make_contour()`).

close_path()  [ doc ]

Closing a path has the effect of adding a line from the end of
the current subpath to the start of that subpath as determined
by the previous `move_to_point()`.  Typically, the last action
for a closed path should be a call to `close_path()` so that
the line join will be done properly at the junction point; see
`stroke()` for details.

discard_path()  [ doc ]

Reset the path to empty.  This is done automatically after
each `stroke()`, `fill()`, or `clip()`.

move_to_point(x, y, _skip_log_check=False)  [ doc ]

Begin a new subpath by moving to the point given by the figure
coordinates (`x`, `y`), omitting any connecting line segment.
If the previous path construction operator in the current path
was also `move_to_point()`, the new `move_to_point()`
overrides it; no vestige of the previous `move_to_point()`
operation remains in the path.

Note that once you start a path, you must finish with it
before going on to anything else.  So you need to do a
sequence of path producer operations followed by a single path
consumer operation.  After the path consumer operation
finishes, the current path is reset to empty and you can then
safely do other operations such as change the line width or
the line type.

update_bbox(x, y)  [ doc ]

Adds the figure coordinates point (`x`, `y`) to the bounding
box.  Not usually needed, but can be helpful with text that is
outside the box determined by the graphics since the Tioga
kernel does not have exact information about how large the
text bbox will be once TeX has done the typesetting.

FigureMaker attributes

croak_on_nonok_numbers  [ doc ]

If `self.croak_on_nonok_numbers` is set, the kernel will emit
a warning when it encounters a weird point (such as with
infinite or NaN coordinates) in a primitive path operation.
In any case, the faulty element in the path will be discarded.

PyTioga version: alpha (20071021)

Copyright (C) 2007 Taro Sato & Bill Paxton. All rights reserved.