Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. package main
  2.  
  3. import "golang.org/x/tour/pic"
  4.  
  5. import (
  6. "image"
  7. "image/color"
  8. )
  9.  
  10. type Image struct{}
  11.  
  12. func (m Image) ColorModel() color.Model {
  13. return color.RGBAModel
  14. }
  15.  
  16. func (m Image) Bounds() image.Rectangle {
  17. return image.Rect(0, 0, 255, 255)
  18. }
  19.  
  20. func (m Image) At(x, y int) color.Color {
  21. var v = uint8(x*y)
  22. return color.RGBA{v, v, 255, 255}
  23. }
  24.  
  25. func main() {
  26. m := Image{}
  27. pic.ShowImage(m)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement