From 5e381d3a9a5cda59b7ec6482e4285b286dcb850c Mon Sep 17 00:00:00 2001
From: Nigel Tao image.ColorImage
type is still in the image
package but has been renamed
image.Uniform
,
-while image.Tiled
-has been renamed
-image.Repeated
.
+while image.Tiled
has been removed.
@@ -1178,7 +1176,6 @@ This table lists the renamings.
diff --git a/doc/go1.tmpl b/doc/go1.tmpl
index d43ebf7a68..cf93181119 100644
--- a/doc/go1.tmpl
+++ b/doc/go1.tmpl
@@ -1018,9 +1018,7 @@ packages.
The old image.ColorImage
type is still in the image
package but has been renamed
image.Uniform
,
-while image.Tiled
-has been renamed
-image.Repeated
.
+while image.Tiled
has been removed.
@@ -1081,7 +1079,6 @@ This table lists the renamings.
diff --git a/src/cmd/fix/imagetiled.go b/src/cmd/fix/imagetiled.go deleted file mode 100644 index d8f3f79806..0000000000 --- a/src/cmd/fix/imagetiled.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "go/ast" -) - -func init() { - register(imagetiledFix) -} - -var imagetiledFix = fix{ - "imagetiled", - "2012-01-10", - imagetiled, - `Rename image.Tiled to image.Repeated. - -http://codereview.appspot.com/5530062 -`, -} - -func imagetiled(f *ast.File) bool { - if !imports(f, "image") { - return false - } - - fixed := false - walk(f, func(n interface{}) { - s, ok := n.(*ast.SelectorExpr) - if !ok || !isTopName(s.X, "image") || s.Sel.String() != "Tiled" { - return - } - s.Sel = &ast.Ident{Name: "Repeated"} - fixed = true - }) - return fixed -} diff --git a/src/cmd/fix/imagetiled_test.go b/src/cmd/fix/imagetiled_test.go deleted file mode 100644 index 98a9c0a8d2..0000000000 --- a/src/cmd/fix/imagetiled_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -func init() { - addTestCases(imagetiledTests, imagetiled) -} - -var imagetiledTests = []testCase{ - { - Name: "imagetiled.0", - In: `package main - -import ( - "foo" - "image" -) - -var ( - _ foo.Tiled - _ image.RGBA - _ image.Tiled -) -`, - Out: `package main - -import ( - "foo" - "image" -) - -var ( - _ foo.Tiled - _ image.RGBA - _ image.Repeated -) -`, - }, -} diff --git a/src/pkg/image/names.go b/src/pkg/image/names.go index 04616a5878..55f634c17c 100644 --- a/src/pkg/image/names.go +++ b/src/pkg/image/names.go @@ -50,30 +50,3 @@ func (c *Uniform) Opaque() bool { func NewUniform(c color.Color) *Uniform { return &Uniform{c} } - -// Repeated is an Image that is a source Image translated by -Offset and then -// repeated in all four directions to infinity. -// -// Repeated{src, off}.At(x, y) will equal src.At(x+off.X, y+off.Y) for all -// points {x+off.X, y+off.Y} within src's Bounds. -type Repeated struct { - // I is the source image. - I Image - // Offset is the translation vector from result pixel to source pixel. - Offset Point -} - -func (r *Repeated) ColorModel() color.Model { - return r.I.ColorModel() -} - -func (r *Repeated) Bounds() Rectangle { return Rectangle{Point{-1e9, -1e9}, Point{1e9, 1e9}} } - -func (r *Repeated) At(x, y int) color.Color { - p := Point{x, y}.Add(r.Offset).Mod(r.I.Bounds()) - return r.I.At(p.X, p.Y) -} - -func NewRepeated(i Image, offset Point) *Repeated { - return &Repeated{i, offset} -} -- 2.50.0