Struct tiny_skia::PathBuilder[][src]

pub struct PathBuilder { /* fields omitted */ }
Expand description

A path builder.

Implementations

Creates a new builder.

Creates a new builder with a specified capacity.

Number of points depends on a verb type:

  • Move - 1
  • Line - 1
  • Quad - 2
  • Cubic - 3
  • Close - 0

Creates a new Path from Rect.

Never fails since Rect is always valid.

Segments are created clockwise: TopLeft -> TopRight -> BottomRight -> BottomLeft

The contour is closed.

Creates a new Path from a circle.

The contour is closed and has a clock-wise direction.

Returns None when:

  • radius <= 0
  • any value is not finite or really large

Returns the current number of segments in the builder.

Checks if the builder has any segments added.

Adds beginning of a contour.

Multiple continuous MoveTo segments are not allowed. If the previous segment was also MoveTo, it will be overwritten with the current one.

Adds a line from the last point.

  • If Path is empty - adds Move(0, 0) first.
  • If Path ends with Close - adds Move(last_x, last_y) first.

Adds a quad curve from the last point to x, y.

  • If Path is empty - adds Move(0, 0) first.
  • If Path ends with Close - adds Move(last_x, last_y) first.

Adds a cubic curve from the last point to x, y.

  • If Path is empty - adds Move(0, 0) first.
  • If Path ends with Close - adds Move(last_x, last_y) first.

Closes the current contour.

A closed contour connects the first and the last Point with a line, forming a continuous loop.

Does nothing when Path is empty or already closed.

Open and closed contour will be filled the same way. Stroking an open contour will add LineCap at contour’s start and end. Stroking an closed contour will add LineJoin at contour’s start and end.

Adds a rectangle contour.

The contour is closed and has a clock-wise direction.

Does nothing when:

  • any value is not finite or really large

Adds a circle contour.

The contour is closed and has a clock-wise direction.

Does nothing when:

  • radius <= 0
  • any value is not finite or really large

Reset the builder.

Memory is not deallocated.

Finishes the builder and returns a Path.

Returns None when Path is empty or has invalid bounds.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. 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.