From 44e7b6498bf1c62556aba151390d5dd1ec160a89 Mon Sep 17 00:00:00 2001 From: Iaroslav Omelianenko Date: Tue, 30 Jul 2024 15:26:51 +0300 Subject: [PATCH] Added image scale factor to the maze_utils.go --- tools/maze_utils.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/maze_utils.go b/tools/maze_utils.go index d1b028e..c2f8684 100644 --- a/tools/maze_utils.go +++ b/tools/maze_utils.go @@ -245,6 +245,7 @@ func main() { var bestThreshold = flag.Float64("b_thresh", 0.8, "The minimal fitness of maze solving agent's species to be considered as the best ones.") var operation = flag.String("operation", "draw_agents", "The name of operation to apply to the records [draw_agents, draw_path].") var groupByAge = flag.Bool("group_by_age", false, "The flag to indicate whether agent records should be grouped by age of species") + var scale = flag.Float64("scale", 1.0, "The scale factor for produced graphics") flag.Parse() @@ -268,7 +269,13 @@ func main() { log.Fatalf("Failed to open maze config file: %s\n", *mazePath) } - dc := gg.NewContext(*width, *height) + contextWidth := float64(*width) * *scale + contextHeight := float64(*height) * *scale + dc := gg.NewContext(int(contextWidth), int(contextHeight)) + // scale renderings if needed + if *scale != 1.0 { + dc.Scale(*scale, *scale) + } // set background dc.SetColor(color.White)