Created
October 15, 2014 11:39
-
-
Save kei-s/07ee4d86ad1af7c64aae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go-tour/pic" | |
"image" | |
"image/color" | |
) | |
type Image struct { | |
width int | |
height int | |
} | |
func (i Image) ColorModel() color.Model { | |
return color.RGBAModel | |
} | |
func (i Image) Bounds() image.Rectangle { | |
return image.Rect(0, 0, i.width, i.height) | |
} | |
func (i Image) At(x, y int) color.Color { | |
return color.RGBA{uint8(x), uint8(y), 255, 255} | |
} | |
func main() { | |
m := Image{100, 100} | |
pic.ShowImage(m) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment