pub struct PdfPagePathObject<'a> { /* private fields */ }
Expand description

A single PdfPageObject of type PdfPageObjectType::Path. The page object defines a path.

Paths define shapes, trajectories, and regions of all sorts. They are used to draw lines, define the shapes of filled areas, and specify boundaries for clipping other graphics. A path is composed of one or more path segments, each specifying a straight or curved line segment. Each segment may connect to one another, forming a closed sub-path, or may be disconnected from one another, forming one or more open sub-paths. A path therefore is made up of one or more disconnected sub-paths, each comprising a sequence of connected segments. Closed sub-paths can be filled; both closed and open sub-paths can be stroked. The topology of the path is unrestricted; it may be concave or convex, may contain multiple sub-paths representing disjoint areas, and may intersect itself in arbitrary ways.

Page objects can be created either attached to a PdfPage (in which case the page object’s memory is owned by the containing page) or detached from any page (in which case the page object’s memory is owned by the object). Page objects are not rendered until they are attached to a page; page objects that are never attached to a page will be lost when they fall out of scope.

The simplest way to create a path object that is immediately attached to a page is to call one of the PdfPageObjects::create_path_object_*() functions to create lines, cubic Bézier curves, rectangles, circles, and ellipses. Alternatively you can create a detached path object using one of the following functions, but you must add the object to a containing PdfPageObjects collection manually.

The detached path object can later be attached to a page by calling the PdfPageObjects::add_path_object() function.

Implementations

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with the given initial position and with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the path to be stroked.

Other than setting the initial position, this path will be empty. Add additional segments to this path by calling one or more of the PdfPagePathObject::move_to(), PdfPagePathObject::line_to(), or PdfPagePathObject::bezier_to() functions. A closed sub-path can be created by calling the PdfPagePathObject::close_path() function. Convenience functions for adding rectangles, circles, and ellipses are also available with the PdfPagePathObject::rect_to(), PdfPagePathObject::circle_to(), and PdfPagePathObject::ellipse_to() functions, which create the desired shapes by constructing closed sub-paths from other path segments.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with a line with the given start and end coordinates, and with the given stroke settings applied.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with a cubic Bézier curve with the given start, end, and control point coordinates, and with the given stroke settings applied.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with a path for the given rectangle, with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the rectangle to be stroked.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with a circle that fills the given rectangle, with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the circle to be stroked.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with a circle centered at the given coordinates, with the given radius, and with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the circle to be stroked.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with an ellipse that fills the given rectangle, with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the ellipse to be stroked.

Creates a new PdfPagePathObject from the given arguments. The returned page object will not be rendered until it is added to a PdfPage using the PdfPageObjects::add_path_object() function.

The new path will be created with an ellipse centered at the given coordinates, with the given horizontal and vertical radii, and with the given fill and stroke settings applied. Both the stroke color and the stroke width must be provided for the ellipse to be stroked.

Begins a new sub-path in this PdfPagePathObject by moving the current point to the given coordinates, omitting any connecting line segment.

Appends a straight line segment to this PdfPagePathObject from the current point to the given coordinates. The new current point is set to the given coordinates.

Appends a cubic Bézier curve to this PdfPagePathObject from the current point to the given coordinates, using the two given Bézier control points. The new current point is set to the given coordinates.

Appends a rectangle to this PdfPagePathObject by drawing four line segments from the current point, ending at the given coordinates. The current sub-path will be closed. The new current point is set to the given coordinates.

Appends an ellipse to this PdfPagePathObject by drawing four Bézier curves approximating an ellipse filling a rectangle from the current point to the given coordinates. The current sub-path will be closed. The new current point is set to the given coordinates.

Appends a circle to this PdfPagePathObject by drawing four Bézier curves approximating a circle filling a rectangle from the current point to the given coordinates. The current sub-path will be closed. The new current point is set to the given coordinates.

Note that perfect circles cannot be represented exactly using Bézier curves. However, a very close approximation, more than sufficient to please the human eye, can be achieved using four Bézier curves, one for each quadrant of the circle.

