Skip to content

Instantly share code, notes, and snippets.

@tuncatunc
Created July 2, 2022 18:28
Show Gist options
  • Save tuncatunc/75dcef89b14ca7a42e8e2bd284d3c56b to your computer and use it in GitHub Desktop.
Save tuncatunc/75dcef89b14ca7a42e8e2bd284d3c56b to your computer and use it in GitHub Desktop.
package main
import "golang.org/x/tour/pic"
import "image"
import "image/color"
type Image struct{
w int
h int
}
func (img Image) ColorModel() color.Model {
return color.RGBAModel
}
func (img Image) Bounds() image.Rectangle{
return image.Rect(0, 0, 64, 64)
}
func (img Image) At(x, y int) color.Color {
return color.RGBA{uint8(x+y), uint8(x+y), 64, 64}
}
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