Add label for IP address of pod that renders tile

This commit is contained in:
Steven Polley 2018-08-02 14:37:10 -06:00
parent 4f70304c9f
commit d915863039
1 changed files with 11 additions and 7 deletions

View File

@ -8,12 +8,17 @@ import (
"log"
"math"
"math/cmplx"
"net"
"net/http"
"runtime"
"strconv"
"strings"
"sync"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
"deadbeef.codes/steven/mandelmapper/palette"
)
@ -115,11 +120,11 @@ func renderTile(w http.ResponseWriter, r *http.Request) {
}
wg.Wait()
/*
//ip := GetOutboundIP()
//addLabel(img, 20, 30, fmt.Sprintf("rendered by \n%s", ip.String()))
//addLabel(img, 20, 30, fmt.Sprintf("%s/%s/%s.png", components[1], components[2], components[3]))
*/
ip := GetOutboundIP()
addLabel(img, 20, 30, fmt.Sprintf("rendered by \n%s", ip.String()))
//addLabel(img, 20, 30, fmt.Sprintf("%s/%s/%s.png", components[1], components[2], components[3]))
w.Header().Set("Content-Type", "image/png")
png.Encode(w, img)
}
@ -198,7 +203,7 @@ func linearInterpolation(c1, c2, mu uint32) uint32 {
}
//Adds a text label to an image
/*
func addLabel(img *image.RGBA, x, y int, label string) {
col := color.RGBA{255, 255, 255, 255}
point := fixed.Point26_6{fixed.Int26_6(x * 64), fixed.Int26_6(y * 64)}
@ -223,4 +228,3 @@ func GetOutboundIP() net.IP {
return localAddr.IP
}
*/