mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-03 00:20:48 +02:00
Implement fetaure request issue #17
mtseeder and mtwebmapper got an option to set the background color where no nodes are generated, yet.
This commit is contained in:
@ -23,6 +23,7 @@ func main() {
|
||||
x, y, z int
|
||||
width, height, depth int
|
||||
colorsfile string
|
||||
bgColor string
|
||||
outfile string
|
||||
shaded bool
|
||||
transparent bool
|
||||
@ -31,6 +32,8 @@ func main() {
|
||||
version bool
|
||||
)
|
||||
|
||||
defaultBgColor := common.ColorToHex(common.BackgroundColor)
|
||||
|
||||
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
||||
flag.IntVar(&port, "p", 6379, "port to of mtredisalize server (shorthand)")
|
||||
flag.StringVar(&host, "host", "localhost", "host to mtredisalize server")
|
||||
@ -44,6 +47,8 @@ func main() {
|
||||
flag.IntVar(&height, "h", 16, "height of query cuboid (shorthand)")
|
||||
flag.IntVar(&depth, "d", 150, "depth of query cuboid (shorthand)")
|
||||
flag.StringVar(&colorsfile, "colors", "colors.txt", "definition of colors")
|
||||
flag.StringVar(&bgColor, "background", defaultBgColor, "background color")
|
||||
flag.StringVar(&bgColor, "bg", defaultBgColor, "background color (shorthand)")
|
||||
flag.StringVar(&outfile, "output", "out.png", "image file of result")
|
||||
flag.StringVar(&outfile, "o", "out.png", "image file of result (shorthand)")
|
||||
flag.BoolVar(&shaded, "shaded", true, "draw relief")
|
||||
@ -60,6 +65,13 @@ func main() {
|
||||
common.PrintVersionAndExit()
|
||||
}
|
||||
|
||||
var bg color.RGBA
|
||||
var err error
|
||||
if bg, err = common.ParseColor(bgColor); err != nil {
|
||||
log.Printf("WARN: Cannot parse background color '%s': %s\n", bgColor, err)
|
||||
bg = common.BackgroundColor
|
||||
}
|
||||
|
||||
if cpuProfile != "" {
|
||||
f, err := os.Create(cpuProfile)
|
||||
if err != nil {
|
||||
@ -69,9 +81,7 @@ func main() {
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
||||
var err error
|
||||
var colors *common.Colors
|
||||
|
||||
if colors, err = common.ParseColors(colorsfile); err != nil {
|
||||
log.Fatalf("Cannot open color file: %s", err)
|
||||
}
|
||||
@ -134,10 +144,9 @@ func main() {
|
||||
if shaded {
|
||||
image = renderer.CreateShadedImage(
|
||||
16, 16, (width-2)*16, (height-2)*16,
|
||||
colors, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})
|
||||
colors, bg)
|
||||
} else {
|
||||
image = renderer.CreateImage(
|
||||
colors.Colors, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})
|
||||
image = renderer.CreateImage(colors.Colors, bg)
|
||||
}
|
||||
|
||||
if err = common.SaveAsPNG(outfile, image); err != nil {
|
||||
|
Reference in New Issue
Block a user