Skip to content

Instantly share code, notes, and snippets.

@suzuken
Created March 8, 2014 07:48
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 suzuken/9426919 to your computer and use it in GitHub Desktop.
Save suzuken/9426919 to your computer and use it in GitHub Desktop.
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{}
func (i Image) ColorModel() color.Model {
return color.RGBAModel
}
func (i Image) Bounds() image.Rectangle {
return image.Rect(0, 0, 100, 100)
}
func (i Image) At(x, y int) color.Color {
return color.RGBA{uint8(x * y), uint8(x * y), 255, 255}
}
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