draw: make example_test more example-like, by being outside "package

draw".

Change-Id: Ie65c96a81250866c5813d4e3a8843b1168ed5579
Reviewed-on: https://go-review.googlesource.com/7612
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Nigel Tao 2015-03-15 15:56:43 +11:00
parent 4bf24024c9
commit ab1ce1a88c

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package draw
package draw_test
import (
"fmt"
@ -12,6 +12,7 @@ import (
"math"
"os"
"golang.org/x/image/draw"
"golang.org/x/image/math/f64"
)
@ -28,10 +29,10 @@ func ExampleDraw() {
sr := src.Bounds()
dst := image.NewRGBA(image.Rect(0, 0, 400, 300))
qs := []Interpolator{
NearestNeighbor,
ApproxBiLinear,
CatmullRom,
qs := []draw.Interpolator{
draw.NearestNeighbor,
draw.ApproxBiLinear,
draw.CatmullRom,
}
c, s := math.Cos(math.Pi/3), math.Sin(math.Pi/3)
t := &f64.Aff3{
@ -39,12 +40,12 @@ func ExampleDraw() {
+2 * s, +2 * c, 100,
}
Copy(dst, image.Point{20, 30}, src, sr, nil)
draw.Copy(dst, image.Point{20, 30}, src, sr, nil)
for i, q := range qs {
q.Scale(dst, image.Rect(200+10*i, 100*i, 600+10*i, 150+100*i), src, sr, nil)
}
// TODO: delete the "_ = t" and uncomment this when Transform is implemented.
// NearestNeighbor.Transform(dst, t, src, sr, nil)
// draw.NearestNeighbor.Transform(dst, t, src, sr, nil)
_ = t
// Change false to true to write the resultant image to disk.