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

Method Add

util.go:451–457  ·  view source on GitHub ↗

Add returns a rect that encompasses both the current rect and the given rect.

(q Rect)

Source from the content-addressed store, hash-verified

449
450// Add returns a rect that encompasses both the current rect and the given rect.
451func (r Rect) Add(q Rect) Rect {
452 x0 := math.Min(r.X0, q.X0)
453 y0 := math.Min(r.Y0, q.Y0)
454 x1 := math.Max(r.X1, q.X1)
455 y1 := math.Max(r.Y1, q.Y1)
456 return Rect{x0, y0, x1, y1}
457}
458
459// AddPoint returns a rect that encompasses both the current rect and the given point.
460func (r Rect) AddPoint(p Point) Rect {

Callers 15

TestRectFunction · 0.95
BoundsMethod · 0.95
BoundsMethod · 0.95
RenderPathMethod · 0.95
DrawPreviewWithAssetsFunction · 0.45
TestPolylineFunction · 0.45
TestPolylineSmoothenFunction · 0.45
ArcMethod · 0.45
CoordDirectionsMethod · 0.45
ellipseToCubicBeziersFunction · 0.45
flattenEllipticArcFunction · 0.45

Calls

no outgoing calls

Tested by 6

TestRectFunction · 0.76
TestPolylineFunction · 0.36
TestPolylineSmoothenFunction · 0.36
TestGradAddFunction · 0.36
TestRadialGradientAtFunction · 0.36