cutter.go
func (c Config) computedCropArea(bounds image.Rectangle, size image.Point) (r image.Rectangle) {
	min := bounds.Min
	switch c.Mode {
	case Centered:
		rMin := c.centeredMin(bounds)
		r = image.Rect(rMin.X-size.X/2, rMin.Y-size.Y/2, rMin.X-size.X/2+size.X, rMin.Y-size.Y/2+size.Y)
	default: // TopLeft
		rMin := image.Point{min.X + c.Anchor.X, min.Y + c.Anchor.Y}
		r = image.Rect(rMin.X, rMin.Y, rMin.X+size.X, rMin.Y+size.Y)
	}
	return
}
func (c Config) computedCropArea(bounds image.Rectangle, size image.Point) (r image.Rectangle) {
	min := bounds.Min
	switch c.Mode {
	case Centered:
		rMin := c.centeredMin(bounds)
		r = image.Rect(rMin.X-size.X/2, rMin.Y-size.Y/2, rMin.X-size.X/2+size.X, rMin.Y-size.Y/2+size.Y)
	default: // TopLeft
		rMin := image.Point{min.X + c.Anchor.X, min.Y + c.Anchor.Y}
		r = image.Rect(rMin.X, rMin.Y, rMin.X+size.X, rMin.Y+size.Y)
	}
	return
}
func ( c Config ) computedCropArea ( bounds image . Rectangle , size image . Point ) ( r image . Rectangle ) { min := bounds . Min switch c . Mode { case Centered : rMin := c . centeredMin ( bounds ) r = image . Rect ( rMin . X - size . X / 2 , rMin . Y - size . Y / 2 , rMin . X - size . X / 2 + size . X , rMin . Y - size . Y / 2 + size . Y ) default : // TopLeft rMin := image . Point { min . X + c . Anchor . X , min . Y + c . Anchor . Y } r = image . Rect ( rMin . X , rMin . Y , rMin . X + size . X , rMin . Y + size . Y ) } return }
// computedCropArea retrieve the theorical crop area.
// It is defined by Height, Width, Mode and
computedCropArea retrieve the theorical crop area . It is defined by Height Width Mode and