Created
July 2, 2022 18:28
-
-
Save tuncatunc/75dcef89b14ca7a42e8e2bd284d3c56b 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 "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