Loading controllers/checkerboard/checkerboard.go +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/squares" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/format" "github.com/taironas/tinygraphs/write" Loading @@ -34,11 +34,11 @@ func Checkerboard(w http.ResponseWriter, r *http.Request) { } if f := extract.Format(r); f == format.JPEG { m := image.NewRGBA(image.Rect(0, 0, size, size)) draw.Grid6X6(m, c1, c2) squares.Grid6X6(m, c1, c2) var img image.Image = m write.ImageJPEG(w, &img) } else if f == format.SVG { write.ImageSVG(w) draw.Grid6X6SVG(w, c1, c2, size) squares.Grid6X6SVG(w, c1, c2, size) } } controllers/isogrids/diagonals.go +5 −5 Original line number Diff line number Diff line Loading @@ -5,13 +5,13 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) // Diagonals is the handler for /isogrids/labs/diagonals // builds a 10x10 full diagonal grid. // builds a full diagonal grid. func Diagonals(w http.ResponseWriter, r *http.Request) { colorMap := colors.MapOfColorThemes() Loading @@ -25,11 +25,11 @@ func Diagonals(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.Diagonals(w, "", bg, fg, size) isogrids.Diagonals(w, "", bg, fg, size) } // Diagonals is the handler for /isogrids/labs/diagonals // builds a 10x10 half diagonal (each diagonal goes to the middle of the square) grid. // builds a half diagonal (each diagonal goes to the middle of the square) grid. func HalfDiagonals(w http.ResponseWriter, r *http.Request) { colorMap := colors.MapOfColorThemes() Loading @@ -43,5 +43,5 @@ func HalfDiagonals(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.HalfDiagonals(w, "", bg, fg, size) isogrids.HalfDiagonals(w, "", bg, fg, size) } controllers/isogrids/hexa.go +3 −3 Original line number Diff line number Diff line Loading @@ -9,13 +9,13 @@ import ( "github.com/taironas/route" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) // Hexa is the handler for /isogrids/hexa/:key // builds an hexagon from a 10x10 grid with alternate colors. // builds an hexagon with alternate colors. func Hexa(w http.ResponseWriter, r *http.Request) { var err error colorMap := colors.MapOfColorThemes() Loading Loading @@ -56,5 +56,5 @@ func Hexa(w http.ResponseWriter, r *http.Request) { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.IsogridsHexa(w, key, colors, size, lines) isogrids.IsogridsHexa(w, key, colors, size, lines) } controllers/isogrids/isogrids.go +2 −2 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ import ( "github.com/taironas/route" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) Loading Loading @@ -59,5 +59,5 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { } write.ImageSVG(w) draw.Isogrids(w, key, colors, size) isogrids.Isogrids(w, key, colors, size) } controllers/isogrids/labs.go +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) Loading @@ -25,7 +25,7 @@ func GridBW(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.IsogridsBW(w, "", bg, fg, size) isogrids.IsogridsBW(w, "", bg, fg, size) } // Grid2Colors is the handler for /isogrids/labs/grid2colors Loading @@ -34,5 +34,5 @@ func Grid2Colors(w http.ResponseWriter, r *http.Request) { size := extract.Size(r) write.ImageSVG(w) draw.Isogrids2Colors(w, "", size) isogrids.Isogrids2Colors(w, "", size) } Loading
controllers/checkerboard/checkerboard.go +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/squares" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/format" "github.com/taironas/tinygraphs/write" Loading @@ -34,11 +34,11 @@ func Checkerboard(w http.ResponseWriter, r *http.Request) { } if f := extract.Format(r); f == format.JPEG { m := image.NewRGBA(image.Rect(0, 0, size, size)) draw.Grid6X6(m, c1, c2) squares.Grid6X6(m, c1, c2) var img image.Image = m write.ImageJPEG(w, &img) } else if f == format.SVG { write.ImageSVG(w) draw.Grid6X6SVG(w, c1, c2, size) squares.Grid6X6SVG(w, c1, c2, size) } }
controllers/isogrids/diagonals.go +5 −5 Original line number Diff line number Diff line Loading @@ -5,13 +5,13 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) // Diagonals is the handler for /isogrids/labs/diagonals // builds a 10x10 full diagonal grid. // builds a full diagonal grid. func Diagonals(w http.ResponseWriter, r *http.Request) { colorMap := colors.MapOfColorThemes() Loading @@ -25,11 +25,11 @@ func Diagonals(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.Diagonals(w, "", bg, fg, size) isogrids.Diagonals(w, "", bg, fg, size) } // Diagonals is the handler for /isogrids/labs/diagonals // builds a 10x10 half diagonal (each diagonal goes to the middle of the square) grid. // builds a half diagonal (each diagonal goes to the middle of the square) grid. func HalfDiagonals(w http.ResponseWriter, r *http.Request) { colorMap := colors.MapOfColorThemes() Loading @@ -43,5 +43,5 @@ func HalfDiagonals(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.HalfDiagonals(w, "", bg, fg, size) isogrids.HalfDiagonals(w, "", bg, fg, size) }
controllers/isogrids/hexa.go +3 −3 Original line number Diff line number Diff line Loading @@ -9,13 +9,13 @@ import ( "github.com/taironas/route" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) // Hexa is the handler for /isogrids/hexa/:key // builds an hexagon from a 10x10 grid with alternate colors. // builds an hexagon with alternate colors. func Hexa(w http.ResponseWriter, r *http.Request) { var err error colorMap := colors.MapOfColorThemes() Loading Loading @@ -56,5 +56,5 @@ func Hexa(w http.ResponseWriter, r *http.Request) { colors = append(colors, bg, fg) } write.ImageSVG(w) draw.IsogridsHexa(w, key, colors, size, lines) isogrids.IsogridsHexa(w, key, colors, size, lines) }
controllers/isogrids/isogrids.go +2 −2 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ import ( "github.com/taironas/route" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) Loading Loading @@ -59,5 +59,5 @@ func Isogrids(w http.ResponseWriter, r *http.Request) { } write.ImageSVG(w) draw.Isogrids(w, key, colors, size) isogrids.Isogrids(w, key, colors, size) }
controllers/isogrids/labs.go +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import ( "net/http" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" "github.com/taironas/tinygraphs/draw/isogrids" "github.com/taironas/tinygraphs/extract" "github.com/taironas/tinygraphs/write" ) Loading @@ -25,7 +25,7 @@ func GridBW(w http.ResponseWriter, r *http.Request) { } size := extract.Size(r) write.ImageSVG(w) draw.IsogridsBW(w, "", bg, fg, size) isogrids.IsogridsBW(w, "", bg, fg, size) } // Grid2Colors is the handler for /isogrids/labs/grid2colors Loading @@ -34,5 +34,5 @@ func Grid2Colors(w http.ResponseWriter, r *http.Request) { size := extract.Size(r) write.ImageSVG(w) draw.Isogrids2Colors(w, "", size) isogrids.Isogrids2Colors(w, "", size) }