Skip to content

Instantly share code, notes, and snippets.

@sorah
Created May 2, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorah/cb9f929bb7c5d2436db4 to your computer and use it in GitHub Desktop.
Save sorah/cb9f929bb7c5d2436db4 to your computer and use it in GitHub Desktop.
// 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