map-dots/imaging/generate.go

22 lines
510 B
Go
Raw Normal View History

2023-08-11 14:32:44 +01:00
package imaging
2023-08-11 15:33:18 +01:00
import (
"fmt"
"image"
2023-08-11 19:34:32 +01:00
"git.fjla.uk/fred.boniface/map-dots/data"
2023-08-11 15:33:18 +01:00
"git.fjla.uk/fred.boniface/map-dots/log"
)
2023-08-11 14:32:44 +01:00
2023-08-11 19:34:32 +01:00
func Generate(height, width int, style, format string, data []data.LocationData) image.Image {
2023-08-11 15:33:18 +01:00
log.Msg.Debug("Image generation request: " + fmt.Sprint(width) + "x" + fmt.Sprint(height) + " " + format + " " + style)
2023-08-11 14:32:44 +01:00
img := createCanvas(width, height)
2023-08-11 20:51:46 +01:00
switch style {
case "circle":
log.Msg.Debug("Selected style is circles")
mapCirclesToCanvas(img, data)
}
2023-08-11 14:32:44 +01:00
return img
}