2019-01-10 17:21:34 +03:00
|
|
|
package mapblockrenderer
|
|
|
|
|
|
|
|
import (
|
2019-01-10 19:50:31 +03:00
|
|
|
"mapserver/colormapping"
|
|
|
|
"mapserver/coords"
|
2019-01-11 12:24:10 +03:00
|
|
|
"mapserver/mapblockaccessor"
|
2019-01-11 13:44:17 +03:00
|
|
|
"image"
|
|
|
|
"image/color"
|
2019-01-10 17:21:34 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type MapBlockRenderer struct {
|
2019-01-11 12:24:10 +03:00
|
|
|
accessor *mapblockaccessor.MapBlockAccessor
|
2019-01-10 19:50:31 +03:00
|
|
|
colors *colormapping.ColorMapping
|
2019-01-10 17:21:34 +03:00
|
|
|
}
|
|
|
|
|
2019-01-11 12:24:10 +03:00
|
|
|
func NewMapBlockRenderer(accessor *mapblockaccessor.MapBlockAccessor, colors *colormapping.ColorMapping) MapBlockRenderer {
|
|
|
|
return MapBlockRenderer{accessor: accessor, colors: colors}
|
2019-01-10 17:21:34 +03:00
|
|
|
}
|
|
|
|
|
2019-01-11 13:44:17 +03:00
|
|
|
const (
|
|
|
|
IMG_SCALE = 16
|
|
|
|
IMG_SIZE = IMG_SCALE * 16
|
|
|
|
)
|
|
|
|
|
|
|
|
func (r *MapBlockRenderer) Render(pos1, pos2 coords.MapBlockCoords) *image.RGBA {
|
|
|
|
upLeft := image.Point{0, 0}
|
|
|
|
lowRight := image.Point{IMG_SIZE, IMG_SIZE}
|
|
|
|
|
|
|
|
img := image.NewRGBA(image.Rectangle{upLeft, lowRight})
|
|
|
|
cyan := color.RGBA{100, 200, 200, 0xff}
|
|
|
|
img.Set(10, 10, cyan)
|
|
|
|
return img
|
2019-01-10 17:21:34 +03:00
|
|
|
}
|