[Finalize app]

This commit is contained in:
xoy 2025-02-28 23:34:15 +01:00
parent f710ed8451
commit 3088330067
16 changed files with 377 additions and 8 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
**/.DS_Store

View file

@ -13,8 +13,8 @@ import (
)
func SnakeGenerateByteImagePart(data []byte, startX, startY, stopX, stopY, xLen, yLen int, img *image.RGBA) {
for x := startX; x < stopX; x++ {
for y := startY; y < stopY; y++ {
for y := startY; y < stopY; y++ {
for x := startX; x < stopX; x++ {
B := byte(0)

19
go.mod
View file

@ -10,16 +10,35 @@ require (
require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gofiber/template v1.8.3 // indirect
github.com/gofiber/utils v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.22.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

50
go.sum
View file

@ -1,7 +1,11 @@
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
@ -12,8 +16,12 @@ github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
@ -21,23 +29,65 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

53
main.go
View file

@ -1,27 +1,62 @@
package main
import (
"flag"
"fmt"
"io"
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
func main() {
viper.SetEnvPrefix("BI")
viper.AutomaticEnv()
flag.Int("MAX_FILE_SIZE", 1073741824, "Max file size in bytes")
flag.Parse()
err := viper.BindPFlags(pflag.CommandLine)
if err != nil {
fmt.Println(err)
return
}
maxFileSize := viper.GetInt("MAX_FILE_SIZE")
engine := html.New("views", ".html")
app := fiber.New(fiber.Config{
Views: engine,
BodyLimit: 10 * 1024 * 1024 * 1024, // 1GiB
BodyLimit: maxFileSize,
})
maxFileSizeString := fileSizeToString(maxFileSize)
nav := []NavItem{
NewNavItem("/", "Generator"),
NewNavItem("/rendertypes", "Rendertypes"),
}
app.Static("/", "static")
app.Get("/", func(c *fiber.Ctx) error {
return c.Render("index", fiber.Map{
"Stylenames": []string{"colors", "main", "index"},
"Stylenames": []string{"colors", "main", "index"},
"NavItems": nav,
"ActivePage": "/",
"MaxFileSize": maxFileSizeString,
})
})
app.Get("/rendertypes", func(c *fiber.Ctx) error {
return c.Render("rendertypes", fiber.Map{
"Stylenames": []string{"colors", "main", "rendertypes"},
"NavItems": nav,
"ActivePage": "/rendertypes",
})
})
@ -40,13 +75,23 @@ func main() {
return err
}
img, err := HilbertCurveGenerateByteImage(data)
renderType := c.FormValue("rendertype", "snake")
var img []byte
switch renderType {
case "snake":
img, err = SnakeGenerateByteImage(data)
default:
img, err = HilbertCurveGenerateByteImage(data)
}
if err != nil {
return err
}
c.Type("bmp")
c.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", file.Filename+".bmp"))
c.Set("Content-Disposition", fmt.Sprintf("filename=\"%s\"", file.Filename+".bmp")) //attachment;
return c.Send(img)
})

28
misc.go Normal file
View file

@ -0,0 +1,28 @@
package main
import "fmt"
func fileSizeToString(fileSize int) string {
binarySizes := []string{
"B",
"kiB",
"MiB",
"GiB",
"TiB",
"PiB",
"EiB",
"ZiB",
"YiB",
"RiB",
"QiB",
}
smallerNumber := float64(fileSize)
size := 0
binarySizesCount := len(binarySizes)
for smallerNumber >= 1024 || size >= binarySizesCount {
smallerNumber /= 1024
size++
}
return fmt.Sprintf("%.2f %v", smallerNumber, binarySizes[size])
}

View file

@ -0,0 +1,28 @@
:root {
--fg: #e8e6e3;
--fg-inactive: #999999;
--bg: #181a1b;
--bg-light: black;
--bg-border: #888888;
--accent: #a9daef;
--danger: #e16363;
--invalid: #d73030;
--contrast: white;
--link: #6f6fff;
--link-visited: #bb88e9;
}
@media (prefers-color-scheme: light) {
:root {
--fg: #071419;
--fg-inactive: #4d636c;
--bg: #e0ecff;
--bg-light: #bcc5d5;
--bg-border: #888888;
--accent: #333333;
--danger: #be0000;
--contrast: black;
--link: #0000ee;
--link-visited: #551a8b;
}
}

View file

@ -0,0 +1,40 @@
main {
display: flex;
flex-direction: column;
justify-content: center;
}
form {
display: grid;
grid-template-columns: max-content;
gap: 5px;
margin: auto;
}
form > div.form-content {
display: grid;
grid-template-columns: max-content max-content;
grid-template-rows: max-content;
align-items: baseline;
gap: 10px;
}
form > div.form-content > div.radio-container {
display: grid;
grid-template-columns: max-content max-content;
grid-template-rows: max-content;
align-items: baseline;
gap: 10px;
}
form > div.form-content > div.radio-container > *, form > button[type="submit"], form > div.form-content > input[type="file"] {
cursor: pointer;
}
form > :is(button[type="submit"], div.form-content) {
font-size: 1.5em;
}
form > div.form-content > p.maxfilesize {
text-align: right;
}

View file

@ -0,0 +1,86 @@
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-family: monospace;
color: var(--fg);
background-color: var(--bg);
}
a {
color: var(--link);
text-decoration: none;
font-weight: bold;
}
a:visited {
color: var(--link-visited);
}
header, footer {
background-color: var(--bg-light);
height: 150px;
}
footer {
height: 50px;
}
header {
display: flex;
flex-direction: column;
justify-content: space-around;
}
header > h1 {
padding: 0;
margin: 0;
text-align: center;
font-size: 4.5em;
}
:is(header, footer) > nav {
display: flex;
justify-content: center;
gap: 20px;
font-size: 1.5em;
}
footer > nav {
height: 100%;
flex-direction: column;
}
footer > nav > a {
margin: auto;
}
:is(header, footer) > nav > a::before {
content: '< ';
}
:is(header, footer) > nav > a::after {
content: ' >';
}
:is(header, footer) > nav > a:is(:hover, .active)::before {
content: '\00a0>';
}
:is(header, footer) > nav > a:is(:hover, .active)::after {
content: '<\00a0';
}
:is(header, footer) > nav > a:visited {
color: var(--link);
}
main {
min-height: calc(100vh - 200px);
}

View file

@ -0,0 +1,31 @@
main {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
align-items: center;
justify-content: center;
}
div.rendertype-container {
display: flex;
flex-direction: column;
gap: 10px;
align-items: center;
}
div.rendertype-container > div.rendertype-img {
width: 250px;
height: 250px;
background-color: white;
background-position: center;
background-size: contain;
}
div.rendertype-container > div.rendertype-img.snake {
background-image: url(/media/snakerender.png);
}
div.rendertype-container > div.rendertype-img.hilbertcurve {
background-image: url(/media/hilbertcurve.gif);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

10
templatetypes.go Normal file
View file

@ -0,0 +1,10 @@
package main
type NavItem struct {
Destination string
Caption string
}
func NewNavItem(destination, caption string) NavItem {
return NavItem{destination, caption}
}

View file

@ -1,8 +1,20 @@
{{template "partials/base-top" .}}
<form action="/generate" method="post" enctype="multipart/form-data">
<label for="file">File:</label>
<input type="file" name="file" id="file">
<div class="form-content">
<label for="file">File:</label>
<div>
<input type="file" name="file" id="file">
<p class="maxfilesize">Max filesize: {{ .MaxFileSize }}</p>
</div>
<label for="rendertype">Rendertype:</label>
<div class="radio-container" id="rendertype">
<label for="hilbertcurve">Hilbert Curve</label>
<input type="radio" name="rendertype" id="hilbertcurve" value="hilbertcurve" checked>
<label for="snake">Snake</label>
<input type="radio" name="rendertype" id="snake" value="snake">
</div>
</div>
<button type="submit">Generate</button>
</form>

View file

@ -11,5 +11,10 @@
<body>
<header>
<h1>BinaryImage</h1>
<nav>
{{ range .NavItems }}
<a href="{{ .Destination }}" {{ if eq .Destination $.ActivePage }} class="active" {{ end }}>{{ .Caption }}</a>
{{ end }}
</nav>
</header>
<main>

14
views/rendertypes.html Normal file
View file

@ -0,0 +1,14 @@
{{template "partials/base-top" .}}
<div class="rendertype-container">
<div class="rendertype-img hilbertcurve"></div>
<h2>Hilbert Curve</h2>
</div>
<div class="rendertype-container">
<div class="rendertype-img snake"></div>
<h2>Snake</h2>
</div>
{{template "partials/base-bottom" .}}