Closes the current sub-path in this PdfPagePathObject by appending a straight line segment from the current point to the starting point of the sub-path.

Returns the method used to determine which sub-paths of any path in this PdfPagePathObject should be filled.

Returns true if this PdfPagePathObject will be stroked, regardless of the path’s stroke settings.

Even if this path is set to be stroked, the stroke must be configured with a visible color and a non-zero width in order to actually be visible.

Sets the method used to determine which sub-paths of any path in this PdfPagePathObject should be filled, and whether or not any path in this PdfPagePathObject should be stroked.

Even if this object’s path is set to be stroked, the stroke must be configured with a visible color and a non-zero width in order to actually be visible.

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Returns true if this PdfPageObject contains transparency.

Returns the bounding box of this PdfPageObject. Read more

Applies the given transformation, expressed as six values representing the six configurable elements of a nine-element 3x3 PDF transformation matrix, to this PdfPageObject. Read more

Transforms this PdfPageObject by applying the transformation matrix read from the given PdfPageObject. Read more

Returns the current horizontal translation of the origin of this PdfPageObject.

Returns the current vertical translation of the origin of this PdfPageObject.

Returns the current horizontal scale factor applied to this PdfPageObject.

Returns the current vertical scale factor applied to this PdfPageObject.

Returns the counter-clockwise rotation applied to this PdfPageObject, in radians. Read more

Returns the current x axis skew applied to this PdfPageObject, in radians. Read more

Returns the current y axis skew applied to this PdfPageObject, in radians. Read more

Sets the blend mode that will be applied when painting this PdfPageObject. Read more

Returns the color of any filled paths in this PdfPageObject.

Sets the color of any filled paths in this PdfPageObject.

Returns the color of any stroked lines in this PdfPageObject.

Sets the color of any stroked lines in this PdfPageObject. Read more

Returns the width of any stroked lines in this PdfPageObject.

Sets the width of any stroked lines in this PdfPageObject. Read more

Returns the line join style that will be used when painting stroked path segments in this PdfPageObject. Read more

Sets the line join style that will be used when painting stroked path segments in this PdfPageObject. Read more

Returns the line cap style that will be used when painting stroked path segments in this PdfPageObject. Read more

Sets the line cap style that will be used when painting stroked path segments in this PdfPageObject. Read more

Returns the width of this PdfPageObject.

Returns the height of this PdfPageObject.

Returns true if the bounds of this PdfPageObject lie entirely within the given rectangle.

Returns true if the bounds of this PdfPageObject lie at least partially within the given rectangle. Read more

Moves the origin of this PdfPageObject by the given horizontal and vertical delta distances.

Returns the current horizontal and vertical translation of the origin of this PdfPageObject.

Changes the size of this PdfPageObject, scaling it by the given horizontal and vertical scale factors. Read more

Flips this PdfPageObject horizontally around its origin by applying a horizontal scale factor of -1.

Flips this PdfPageObject vertically around its origin by applying a vertical scale factor of -1.

Reflects this PdfPageObject by flipping it both horizontally and vertically around its origin.

Returns the current horizontal and vertical scale factors applied to this PdfPageObject.

Rotates this PdfPageObject counter-clockwise by the given number of degrees.

Returns the counter-clockwise rotation applied to this PdfPageObject, in degrees. Read more

Rotates this PdfPageObject clockwise by the given number of degrees.

Returns the clockwise rotation applied to this PdfPageObject, in degrees. Read more

Rotates this PdfPageObject counter-clockwise by the given number of radians.

Rotates this PdfPageObject clockwise by the given number of radians.

Returns the clockwise rotation applied to this PdfPageObject, in radians. Read more

Skews the axes of this PdfPageObject by the given angles in degrees.

Returns the current x axis and y axis skew angles applied to this PdfPageObject, in degrees. Read more

Returns the current x axis skew angle applied to this PdfPageObject, in degrees. Read more

Returns the current y axis skew applied to this PdfPageObject, in degrees. Read more

Skews the axes of this PdfPageObject by the given angles in radians.

Returns the current x axis and y axis skew angles applied to this PdfPageObject, in radians. Read more

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.