MCPcopy
hub / github.com/mum4k/termdash / validArea

Function validArea

private/segdisp/segment/segment.go:114–125  ·  view source on GitHub ↗

validArea validates the provided area.

(ar image.Rectangle)

Source from the content-addressed store, hash-verified

112
113// validArea validates the provided area.
114func validArea(ar image.Rectangle) error {
115 if ar.Min.X < 0 || ar.Min.Y < 0 {
116 return fmt.Errorf("the start coordinates cannot be negative, got: %v", ar)
117 }
118 if ar.Max.X < 0 || ar.Max.Y < 0 {
119 return fmt.Errorf("the end coordinates cannot be negative, got: %v", ar)
120 }
121 if ar.Dx() < 1 || ar.Dy() < 1 {
122 return fmt.Errorf("the area for the segment must be at least 1x1 pixels, got %vx%v in area:%v", ar.Dx(), ar.Dy(), ar)
123 }
124 return nil
125}
126
127// HV draws a horizontal or a vertical display segment, filling the provided area.
128// The segment will have slopes on both of its ends.

Callers 2

HVFunction · 0.85
DiagonalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected