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

Function Rectangle

shapes.go:31–42  ·  view source on GitHub ↗

Rectangle returns a rectangle of width w and height h.

(w, h float64)

Source from the content-addressed store, hash-verified

29
30// Rectangle returns a rectangle of width w and height h.
31func Rectangle(w, h float64) *Path {
32 if Equal(w, 0.0) || Equal(h, 0.0) {
33 return &Path{}
34 }
35
36 p := &Path{}
37 p.LineTo(w, 0.0)
38 p.LineTo(w, h)
39 p.LineTo(0.0, h)
40 p.Close()
41 return p
42}
43
44// RoundedRectangle returns a rectangle of width w and height h with rounded corners of radius r. A negative radius will cast the corners inwards (i.e. concave).
45func RoundedRectangle(w, h, r float64) *Path {

Callers 15

mainFunction · 0.92
drawPosFunction · 0.92
mainFunction · 0.92
rhombitrihexagonalTilingFunction · 0.92
pythagoreanTilingFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
drawTextFunction · 0.92

Calls 3

LineToMethod · 0.95
CloseMethod · 0.95
EqualFunction · 0.85

Tested by 2

TestStarTexFunction · 0.74
TestShapesFunction · 0.68