package main import ( "flag" "image/color" ) type colormode int const ( cdefault colormode = iota crandom ctimed crainbow ) type outputmode int const ( outputpng outputmode = iota outputvideo ) type settings struct { X, Y int // image size Dots int // dots to draw for single image BG color.Color // background color CM colormode // settings for colorFunc } func parseSettings() (string, *settings) { var ( x, y int dots int cmode int fname string ) flag.IntVar(&x, "x", 1920, "размер картинки по горизонтали") flag.IntVar(&y, "y", 1080, "размер картинки по вертикали") flag.IntVar(&dots, "d", 100000, "сколько точек рисовать") flag.IntVar(&cmode, "color", 0, "color mode: 0 - default green, 1 - random, 2 - timed, 3 - rainbow") flag.StringVar(&fname, "out", "barnsley-fern.png", "полный путь файла для записи изображения") flag.Parse() s := &settings{ X: x, Y: y, Dots: dots, BG: color.White, CM: colormode(cmode), } return fname, s }