Advertisement
Guest User

Untitled

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