LoginSignup
0
0

More than 5 years have passed since last update.

A Tour of Go Exercise: Slices #36

Last updated at Posted at 2015-01-06

誰かソースチェックお願いします。

package main

import "code.google.com/p/go-tour/pic"

func Pic(dx, dy int) [][]uint8 {

    ret := make([][]uint8, 0, dy)

    for i := 0; i < cap(ret); i++ {

        row := make([]uint8, dx)        
        for j := range row { 
            row[j] = uint8(j * i / 10)
        }

        ret = append(ret, row) 
    }
    return ret
}

func main() {
    pic.Show(Pic)
}

表示された画像

スクリーンショット 2015-01-06 9.45.35.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0