Skip to content

Instantly share code, notes, and snippets.

@harryhare
Created December 25, 2017 11:59
Show Gist options
  • Save harryhare/3c390c2f35e62ecfd96a789ca71e9d3e to your computer and use it in GitHub Desktop.
Save harryhare/3c390c2f35e62ecfd96a789ca71e9d3e to your computer and use it in GitHub Desktop.
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct{}
func (i Image)Bounds() image.Rectangle{
return image.Rect(0,0,256,256)
}
func (i Image)ColorModel() color.Model{
return color.RGBAModel
}
func (i Image)At(x,y int) color.Color{
sum:=uint8(x^y)
return color.RGBA{sum,sum,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