Last active
January 15, 2017 00:10
-
-
Save amstee/26c11708a9dc79fc9e0b7bb9f935134f to your computer and use it in GitHub Desktop.
An answer for the exercise images
This file contains hidden or 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
| import "image" | |
| import "image/color" | |
| type Image struct{ | |
| x int | |
| y int | |
| } | |
| func (im Image) Bounds() (image.Rectangle) { | |
| return image.Rect(0, 0, im.x, im.y) | |
| } | |
| func (im Image) ColorModel() (color.Model) { | |
| return color.RGBAModel | |
| } | |
| func (im Image) At(x, y int) (color.Color) { | |
| v := uint8((x + y) / 2) | |
| return color.RGBA{v, v, 255, 255} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment