MCPcopy
hub / github.com/fogleman/primitive / Image

Method Image

primitive/heatmap.go:41–59  ·  view source on GitHub ↗
(gamma float64)

Source from the content-addressed store, hash-verified

39}
40
41func (h *Heatmap) Image(gamma float64) *image.Gray16 {
42 im := image.NewGray16(image.Rect(0, 0, h.W, h.H))
43 var hi uint64
44 for _, h := range h.Count {
45 if h > hi {
46 hi = h
47 }
48 }
49 i := 0
50 for y := 0; y < h.H; y++ {
51 for x := 0; x < h.W; x++ {
52 p := float64(h.Count[i]) / float64(hi)
53 p = math.Pow(p, gamma)
54 im.SetGray16(x, y, color.Gray16{uint16(p * 0xffff)})
55 i++
56 }
57 }
58 return im
59}

Callers 2

mainFunction · 0.80
FramesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected