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

|

|
||||||
|
|
||||||
From the root of the repository
|
From the root of the repository
|
||||||
```bash
|
```bash
|
||||||
|
@@ -36,17 +36,6 @@ func newColorFunc(random bool, timed bool, rainbow bool) func(float64, float64)
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case random:
|
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))
|
r = uint8(rand.Intn(256))
|
||||||
g = uint8(rand.Intn(256))
|
g = uint8(rand.Intn(256))
|
||||||
b = 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() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
filename string = "barnsley_fern.png"
|
|
||||||
h = flag.Int("h", 1920, "размер картинки по горизонтали")
|
h = flag.Int("h", 1920, "размер картинки по горизонтали")
|
||||||
v = flag.Int("v", 1080, "размер картинки по вертикали")
|
v = flag.Int("v", 1080, "размер картинки по вертикали")
|
||||||
dots = flag.Int("d", 100000, "сколько точек рисовать")
|
dots = flag.Int("d", 100000, "сколько точек рисовать")
|
||||||
rand = flag.Bool("rand", false, "использовать случайные цвета")
|
rand = flag.Bool("rand", false, "использовать случайные цвета")
|
||||||
timed = flag.Bool("timed", false, "привязка к наносекундам времени исполнения")
|
timed = flag.Bool("timed", false, "привязка к наносекундам времени исполнения")
|
||||||
rainbow = flag.Bool("rainbow", false, "привязка к координатам")
|
rainbow = flag.Bool("rainbow", false, "привязка к координатам")
|
||||||
img *image.RGBA
|
filename = flag.String("out", "barnsley-fern.png", "полный путь файла для записи изображения")
|
||||||
f *os.File
|
|
||||||
err error
|
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
img = createImage(*h, *v)
|
img := createImage(*h, *v)
|
||||||
|
|
||||||
fillBackground(img, color.White)
|
fillBackground(img, color.White)
|
||||||
|
|
||||||
@@ -147,9 +134,9 @@ func main() {
|
|||||||
|
|
||||||
drawBarnsleyFern(img, colorfunc, *dots)
|
drawBarnsleyFern(img, colorfunc, *dots)
|
||||||
|
|
||||||
f, err = os.Create(filename)
|
f, err := os.Create(*filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("не удалось создать файл %s: %v", filename, err)
|
fmt.Printf("не удалось создать файл %s: %v", *filename, err)
|
||||||
return
|
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