Пример #1
0
func Image(f *data.Slice, fmin, fmax string) *image.NRGBA {
	dim := f.NComp()
	switch dim {
	default:
		log.Fatalf("unsupported number of components: %v", dim)
	case 3:
		return drawVectors(f.Vectors())
	case 1:
		min, max := extrema(f.Host()[0])
		if fmin != "auto" {
			m, err := strconv.ParseFloat(fmin, 32)
			util.FatalErr(err)
			min = float32(m)
		}
		if fmax != "auto" {
			m, err := strconv.ParseFloat(fmax, 32)
			util.FatalErr(err)
			max = float32(m)
		}
		return drawFloats(f.Scalars(), min, max)
	}
	panic("unreachable")
}