From: Nigel Tao Date: Thu, 16 Dec 2010 04:11:10 +0000 (+1100) Subject: exp/draw: remove Border function. X-Git-Tag: weekly.2010-12-22~26 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0bf2aa1aa77b1280f4ad42779a3d4dcc74dab259;p=gostls13.git exp/draw: remove Border function. It was only used by exp/4s, and even if it is general purpose, I think it belongs in a graphics library atop exp/draw, not in exp/draw itself. R=rsc CC=golang-dev https://golang.org/cl/3705041 --- diff --git a/src/pkg/exp/draw/draw.go b/src/pkg/exp/draw/draw.go index c94ae83a42..1d0729d922 100644 --- a/src/pkg/exp/draw/draw.go +++ b/src/pkg/exp/draw/draw.go @@ -361,26 +361,3 @@ func drawRGBA(dst *image.RGBA, r image.Rectangle, src image.Image, sp image.Poin } } } - -// Border aligns r.Min in dst with sp in src and then replaces pixels -// in a w-pixel border around r in dst with the result of the Porter-Duff compositing -// operation ``src over dst.'' If w is positive, the border extends w pixels inside r. -// If w is negative, the border extends w pixels outside r. -func Border(dst Image, r image.Rectangle, w int, src image.Image, sp image.Point) { - i := w - if i > 0 { - // inside r - Draw(dst, image.Rect(r.Min.X, r.Min.Y, r.Max.X, r.Min.Y+i), src, sp) // top - Draw(dst, image.Rect(r.Min.X, r.Min.Y+i, r.Min.X+i, r.Max.Y-i), src, sp.Add(image.Pt(0, i))) // left - Draw(dst, image.Rect(r.Max.X-i, r.Min.Y+i, r.Max.X, r.Max.Y-i), src, sp.Add(image.Pt(r.Dx()-i, i))) // right - Draw(dst, image.Rect(r.Min.X, r.Max.Y-i, r.Max.X, r.Max.Y), src, sp.Add(image.Pt(0, r.Dy()-i))) // bottom - return - } - - // outside r; - i = -i - Draw(dst, image.Rect(r.Min.X-i, r.Min.Y-i, r.Max.X+i, r.Min.Y), src, sp.Add(image.Pt(-i, -i))) // top - Draw(dst, image.Rect(r.Min.X-i, r.Min.Y, r.Min.X, r.Max.Y), src, sp.Add(image.Pt(-i, 0))) // left - Draw(dst, image.Rect(r.Max.X, r.Min.Y, r.Max.X+i, r.Max.Y), src, sp.Add(image.Pt(r.Dx(), 0))) // right - Draw(dst, image.Rect(r.Min.X-i, r.Max.Y, r.Max.X+i, r.Max.Y+i), src, sp.Add(image.Pt(-i, 0))) // bottom -}