MCPcopy
hub / github.com/tdewolff/canvas / NewLineHatch

Function NewLineHatch

patterns.go:136–146  ·  view source on GitHub ↗

NewLineHatch returns a new line hatch pattern with lines at an angle with a spacing of distance. Thickness is the stroke thickness applied to the shape; stroking is ignored with thickness is zero.

(ifill any, angle, distance, thickness float64)

Source from the content-addressed store, hash-verified

134
135// NewLineHatch returns a new line hatch pattern with lines at an angle with a spacing of distance. Thickness is the stroke thickness applied to the shape; stroking is ignored with thickness is zero.
136func NewLineHatch(ifill any, angle, distance, thickness float64) *HatchPattern {
137 cell := Identity.Rotate(angle).Scale(distance, distance)
138 return NewHatchPattern(ifill, thickness, cell, func(x0, y0, x1, y1 float64) *Path {
139 p := &Path{}
140 for y := math.Floor(y0); y <= y1; y += 1.0 {
141 p.MoveTo(x0, y)
142 p.LineTo(x1, y)
143 }
144 return p
145 })
146}
147
148// NewCrossHatch returns a new cross hatch pattern of two regular line hatches at different angles and with different distance intervals. Thickness is the stroke thickness applied to the shape; stroking is ignored with thickness is zero.
149func NewCrossHatch(ifill any, angle0, angle1, distance0, distance1, thickness float64) *HatchPattern {

Callers 2

mainFunction · 0.92
parseDefsMethod · 0.85

Calls 5

MoveToMethod · 0.95
LineToMethod · 0.95
NewHatchPatternFunction · 0.85
ScaleMethod · 0.45
RotateMethod · 0.45

Tested by

no test coverage detected