// R returns a new Rect with given the Min and Max coordinates.
//
// Note that the returned rectangle is not automatically normalized.
180116
func R(minX, minY, maxX, maxY float64) Rect {
	return Rect{
		Min: Vec{minX, minY},
		Max: Vec{maxX, maxY},
	}
}
350270
func (surface *Surface) FillRect(rect *Rect, color uint32) error {
	if C.SDL_FillRect(surface.cptr(), rect.cptr(), C.Uint32(color)) != 0 {
		return GetError()
	}
	return nil
}
355824
func (r Rect) Vertices() [4]Point {
	return [4]Point{
		{r.X.Lo, r.Y.Lo},
		{r.X.Hi, r.Y.Lo},
		{r.X.Hi, r.Y.Hi},
		{r.X.Lo, r.Y.Hi},
	}
}
961705
func Box(src image.Image, radius float64) *image.RGBA {
	if radius <= 0 {
		return clone.AsRGBA(src)
	}

	length := int(math.Ceil(2*radius + 1))
	k := convolution.NewKernel(length, length)

	for x := 0; x < length; x++ {
		for y := 0; y < length; y++ {
			k.Matrix[y*length+x] = 1
		}
	}

	return convolution.Convolve(src, k.Normalized(), &convolution.Options{Bias: 0, Wrap: false, KeepAlpha: false})
}
598433
func (renderer *Renderer) FillRect(rect *Rect) error {
	return errorFromInt(int(
		C.SDL_RenderFillRect(renderer.cptr(), rect.cptr())))
}
432858
func NewRect(a, b *T) (rect Rect) {
	rect.Min = Min(a, b)
	rect.Max = Max(a, b)
	return rect
}
1184274
func NewMatrixFromRects(rectangle1, rectangle2 [4]float64) Matrix {
	xScale := (rectangle2[2] - rectangle2[0]) / (rectangle1[2] - rectangle1[0])
	yScale := (rectangle2[3] - rectangle2[1]) / (rectangle1[3] - rectangle1[1])
	xOffset := rectangle2[0] - (rectangle1[0] * xScale)
	yOffset := rectangle2[1] - (rectangle1[1] * yScale)
	return Matrix{xScale, 0, 0, yScale, xOffset, yOffset}
}
1039073
func NewRect(init ...*Rect) *Rect {
	var o *Rect
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(Rect)
	}
	return o.Init()
}
87006
func (c *Client) R() *Request {
	r := &Request{
		QueryParam: url.Values{},
		FormData:   url.Values{},
		Header:     http.Header{},

		client:          c,
		multipartFiles:  []*File{},
		multipartFields: []*MultipartField{},
		pathParams:      map[string]string{},
		jsonEscapeHTML:  true,
	}

	return r
}
1022358
func RootGeometry(xu *xgbutil.XUtil) xrect.Rect {
	geom, err := RawGeometry(xu, xproto.Drawable(xu.RootWin()))
	if err != nil {
		panic(err)
	}
	return geom
}
606103
func (r Rect) Area() float64 {
	if r.IsEmpty() {
		return 0
	}
	capDiff := math.Abs(math.Sin(r.Lat.Hi) - math.Sin(r.Lat.Lo))
	return r.Lng.Length() * capDiff
}
804332
func Rect(x0, y0, x1, y1 float32) Rectangle {
	return Rectangle{
		image.Rect(int(x0), int(y0), int(x1), int(y1)),
	}
}
635264
func (r Rect) ApproxEquals(r2 Rect) bool {
	return r.X.ApproxEqual(r2.X) && r.Y.ApproxEqual(r2.Y)
}
1249476
func NewGLFrame(bounds pixel.Rect) *GLFrame {
	gf := new(GLFrame)
	gf.SetBounds(bounds)
	return gf
}
1294864
func (a *App) R(path string, h HandlerFunc, methods ...string) *App {
	if len(methods) < 1 {
		methods = append(methods, "GET")
	}
	_, ctl, act := a.Server.URL.Set(path, h)
	a.Webx().Match(methods, path, echo.HandlerFunc(func(ctx echo.Context) error {
		c := X(ctx)
		if err := c.Init(a, nil, ctl, act); err != nil {
			return err
		}
		return h(c)
	}))
	return a
}
1172679
func NewRGBImage(r image.Rectangle) *RGBImage {
	w, h := r.Dx(), r.Dy()
	pix := make([]uint8, 3*w*h)
	return &RGBImage{
		XPix:    pix,
		XStride: 3 * w,
		XRect:   r,
	}
}
593455
func (rect *Rect) Join(other *Rect) {
	rect.Min = Min(&rect.Min, &other.Min)
	rect.Max = Max(&rect.Max, &other.Max)
}