Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "golang.org/x/tour/pic"
- "image"
- "image/color"
- )
- type Image struct {
- w int
- h int
- v uint8
- }
- func (t Image) At(x, y int) color.Color {
- return color.RGBA{t.v, t.v, 255, 155}
- }
- func (t Image) Bounds() image.Rectangle {
- return image.Rect(0, 0, t.w, t.h)
- }
- func (t Image) ColorModel() color.Model {
- return color.RGBAModel
- }
- func main() {
- m := Image{100, 50, 120}
- pic.ShowImage(m)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement