Skip to content

Instantly share code, notes, and snippets.

@sorah sorah/62.go
Created May 2, 2014

Embed
What would you like to do?
// http://tour.golang.org/#62
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{}
func (img Image) ColorModel() color.Model {
return color.RGBAModel
}
func (img Image) Bounds() image.Rectangle {
return image.Rect(0,0,100,100)
}
func (img Image) At(x, y int) color.Color {
return &color.RGBA{uint8(x*10),uint8(y*10),100,100}
}
func main() {
m := Image{}
pic.ShowImage(m)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.