mv image to example dir
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
barnsley-fern
|
||||
barnsley-fern-go
|
||||
barnsley_fern.png
|
||||
barnsley-fern.png
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# barnsley-fern-go
|
||||
Implementation of Barnsley Fern in Go
|
||||
|
||||

|
||||

|
||||
|
||||
From the root of the repository
|
||||
```bash
|
||||
|
@@ -36,17 +36,6 @@ func newColorFunc(random bool, timed bool, rainbow bool) func(float64, float64)
|
||||
|
||||
switch {
|
||||
case random:
|
||||
// n := rand.Intn(3)
|
||||
|
||||
// switch n {
|
||||
// case 0:
|
||||
// r = 255
|
||||
// case 1:
|
||||
// g = 255
|
||||
// case 2:
|
||||
// b = 255
|
||||
// }
|
||||
|
||||
r = uint8(rand.Intn(256))
|
||||
g = uint8(rand.Intn(256))
|
||||
b = uint8(rand.Intn(256))
|
||||
@@ -126,20 +115,18 @@ func drawBarnsleyFern(img *image.RGBA, colorfunc func(float64, float64) color.Co
|
||||
|
||||
func main() {
|
||||
var (
|
||||
filename string = "barnsley_fern.png"
|
||||
h = flag.Int("h", 1920, "размер картинки по горизонтали")
|
||||
v = flag.Int("v", 1080, "размер картинки по вертикали")
|
||||
dots = flag.Int("d", 100000, "сколько точек рисовать")
|
||||
rand = flag.Bool("rand", false, "использовать случайные цвета")
|
||||
timed = flag.Bool("timed", false, "привязка к наносекундам времени исполнения")
|
||||
rainbow = flag.Bool("rainbow", false, "привязка к координатам")
|
||||
img *image.RGBA
|
||||
f *os.File
|
||||
err error
|
||||
filename = flag.String("out", "barnsley-fern.png", "полный путь файла для записи изображения")
|
||||
)
|
||||
|
||||
flag.Parse()
|
||||
|
||||
img = createImage(*h, *v)
|
||||
img := createImage(*h, *v)
|
||||
|
||||
fillBackground(img, color.White)
|
||||
|
||||
@@ -147,9 +134,9 @@ func main() {
|
||||
|
||||
drawBarnsleyFern(img, colorfunc, *dots)
|
||||
|
||||
f, err = os.Create(filename)
|
||||
f, err := os.Create(*filename)
|
||||
if err != nil {
|
||||
fmt.Printf("не удалось создать файл %s: %v", filename, err)
|
||||
fmt.Printf("не удалось создать файл %s: %v", *filename, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 56 KiB |
BIN
example/barnsley-fern.png
Normal file
BIN
example/barnsley-fern.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
Reference in New Issue
Block a user