Documentation
¶
Index ¶
- func Dash(p ppath.Path, offset float32, d ...float32) ppath.Path
- func Markers(p ppath.Path, first, mid, last ppath.Path, align bool) []ppath.Path
- func Offset(p ppath.Path, w float32, tolerance float32) ppath.Path
- func Stroke(p ppath.Path, w float32, cr Capper, jr Joiner, tolerance float32) ppath.Path
- type ArcsJoiner
- type BevelJoiner
- type ButtCapper
- type Capper
- type Joiner
- type MiterJoiner
- type RoundCapper
- type RoundJoiner
- type SquareCapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dash ¶
Dash returns a new path that consists of dashes. The elements in d specify the width of the dashes and gaps. It will alternate between dashes and gaps when picking widths. If d is an array of odd length, it is equivalent of passing d twice in sequence. The offset specifies the offset used into d (or negative offset into the path). Dash will be applied to each subpath independently.
func Markers ¶
Markers returns an array of start, mid and end marker paths along the path at the coordinates between commands. Align will align the markers with the path direction so that the markers orient towards the path's left.
func Offset ¶
Offset offsets the path by w and returns a new path. A positive w will offset the path to the right-hand side, that is, it expands CCW oriented contours and contracts CW oriented contours. If you don't know the orientation you can use `Path.CCW` to find out, but if there may be self-intersection you should use `Path.Settle` to remove them and orient all filling contours CCW. The tolerance is the maximum deviation from the actual offset when flattening Béziers and optimizing the path.
func Stroke ¶
Stroke converts a path into a stroke of width w and returns a new path. It uses cr to cap the start and end of the path, and jr to join all path elements. If the path closes itself, it will use a join between the start and end instead of capping them. The tolerance is the maximum deviation from the original path when flattening Béziers and optimizing the stroke.
Types ¶
type ArcsJoiner ¶
ArcsJoiner is an arcs joiner.
func (ArcsJoiner) String ¶
func (j ArcsJoiner) String() string
type BevelJoiner ¶
type BevelJoiner struct{}
BevelJoiner is a bevel joiner.
func (BevelJoiner) Join ¶
func (BevelJoiner) Join(rhs, lhs *ppath.Path, halfWidth float32, pivot, n0, n1 math32.Vector2, r0, r1 float32)
Join adds a join to a right-hand-side and left-hand-side path, of width 2*halfWidth, around a pivot point with starting and ending normals of n0 and n1, and radius of curvatures of the previous and next segments.
func (BevelJoiner) String ¶
func (BevelJoiner) String() string
type ButtCapper ¶
type ButtCapper struct{}
ButtCapper is a butt capper.
func (ButtCapper) Cap ¶
Cap adds a cap to path p of width 2*halfWidth, at a pivot point and initial normal direction of n0.
func (ButtCapper) String ¶
func (ButtCapper) String() string
type Capper ¶
Capper implements Cap, with rhs the path to append to, halfWidth the half width of the stroke, pivot the pivot point around which to construct a cap, and n0 the normal at the start of the path. The length of n0 is equal to the halfWidth.
var ButtCap Capper = ButtCapper{}
ButtCap caps the start or end of a path by a butt cap.
var RoundCap Capper = RoundCapper{}
RoundCap caps the start or end of a path by a round cap.
var SquareCap Capper = SquareCapper{}
SquareCap caps the start or end of a path by a square cap.
func CapFromStyle ¶
type Joiner ¶
type Joiner interface {
Join(*ppath.Path, *ppath.Path, float32, math32.Vector2, math32.Vector2, math32.Vector2, float32, float32)
}
Joiner implements Join, with rhs the right path and lhs the left path to append to, pivot the intersection of both path elements, n0 and n1 the normals at the start and end of the path respectively. The length of n0 and n1 are equal to the halfWidth.
var ArcsClipJoin Joiner = ArcsJoiner{nil, 4.0}
var ArcsJoin Joiner = ArcsJoiner{BevelJoin, 4.0}
ArcsJoin connects two path elements by extending the ends of the paths as circle arcs until they meet. If this point is further than the limit, this will result in a bevel join (ArcsJoin) or they will meet at the limit (ArcsClipJoin).
var BevelJoin Joiner = BevelJoiner{}
BevelJoin connects two path elements by a linear join.
var MiterClipJoin Joiner = MiterJoiner{nil, 4.0} // TODO: should extend limit*halfwidth before bevel
var MiterJoin Joiner = MiterJoiner{BevelJoin, 4.0}
MiterJoin connects two path elements by extending the ends of the paths as lines until they meet. If this point is further than the limit, this will result in a bevel join (MiterJoin) or they will meet at the limit (MiterClipJoin).
var RoundJoin Joiner = RoundJoiner{}
RoundJoin connects two path elements by a round join.
func JoinFromStyle ¶
type MiterJoiner ¶
MiterJoiner is a miter joiner.
func (MiterJoiner) String ¶
func (j MiterJoiner) String() string
type RoundCapper ¶
type RoundCapper struct{}
RoundCapper is a round capper.
func (RoundCapper) Cap ¶
Cap adds a cap to path p of width 2*halfWidth, at a pivot point and initial normal direction of n0.
func (RoundCapper) String ¶
func (RoundCapper) String() string
type RoundJoiner ¶
type RoundJoiner struct{}
RoundJoiner is a round joiner.
func (RoundJoiner) String ¶
func (RoundJoiner) String() string
type SquareCapper ¶
type SquareCapper struct{}
SquareCapper is a square capper.
func (SquareCapper) Cap ¶
Cap adds a cap to path p of width 2*halfWidth, at a pivot point and initial normal direction of n0.
func (SquareCapper) String ¶
func (SquareCapper) String() string