-bump github.com/tribalwarshelp/shared

-change larger and normal marker size
This commit is contained in:
Dawid Wysokiński 2020-12-30 14:47:31 +01:00
parent fb06ce0a6b
commit 6cc9aafa59
5 changed files with 38 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 KiB

After

Width:  |  Height:  |  Size: 586 KiB

View File

@ -12,7 +12,7 @@ import (
func main() {
villages := generateVillages(10)
// villages2 := generateVillages(1)
villages2 := generateVillages(0.01)
t1 := time.Now()
f, _ := os.Create("image.jpeg")
defer f.Close()
@ -24,30 +24,25 @@ func main() {
ContinentNumbers: true,
Markers: []*generator.Marker{
&generator.Marker{
Color: "#f0f",
Color: "#f00",
Villages: villages,
Larger: false,
},
&generator.Marker{
Color: "#fff",
Villages: []*models.Village{
&models.Village{
X: 550,
Y: 550,
},
},
Larger: true,
Color: "#fff",
Villages: villages2,
Larger: true,
},
},
})
log.Println(time.Now().Sub(t1).String(), err)
}
func generateVillages(ch int) []*models.Village {
func generateVillages(ch float32) []*models.Village {
villages := []*models.Village{}
for y := 0; y <= 1000; y++ {
for x := 0; x <= 1000; x++ {
if rand.Intn(100) <= ch {
if rand.Float32()*100 <= ch {
villages = append(villages, &models.Village{
X: x,
Y: y,

View File

@ -109,18 +109,20 @@ func Generate(cfg Config) error {
return err
}
for _, village := range m.Villages {
limit := 1
if m.Larger {
for y := 1; y <= 1; y++ {
for x := 1; x <= 1; x++ {
img.Set(village.X+x, village.Y, parsedColor)
img.Set(village.X-x, village.Y, parsedColor)
img.Set(village.X, village.Y+y, parsedColor)
img.Set(village.X, village.Y-y, parsedColor)
img.Set(village.X+x, village.Y-y, parsedColor)
img.Set(village.X-x, village.Y-y, parsedColor)
img.Set(village.X+x, village.Y+y, parsedColor)
img.Set(village.X-x, village.Y+y, parsedColor)
}
limit = 4
}
for y := 1; y <= limit; y++ {
for x := 1; x <= limit; x++ {
img.Set(village.X+x, village.Y, parsedColor)
img.Set(village.X-x, village.Y, parsedColor)
img.Set(village.X, village.Y+y, parsedColor)
img.Set(village.X, village.Y-y, parsedColor)
img.Set(village.X+x, village.Y-y, parsedColor)
img.Set(village.X-x, village.Y-y, parsedColor)
img.Set(village.X+x, village.Y+y, parsedColor)
img.Set(village.X-x, village.Y+y, parsedColor)
}
}
img.Set(village.X, village.Y, parsedColor)

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.14
require (
github.com/disintegration/imaging v1.6.2
github.com/pkg/errors v0.9.1
github.com/tribalwarshelp/shared v0.0.0-20200622084436-3a768c8bf574
github.com/tribalwarshelp/shared v0.0.0-20201225112152-d1d8bc92fc33
golang.org/x/image v0.0.0-20200618115811-c13761719519
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
)

17
go.sum
View File

@ -1,12 +1,29 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tribalwarshelp/shared v0.0.0-20200622084436-3a768c8bf574 h1:y2EoH6zRK9Uc0AeswnJRYUUIQYcSLZB5VDFuxPCKxNM=
github.com/tribalwarshelp/shared v0.0.0-20200622084436-3a768c8bf574/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y=
github.com/tribalwarshelp/shared v0.0.0-20201225112152-d1d8bc92fc33 h1:ItFd9kzpvO69r3Ta7S8+3OT6Wc56Ga5MEGBYW7DotUE=
github.com/tribalwarshelp/shared v0.0.0-20201225112152-d1d8bc92fc33/go.mod h1:Lxk6zaQhPTPrgz9ksMgg51m8XgflrCo/kRBx2cM3yfk=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20200618115811-c13761719519 h1:1e2ufUJNM3lCHEY5jIgac/7UTjd6cgJNdatjPdFWf34=
golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=