blob: 60d9c5e6a0c85e9a2d2f62c75d86606773a41ad2 [file] [log] [blame]
// 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.
// +build ignore
package main
import (
"image"
"image/color"
"golang.org/x/tour/pic"
)
type Image struct {
Height, Width int
}
func (m Image) ColorModel() color.Model {
return color.RGBAModel
}
func (m Image) Bounds() image.Rectangle {
return image.Rect(0, 0, m.Height, m.Width)
}
func (m Image) At(x, y int) color.Color {
c := uint8(x ^ y)
return color.RGBA{c, c, 255, 255}
}
func main() {
m := Image{256, 256}
pic.ShowImage(m)
}