diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
commit | 70e4841d311d68689724768157cc9cbfbde7a9fc (patch) | |
tree | ba9499f77d1258530a7e60aa6e1732c41d98161c /src/libui_sdl/libui/test/images | |
parent | 81747d6c34eb159481a6ca3f283d065fa3568617 (diff) |
another UI attempt, I guess.
sorry.
Diffstat (limited to 'src/libui_sdl/libui/test/images')
-rw-r--r-- | src/libui_sdl/libui/test/images/andlabs_16x16test_24june2016.png | bin | 0 -> 272 bytes | |||
-rw-r--r-- | src/libui_sdl/libui/test/images/andlabs_32x32test_24june2016.png | bin | 0 -> 432 bytes | |||
-rw-r--r-- | src/libui_sdl/libui/test/images/gen.go | 98 | ||||
-rw-r--r-- | src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png | bin | 0 -> 704 bytes | |||
-rw-r--r-- | src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png | bin | 0 -> 1518 bytes |
5 files changed, 98 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/test/images/andlabs_16x16test_24june2016.png b/src/libui_sdl/libui/test/images/andlabs_16x16test_24june2016.png Binary files differnew file mode 100644 index 0000000..a4c27d9 --- /dev/null +++ b/src/libui_sdl/libui/test/images/andlabs_16x16test_24june2016.png diff --git a/src/libui_sdl/libui/test/images/andlabs_32x32test_24june2016.png b/src/libui_sdl/libui/test/images/andlabs_32x32test_24june2016.png Binary files differnew file mode 100644 index 0000000..e1c33fc --- /dev/null +++ b/src/libui_sdl/libui/test/images/andlabs_32x32test_24june2016.png diff --git a/src/libui_sdl/libui/test/images/gen.go b/src/libui_sdl/libui/test/images/gen.go new file mode 100644 index 0000000..910abc7 --- /dev/null +++ b/src/libui_sdl/libui/test/images/gen.go @@ -0,0 +1,98 @@ +// 25 june 2016 +package main + +import ( + "fmt" + "os" + "image" + "image/draw" + _ "image/png" +) + +type img struct { + filename string + data []byte + width int + height int + stride int +} + +func main() { + if len(os.Args[1:]) == 0 { + panic("no files specified") + } + + images := make([]*img, 0, len(os.Args[1:])) + for _, fn := range os.Args[1:] { + f, err := os.Open(fn) + if err != nil { + panic(err) + } + ii, _, err := image.Decode(f) + if err != nil { + panic(err) + } + f.Close() + + i := image.NewRGBA(ii.Bounds()) + draw.Draw(i, i.Rect, ii, ii.Bounds().Min, draw.Src) + + im := &img{ + filename: fn, + data: i.Pix, + width: i.Rect.Dx(), + height: i.Rect.Dy(), + stride: i.Stride, + } + images = append(images, im) + } + + fmt.Println("// auto-generated by images/gen.go") + fmt.Println("#include \"test.h\"") + fmt.Println() + for i, im := range images { + fmt.Printf("static const uint32_t dat%d[] = {", i) + for j := 0; j < len(im.data); j += 4 { + if (j % (16 * 4)) == 0 { + fmt.Printf("\n\t") + } else { + fmt.Printf(" ") + } + d := uint32(im.data[j + 0]) << 16 + d |= uint32(im.data[j + 1]) << 8 + d |= uint32(im.data[j + 2]) + d |= uint32(im.data[j + 3]) << 24 + fmt.Printf("0x%08X,", d) + + } + fmt.Println("\n};") + fmt.Println() + } + fmt.Println("static const struct {") + fmt.Println(" const char *name;") + fmt.Println(" void *data;") + fmt.Println(" int width;") + fmt.Println(" int height;") + fmt.Println(" int stride;") + fmt.Println("} files[] = {") + for i, im := range images { + fmt.Printf(" { %q, dat%d, %d, %d, %d },\n", + im.filename, i, im.width, im.height, im.stride) + } + fmt.Println("};") + fmt.Println() + fmt.Println("void appendImageNamed(uiImage *img, const char *name)") + fmt.Println("{") + fmt.Println(" int i;") + fmt.Println("") + fmt.Println(" i = 0;") + fmt.Println(" for (;;) {") + fmt.Println(" if (strcmp(name, files[i].name) == 0) {") + fmt.Println(" uiImageAppend(img, files[i].data, files[i].width, files[i].height, files[i].stride);") + fmt.Println(" return;") + fmt.Println(" }") + fmt.Println(" i++;") + fmt.Println(" }") + fmt.Println("}") + fmt.Println() +} diff --git a/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png b/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png Binary files differnew file mode 100644 index 0000000..a6b1268 --- /dev/null +++ b/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png diff --git a/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png b/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png Binary files differnew file mode 100644 index 0000000..c0ccb7a --- /dev/null +++ b/src/libui_sdl/libui/test/images/tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png |