Hochwasser/pixelflut/fetch.go

20 lines
384 B
Go
Raw Normal View History

package pixelflut
import (
"fmt"
"image"
)
2020-02-06 01:01:05 +01:00
func CmdsFetchImage(bounds image.Rectangle) (cmds Commands) {
cmds = make([][]byte, bounds.Size().X*bounds.Size().Y)
numCmds := 0
for x := bounds.Min.X; x < bounds.Max.X; x++ {
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
cmd := fmt.Sprintf("PX %d %d\n", x, y)
cmds[numCmds] = []byte(cmd)
numCmds++
}
}
2020-02-06 01:01:05 +01:00
return cmds
}