The old <code>image.ColorImage</code> type is still in the <code>image</code>
package but has been renamed
<a href="/pkg/image/#Uniform"><code>image.Uniform</code></a>,
-while <code>image.Tiled</code>
-has been renamed
-<a href="/pkg/image/#Repeated"><code>image.Repeated</code></a>.
+while <code>image.Tiled</code> has been removed.
</p>
<p>
<td colspan="2"><hr></td>
</tr>
<tr><td>image.ColorImage</td> <td>image.Uniform</td></tr>
-<tr><td>image.Tiled</td> <td>image.Repeated</td></tr>
</table>
<p>
The old <code>image.ColorImage</code> type is still in the <code>image</code>
package but has been renamed
<a href="/pkg/image/#Uniform"><code>image.Uniform</code></a>,
-while <code>image.Tiled</code>
-has been renamed
-<a href="/pkg/image/#Repeated"><code>image.Repeated</code></a>.
+while <code>image.Tiled</code> has been removed.
</p>
<p>
<td colspan="2"><hr></td>
</tr>
<tr><td>image.ColorImage</td> <td>image.Uniform</td></tr>
-<tr><td>image.Tiled</td> <td>image.Repeated</td></tr>
</table>
<p>
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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
-)
-`,
- },
-}
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}
-}