Loading controllers/isogrids/isogrids.go +15 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,10 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { io.WriteString(h, key) key = fmt.Sprintf("%x", h.Sum(nil)[:]) theme := extract.Theme(r) colorMap := colors.MapOfColorThemes() size := extract.Size(r) theme := extract.Theme(r) numColors := extract.NumColors(r) var bg, fg color.RGBA if bg, err = extract.Background(r); err != nil { Loading @@ -45,7 +47,17 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { fg = val[1] } size := extract.Size(r) var colors []color.RGBA if theme != "base" { if _, ok := colorMap[theme]; ok { colors = append(colors, colorMap[theme][0:numColors]...) } else { colors = append(colors, colorMap["base"]...) } } else { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.Isogrids(w, key, bg, fg, size) draw.Isogrids(w, key, colors, size) } controllers/isogrids/randomMirror.go +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ func RandomMirror(w http.ResponseWriter, r *http.Request) { } else { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.IsogridsRandomMirror(w, "", colors, size) } draw/isogrids.go +3 −3 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ func IsogridsRandomMirror(w http.ResponseWriter, key string, colors []color.RGBA } // Isogrids builds an image with 10x10 grids of half diagonals func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size int) { func Isogrids(w http.ResponseWriter, key string, colors []color.RGBA, size int) { canvas := svg.New(w) canvas.Start(size, size) Loading Loading @@ -157,7 +157,7 @@ func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size } xs := []int{x1, x2, x3} ys := []int{y1, y2, y3} fill1 := fillFromRGBA(colorFromKey(key, color1, color2, (xL+3*yL+lines)%15)) fill1 := fillFromRGBA(colorFromKeyAndArray(key, colors, (xL+3*yL+lines)%15)) canvas.Polygon(xs, ys, fmt.Sprintf("stroke:black;stroke-width:2; %s", fill1)) var x11, x12, x13, y11, y12, y13 int if (xL % 2) == 0 { Loading @@ -177,7 +177,7 @@ func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size } xs1 := []int{x11, x12, x13} ys1 := []int{y11, y12, y13} fill2 := fillFromRGBA(colorFromKey(key, color1, color2, (xL+3*yL+1+lines)%15)) fill2 := fillFromRGBA(colorFromKeyAndArray(key, colors, (xL+3*yL+1+lines)%15)) canvas.Polygon(xs1, ys1, fmt.Sprintf("stroke:black;stroke-width:2; %s", fill2)) // apply mirror: xs[0] = (lines * fringeSize) - xs[0] Loading Loading
controllers/isogrids/isogrids.go +15 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,10 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { io.WriteString(h, key) key = fmt.Sprintf("%x", h.Sum(nil)[:]) theme := extract.Theme(r) colorMap := colors.MapOfColorThemes() size := extract.Size(r) theme := extract.Theme(r) numColors := extract.NumColors(r) var bg, fg color.RGBA if bg, err = extract.Background(r); err != nil { Loading @@ -45,7 +47,17 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { fg = val[1] } size := extract.Size(r) var colors []color.RGBA if theme != "base" { if _, ok := colorMap[theme]; ok { colors = append(colors, colorMap[theme][0:numColors]...) } else { colors = append(colors, colorMap["base"]...) } } else { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.Isogrids(w, key, bg, fg, size) draw.Isogrids(w, key, colors, size) }
controllers/isogrids/randomMirror.go +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ func RandomMirror(w http.ResponseWriter, r *http.Request) { } else { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.IsogridsRandomMirror(w, "", colors, size) }
draw/isogrids.go +3 −3 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ func IsogridsRandomMirror(w http.ResponseWriter, key string, colors []color.RGBA } // Isogrids builds an image with 10x10 grids of half diagonals func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size int) { func Isogrids(w http.ResponseWriter, key string, colors []color.RGBA, size int) { canvas := svg.New(w) canvas.Start(size, size) Loading Loading @@ -157,7 +157,7 @@ func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size } xs := []int{x1, x2, x3} ys := []int{y1, y2, y3} fill1 := fillFromRGBA(colorFromKey(key, color1, color2, (xL+3*yL+lines)%15)) fill1 := fillFromRGBA(colorFromKeyAndArray(key, colors, (xL+3*yL+lines)%15)) canvas.Polygon(xs, ys, fmt.Sprintf("stroke:black;stroke-width:2; %s", fill1)) var x11, x12, x13, y11, y12, y13 int if (xL % 2) == 0 { Loading @@ -177,7 +177,7 @@ func Isogrids(w http.ResponseWriter, key string, color1, color2 color.RGBA, size } xs1 := []int{x11, x12, x13} ys1 := []int{y11, y12, y13} fill2 := fillFromRGBA(colorFromKey(key, color1, color2, (xL+3*yL+1+lines)%15)) fill2 := fillFromRGBA(colorFromKeyAndArray(key, colors, (xL+3*yL+1+lines)%15)) canvas.Polygon(xs1, ys1, fmt.Sprintf("stroke:black;stroke-width:2; %s", fill2)) // apply mirror: xs[0] = (lines * fringeSize) - xs[0] Loading