This commit is contained in:
parent
77f367ef23
commit
d475ea5083
19
render.go
19
render.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
@ -14,6 +15,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"deadbeef.codes/steven/mandelmapper/palette"
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/font/basicfont"
|
||||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -167,6 +171,8 @@ func renderTile(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
addLabel(img, 10, 10, fmt.Sprintf("%d/%d/%d", tileZoom, tileX, tileY))
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
png.Encode(w, img)
|
||||
}
|
||||
@ -181,3 +187,16 @@ func mandelbrot(c complex128) uint16 {
|
||||
}
|
||||
return Iterations
|
||||
}
|
||||
|
||||
func addLabel(img *image.RGBA, x, y int, label string) {
|
||||
col := color.RGBA{200, 100, 0, 255}
|
||||
point := fixed.Point26_6{fixed.Int26_6(x * 64), fixed.Int26_6(y * 64)}
|
||||
|
||||
d := &font.Drawer{
|
||||
Dst: img,
|
||||
Src: image.NewUniform(col),
|
||||
Face: basicfont.Face7x13,
|
||||
Dot: point,
|
||||
}
|
||||
d.DrawString(label)
|
||||
}
|
||||
|
2
web.go
2
web.go
@ -18,7 +18,7 @@ func init() {
|
||||
<head>
|
||||
<title>MandelMapper</title>
|
||||
|
||||
<meta property="og:url" content="http://mc.deadbeef.codes/" />
|
||||
<meta property="og:url" content="https://mandelmap.deadbeef.codes/" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Mandelbrot Mapper">
|
||||
<meta property="og:description" content="A Google maps front end to a distributed real-time fractal renderer">
|
||||
|
Loading…
Reference in New Issue
Block a user