func ReadThemes() [][]color.Color { buf := bytes.NewBufferString(c1) r := bufio.NewReader(buf) themes := make([][]color.Color, 0) line, err := r.ReadString('\n') for { if err != nil && io.EOF == err { break } line, err = r.ReadString('\n') line = strings.TrimRight(line, "\n") colors := make([]color.Color, 0) clrs := strings.Split(line, " ") for _, c := range clrs { if c != "" { rgb := hex_color.HexColor(c) colors = append(colors, rgb) } } themes = append(themes, colors) } return themes }
func (d *GrainLine) Render() { d.Clear("fff") d.Scale(1.0, -1.0) d.Translate(0.0, -d.Dim.Y) pos := vec.New(100.0, 100.0) v := vec.New(Cos(PI/6.0), Sin(PI/6.0)) for y := 101.0; y < 110.0; y++ { c := hex_color.HexColor("0f0") d.SetStrokeColor(c) a := vec.New(pos.Pts()) for s := 1.0; s < 100.0; s++ { c.WithAlpha((101.0 - s) / 100.0) d.SetStrokeColor(c) d.BeginPath() d.MoveTo(a.Pts()) a = v.Scale(s, s).Add(*pos) d.LineTo(a.Pts()) d.Stroke() } pos = vec.New(pos.X, y) } }
func (g *Canvas) Clear(hex string) { g.SetFillColor(hex_color.HexColor(hex)) g.ClearRect(g.Points()) }