示例#1
0
文件: pyramid.go 项目: jvlmdr/go-cv
// Clones the image if resize is not necessary.
func resizeIfNec(size image.Point, im image.Image, interp resize.InterpolationFunction) image.Image {
	if size.Eq(im.Bounds().Size()) {
		return clone(im)
	}
	log.Printf("resize %v to %v", im.Bounds().Size(), size)
	return resize.Resize(uint(size.X), uint(size.Y), im, interp)
}
示例#2
0
文件: objects.go 项目: zenoss/rog-go
func (obj *Image) SetCentre(p image.Point) {
	p = p.Sub(centreDist(obj.Bbox()))
	if p.Eq(obj.item.R.Min) {
		return
	}
	obj.backing.Atomically(func(flush FlushFunc) {
		r := obj.item.R
		obj.item.R = r.Add(p.Sub(r.Min))
		flush(r, nil)
		flush(obj.item.R, nil)
	})
}