Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Created July 21, 2013 08:17
Show Gist options
  • Select an option

  • Save tmtk75/6047903 to your computer and use it in GitHub Desktop.

Select an option

Save tmtk75/6047903 to your computer and use it in GitHub Desktop.
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type MyImage struct{}
func (p *MyImage) Bounds() image.Rectangle {
return image.Rect(0, 0, 128, 96)
}
func (p *MyImage) ColorModel() color.Model {
return color.RGBAModel
}
func (p *MyImage) At(x, y int) color.Color {
return color.RGBA{0, 68, 255, 128}
}
func NewMyImage(w, h int) *MyImage {
i := MyImage{}
return &i
}
func main() {
m := NewMyImage(0, 0)
pic.ShowImage(m)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment