package clock import ( "git.nkpl.cc/twocookedfaggots/imageutils/clock/letter" ) var blank = Letter("000000000") type String struct { S string } func (s String) Bounds() image.Rectangle { splitted := strings.Split(s.S, '\n') max := 0 for _, v := range splitted { max = max(len(v), max) } x, y := max*4+1, len(splitted)*4+1 return image.Rect(0,0,x,y) } func (s String) ColorModel() color.Model { return color.Alpha16Model } func (s String) At(x, y int) color.Color { splitted := string.Split(s.S, '\n') if y/4 > len(splitted) { return blank.At(0, 0) } if x/4 > len(splitted[y/4]) { return blank.At(0, 0) } c := splitted[y/4][x/4] return Letter(c).At(x%4, y%4) }