From 8f6ba7b8689173889fc0229422f5f3bfaeea0923 Mon Sep 17 00:00:00 2001 From: mamg22 <45301823+mamg22@users.noreply.github.com> Date: Sat, 13 Nov 2021 13:43:15 -0400 Subject: [PATCH] Embed new nsxiv icon (#163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Berke Kocaoğlu Co-authored-by: NRK --- .gitignore | 1 + icon/README.md | 43 ++++++++ icon/dat2h.awk | 35 ------- icon/data.gen.h | 255 ++++++++++++++++++++++++++++++++++++++++++++++++ icon/data.h | 235 +------------------------------------------- icon/img2data.c | 157 +++++++++++++++++++++++++++++ 6 files changed, 457 insertions(+), 269 deletions(-) create mode 100644 icon/README.md delete mode 100644 icon/dat2h.awk create mode 100644 icon/data.gen.h create mode 100644 icon/img2data.c diff --git a/.gitignore b/.gitignore index 41ab2e8..b0c0928 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ version.h *.d *.o nsxiv +icon/img2data diff --git a/icon/README.md b/icon/README.md new file mode 100644 index 0000000..3ddd7f8 --- /dev/null +++ b/icon/README.md @@ -0,0 +1,43 @@ +img2data +-------- + +img2data is a helper program to convert images to binary data for embedding in +software. The generated data is used in nsxiv to set the window icons. + + +How It Works +------------ + +Each given image is compressed using run-length encoding and a data array is +generated. In these arrays, the four high bits of each byte are the run length +minus one and the lowest four bits are the data, which are indices for the +color array. + +See `data.gen.h` or the output of img2data for a better understanding. + + +Dependencies +------------ + +img2data requires Imlib2 to be installed. + + +Building +-------- + +img2data is built using the command: + + $ CC -Wall -std=c89 -pedantic -lImlib2 img2data.c -o img2data + +where `CC` is a C compiler such as `gcc`. + + +Usage +----- + +img2data is used as the following: + + $ ./img2data 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png + +You may replace or omit any image, but you must have a `data.gen.h` with at +least 1 image for nsxiv to compile. diff --git a/icon/dat2h.awk b/icon/dat2h.awk deleted file mode 100644 index cd6f362..0000000 --- a/icon/dat2h.awk +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/awk -f - -function printchars() { - while (n > 0) { - x = n / 16 >= 1 ? 16 : n; - printf("0x%x%x,%s", x - 1, ref[c] - 1, ++i % 12 == 0 ? "\n" : " "); - n -= x; - } -} - -/^$/ { - printchars(); - printf("\n\n"); - c = ""; - i = 0; -} - -/./ { - if (!ref[$0]) { - col[cnt++] = $0; - ref[$0] = cnt; - } - if ($0 != c) { - if (c != "") - printchars(); - c = $0; - n = 0; - } - n++; -} - -END { - for (i = 0; i < cnt; i++) - printf("%s,%s", col[i], ++j % 4 == 0 || i + 1 == cnt ? "\n" : " "); -} diff --git a/icon/data.gen.h b/icon/data.gen.h new file mode 100644 index 0000000..0bb7a84 --- /dev/null +++ b/icon/data.gen.h @@ -0,0 +1,255 @@ +static const unsigned char icon_data_16[] = { + 0xa0, 0x01, 0xe0, 0x01, 0xf0, 0x40, 0x21, 0x00, 0x21, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x21, 0x00, 0x21, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x02, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x10, + 0x01, 0x10, 0x01, 0x02, 0x01, 0x02, 0x01, 0x00, 0x01, 0x00, 0x21, 0x00, + 0x01, 0x00, 0x51, 0x02, 0x00, 0x01, 0x00, 0x21, 0x00, 0x01, 0x00, 0x51, + 0x02, 0x80, 0x03, 0x52, 0x04, 0x50, 0x43, 0x05, 0x22, 0x14, 0x06, 0x10, + 0x47, 0x35, 0x08, 0x02, 0x14, 0x06, 0x09, 0x22, 0x47, 0x25, 0x08, 0x14, + 0x06, 0x09, 0x32, 0x47, 0x08, 0x05, 0x08, 0x04, 0x16, 0x19, 0x32, 0x47, + 0x18, 0x16, 0x29, 0x32, 0x47, 0x18, 0x16, 0x29, 0x42, 0x47, 0x08, +}; + +static const unsigned char icon_data_32[] = { + 0xf0, 0x40, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0x90, 0x51, 0x10, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, + 0x11, 0x10, 0x11, 0x10, 0x51, 0x10, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, + 0x11, 0x10, 0x11, 0x10, 0x51, 0x10, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, + 0x11, 0x10, 0x11, 0x02, 0x00, 0x11, 0x10, 0x11, 0x10, 0x11, 0x30, 0x11, + 0x30, 0x11, 0x10, 0x11, 0x12, 0x11, 0x02, 0x00, 0x11, 0x10, 0x11, 0x10, + 0x11, 0x30, 0x11, 0x30, 0x11, 0x10, 0x11, 0x12, 0x11, 0x02, 0x00, 0x11, + 0x10, 0x11, 0x10, 0x11, 0x30, 0x11, 0x30, 0x11, 0x12, 0x11, 0x12, 0x11, + 0x02, 0x00, 0x11, 0x10, 0x51, 0x10, 0x11, 0x10, 0xb1, 0x22, 0x00, 0x11, + 0x10, 0x51, 0x10, 0x11, 0x10, 0xb1, 0x22, 0x00, 0x11, 0x10, 0x51, 0x10, + 0x11, 0x10, 0xb1, 0x22, 0xf0, 0x10, 0xd2, 0xf0, 0x00, 0xe2, 0xf0, 0x53, + 0x92, 0x14, 0xc0, 0x83, 0x05, 0x62, 0x24, 0x06, 0x80, 0x93, 0x35, 0x42, + 0x34, 0x06, 0x02, 0x30, 0x77, 0x95, 0x08, 0x22, 0x34, 0x16, 0x12, 0xc7, + 0x75, 0x08, 0x12, 0x34, 0x16, 0x09, 0x52, 0x97, 0x65, 0x08, 0x02, 0x34, + 0x16, 0x19, 0x62, 0x97, 0x45, 0x18, 0x24, 0x26, 0x19, 0x72, 0x97, 0x08, + 0x25, 0x18, 0x24, 0x26, 0x29, 0x72, 0x97, 0x48, 0x14, 0x36, 0x29, 0x72, + 0x97, 0x48, 0x04, 0x36, 0x39, 0x82, 0x97, 0x38, 0x46, 0x39, 0x82, 0x97, + 0x38, 0x36, 0x59, 0x82, 0x97, 0x28, 0x26, 0x69, 0x82, 0x97, 0x28, 0x26, + 0x69, 0x82, 0x97, 0x28, +}; + +static const unsigned char icon_data_48[] = { + 0xf0, 0xf0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, + 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0x81, 0x20, 0x81, 0x20, + 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x81, 0x20, 0x81, 0x20, + 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x81, 0x20, 0x81, 0x20, + 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x81, 0x20, 0x81, 0x20, + 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x02, 0x10, 0x81, 0x20, 0x81, + 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x00, 0x0a, 0x02, 0x21, 0x02, 0x10, + 0x21, 0x20, 0x21, 0x20, 0x21, 0x50, 0x21, 0x50, 0x21, 0x20, 0x21, 0x22, + 0x21, 0x02, 0x10, 0x21, 0x20, 0x21, 0x20, 0x21, 0x50, 0x21, 0x50, 0x21, + 0x10, 0x02, 0x21, 0x22, 0x21, 0x02, 0x10, 0x21, 0x20, 0x21, 0x20, 0x21, + 0x50, 0x21, 0x50, 0x21, 0x00, 0x12, 0x21, 0x22, 0x21, 0x02, 0x10, 0x21, + 0x20, 0x21, 0x20, 0x21, 0x50, 0x21, 0x50, 0x21, 0x22, 0x21, 0x22, 0x21, + 0x02, 0x10, 0x21, 0x20, 0x81, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x32, 0x10, + 0x21, 0x20, 0x81, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x32, 0x10, 0x21, 0x20, + 0x81, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x32, 0x10, 0x21, 0x20, 0x81, 0x20, + 0x21, 0x20, 0xf1, 0x11, 0x32, 0x10, 0x21, 0x20, 0x81, 0x20, 0x21, 0x20, + 0xf1, 0x11, 0x32, 0xf0, 0xa0, 0xf2, 0x42, 0xf0, 0x90, 0xf2, 0x52, 0xf0, + 0x90, 0x33, 0xf2, 0x12, 0xf0, 0x70, 0x93, 0xd2, 0x24, 0xf0, 0x20, 0xc3, + 0x15, 0xa2, 0x34, 0xf0, 0x00, 0xd3, 0x35, 0x82, 0x44, 0x06, 0xb0, 0xe3, + 0x75, 0x62, 0x54, 0x16, 0x02, 0x50, 0xb7, 0xe5, 0x08, 0x42, 0x54, 0x16, + 0x09, 0x02, 0x30, 0xe7, 0xd5, 0x08, 0x32, 0x54, 0x26, 0x09, 0x22, 0xf7, + 0x37, 0xa5, 0x18, 0x12, 0x54, 0x26, 0x19, 0x72, 0xf7, 0x85, 0x28, 0x02, + 0x54, 0x26, 0x19, 0x92, 0xe7, 0x85, 0x28, 0x54, 0x26, 0x29, 0xa2, 0xe7, + 0x65, 0x28, 0x44, 0x36, 0x29, 0xb2, 0xe7, 0x18, 0x35, 0x28, 0x44, 0x36, + 0x39, 0xa2, 0xe7, 0x28, 0x15, 0x38, 0x34, 0x46, 0x39, 0xb2, 0xe7, 0x78, + 0x24, 0x56, 0x49, 0xb2, 0xe7, 0x68, 0x14, 0x56, 0x59, 0xb2, 0xe7, 0x68, + 0x04, 0x66, 0x59, 0xc2, 0xe7, 0x58, 0x66, 0x69, 0xc2, 0xe7, 0x58, 0x66, + 0x69, 0xc2, 0xe7, 0x58, 0x56, 0x79, 0xd2, 0xe7, 0x48, 0x46, 0x89, 0xd2, + 0xe7, 0x48, 0x46, 0x89, 0xe2, 0xe7, 0x38, 0x46, 0x89, 0xe2, 0xe7, 0x38, + +}; + +static const unsigned char icon_data_64[] = { + 0xf0, 0xf0, 0x90, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, + 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, + 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0xb1, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0xb1, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0xb1, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0xb1, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0xb1, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x00, 0x0b, 0x10, 0xb1, 0x30, 0xb1, + 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x12, 0x10, 0x31, 0x30, + 0x31, 0x30, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x10, 0x12, 0x31, + 0x12, 0x10, 0x31, 0x30, 0x31, 0x30, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, + 0x31, 0x32, 0x31, 0x12, 0x10, 0x31, 0x30, 0x31, 0x30, 0x31, 0x70, 0x31, + 0x70, 0x31, 0x30, 0x31, 0x32, 0x31, 0x12, 0x10, 0x31, 0x30, 0x31, 0x30, + 0x31, 0x70, 0x31, 0x70, 0x31, 0x20, 0x02, 0x31, 0x32, 0x31, 0x12, 0x10, + 0x31, 0x30, 0x31, 0x30, 0x31, 0x70, 0x31, 0x70, 0x31, 0x00, 0x22, 0x31, + 0x32, 0x31, 0x12, 0x10, 0x31, 0x30, 0x31, 0x30, 0x31, 0x70, 0x31, 0x70, + 0x31, 0x32, 0x31, 0x32, 0x31, 0x12, 0x10, 0x31, 0x30, 0xb1, 0x30, 0x31, + 0x30, 0xf1, 0x71, 0x52, 0x10, 0x31, 0x30, 0xb1, 0x30, 0x31, 0x30, 0xf1, + 0x71, 0x52, 0x10, 0x31, 0x30, 0xb1, 0x30, 0x31, 0x30, 0xf1, 0x71, 0x52, + 0x10, 0x31, 0x30, 0xb1, 0x30, 0x31, 0x30, 0xf1, 0x71, 0x52, 0x10, 0x31, + 0x30, 0xb1, 0x30, 0x31, 0x30, 0xf1, 0x71, 0x52, 0x10, 0x31, 0x30, 0xb1, + 0x30, 0x31, 0x30, 0xf1, 0x71, 0x52, 0xf0, 0xf0, 0x40, 0xf2, 0xa2, 0xf0, + 0xf0, 0x30, 0xf2, 0xb2, 0xf0, 0xf0, 0x20, 0xf2, 0xc2, 0xf0, 0xf0, 0x10, + 0xf2, 0xd2, 0xf0, 0xf0, 0x10, 0x83, 0xf2, 0x42, 0xf0, 0xf0, 0xd3, 0xf2, + 0x12, 0x24, 0xf0, 0xa0, 0xf3, 0x03, 0x15, 0xe2, 0x44, 0xf0, 0x70, 0xf3, + 0x13, 0x35, 0xc2, 0x54, 0x06, 0xf0, 0x40, 0xf3, 0x13, 0x65, 0xa2, 0x64, + 0x16, 0xf0, 0xf3, 0x33, 0x95, 0x82, 0x64, 0x26, 0x02, 0xa0, 0x77, 0xb3, + 0xd5, 0x08, 0x62, 0x74, 0x26, 0x12, 0x60, 0xf7, 0x17, 0xf5, 0x25, 0x08, + 0x52, 0x74, 0x26, 0x09, 0x32, 0xf7, 0x87, 0xf5, 0x05, 0x18, 0x32, 0x74, + 0x36, 0x09, 0x42, 0xf7, 0x97, 0xe5, 0x18, 0x22, 0x74, 0x36, 0x19, 0x92, + 0xf7, 0x57, 0xc5, 0x28, 0x12, 0x74, 0x46, 0x19, 0xb2, 0xf7, 0x47, 0xa5, + 0x38, 0x02, 0x74, 0x46, 0x19, 0xd2, 0xf7, 0x37, 0x08, 0x95, 0x38, 0x74, + 0x46, 0x29, 0xd2, 0xf7, 0x37, 0x08, 0x85, 0x38, 0x64, 0x56, 0x29, 0xe2, + 0xf7, 0x37, 0x18, 0x65, 0x38, 0x64, 0x56, 0x39, 0xe2, 0xf7, 0x37, 0x28, + 0x45, 0x38, 0x54, 0x66, 0x39, 0xf2, 0xf7, 0x37, 0x38, 0x15, 0x48, 0x44, + 0x66, 0x59, 0xf2, 0xf7, 0x37, 0x98, 0x34, 0x76, 0x59, 0xf2, 0xf7, 0x37, + 0x98, 0x24, 0x86, 0x59, 0xf2, 0x02, 0xf7, 0x37, 0x88, 0x14, 0x86, 0x79, + 0xf2, 0xf7, 0x37, 0x88, 0x04, 0x96, 0x79, 0xf2, 0x02, 0xf7, 0x37, 0x78, + 0x96, 0x89, 0xf2, 0x02, 0xf7, 0x37, 0x78, 0x96, 0x89, 0xf2, 0x12, 0xf7, + 0x37, 0x68, 0x86, 0x99, 0xf2, 0x12, 0xf7, 0x37, 0x68, 0x76, 0xa9, 0xf2, + 0x12, 0xf7, 0x37, 0x68, 0x66, 0xb9, 0xf2, 0x22, 0xf7, 0x37, 0x58, 0x66, + 0xb9, 0xf2, 0x22, 0xf7, 0x37, 0x58, 0x56, 0xc9, 0xf2, 0x22, 0xf7, 0x37, + 0x58, 0x56, 0xc9, 0xf2, 0x22, 0xf7, 0x37, 0x58, +}; + +static const unsigned char icon_data_128[] = { + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x71, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0x70, 0x71, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x70, + 0x71, 0xf0, 0xf0, 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f0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, + 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0xf1, + 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x10, 0x0b, 0x0a, 0x30, 0xf1, 0x71, + 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x32, + 0x30, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x32, 0x30, 0xf1, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, + 0x71, 0x70, 0x71, 0x40, 0x0a, 0x12, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, + 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x20, 0x42, 0x71, 0x32, + 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, + 0x00, 0x62, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, + 0xf0, 0x71, 0x70, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, + 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x72, 0x71, + 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x60, + 0x02, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, + 0x71, 0xf0, 0x71, 0x40, 0x22, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, 0x70, + 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x20, 0x42, 0x71, 0x72, 0x71, + 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x00, + 0x62, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, + 0x71, 0xf0, 0x71, 0x72, 0x71, 0x72, 0x71, 0x32, 0x30, 0x71, 0x70, 0x71, + 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x72, 0x71, 0x72, 0x71, 0x32, 0x30, + 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x72, 0x71, 0x72, + 0x71, 0x32, 0x30, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0xf1, 0xf1, + 0xf1, 0xb2, 0x30, 0x71, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0xf1, 0xf1, + 0x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x56, 0x09, 0x32, 0x80, 0xf7, 0xf7, 0x97, 0xf5, 0xf5, 0x45, 0x18, 0xa2, + 0xf4, 0x56, 0x19, 0x72, 0xf7, 0xf7, 0xf7, 0x07, 0xf5, 0xf5, 0x25, 0x28, + 0x82, 0xf4, 0x66, 0x19, 0x72, 0xf7, 0xf7, 0xf7, 0x27, 0xf5, 0xf5, 0x05, + 0x38, 0x62, 0xf4, 0x66, 0x29, 0x82, 0xf7, 0xf7, 0xf7, 0x37, 0xf5, 0xd5, + 0x48, 0x52, 0xf4, 0x76, 0x29, 0xc2, 0xf7, 0xf7, 0xf7, 0x07, 0xf5, 0xb5, + 0x58, 0x42, 0xf4, 0x76, 0x39, 0xf2, 0x22, 0xf7, 0xf7, 0xb7, 0xf5, 0xa5, + 0x58, 0x32, 0xf4, 0x76, 0x49, 0xf2, 0x52, 0xf7, 0xf7, 0x97, 0xf5, 0x85, + 0x68, 0x22, 0xf4, 0x86, 0x39, 0xf2, 0x72, 0xf7, 0xf7, 0x97, 0xf5, 0x65, + 0x78, 0x12, 0xf4, 0x86, 0x49, 0xf2, 0x82, 0xf7, 0xf7, 0x97, 0xf5, 0x55, + 0x78, 0x02, 0xf4, 0x86, 0x49, 0xf2, 0xa2, 0xf7, 0xf7, 0x87, 0x08, 0xf5, + 0x35, 0x88, 0xe4, 0x96, 0x59, 0xf2, 0xb2, 0xf7, 0xf7, 0x77, 0x08, 0xf5, + 0x25, 0x88, 0xe4, 0x96, 0x59, 0xf2, 0xc2, 0xf7, 0xf7, 0x77, 0x18, 0xf5, + 0x05, 0x88, 0xd4, 0xa6, 0x69, 0xf2, 0xc2, 0xf7, 0xf7, 0x77, 0x28, 0xf5, + 0x78, 0xd4, 0xa6, 0x69, 0xf2, 0xd2, 0xf7, 0xf7, 0x77, 0x38, 0xd5, 0x78, + 0xc4, 0xb6, 0x79, 0xf2, 0xd2, 0xf7, 0xf7, 0x77, 0x48, 0xa5, 0x88, 0xc4, + 0xb6, 0x79, 0xf2, 0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, 0x32, 0xf7, 0xf7, 0x77, 0xe8, 0xf6, 0x16, 0xf9, 0x29, + 0xf2, 0xf2, 0x32, 0xf7, 0xf7, 0x77, 0xe8, 0xf6, 0x06, 0xf9, 0x39, 0xf2, + 0xf2, 0x32, 0xf7, 0xf7, 0x77, 0xe8, 0xf6, 0xf9, 0x59, 0xf2, 0xf2, 0x32, + 0xf7, 0xf7, 0x77, 0xd8, 0xe6, 0xf9, 0x69, 0xf2, 0xf2, 0x32, 0xf7, 0xf7, + 0x77, 0xd8, 0xd6, 0xf9, 0x79, 0xf2, 0xf2, 0x32, 0xf7, 0xf7, 0x77, 0xd8, + 0xd6, 0xf9, 0x79, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xc6, 0xf9, + 0x89, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xc6, 0xf9, 0x89, 0xf2, + 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xb6, 0xf9, 0x99, 0xf2, 0xf2, 0x52, + 0xf7, 0xf7, 0x77, 0xb8, 0xb6, 0xf9, 0x99, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, + 0x77, 0xb8, 0xb6, 0xf9, 0x99, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8, + 0xb6, 0xf9, 0x99, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8, 0xb6, 0xf9, + 0x99, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8, +}; + +static const unsigned long icon_colors[] = { + 0xff222034, 0xffffffff, 0xff306082, 0xfffbf236, + 0xff76428a, 0xff99e550, 0xffac3232, 0xff37946e, + 0xff6abe30, 0xffd95763, 0xff26324a, 0xff23253a, + +}; + +static const icon_data_t icons[] = { + ICON_(16), + ICON_(32), + ICON_(48), + ICON_(64), + ICON_(128), +}; + diff --git a/icon/data.h b/icon/data.h index adb44e6..98ac5f3 100644 --- a/icon/data.h +++ b/icon/data.h @@ -7,241 +7,8 @@ typedef struct { const unsigned char *data; } icon_data_t; -static const unsigned int icon_colors[] = { - 0xff222034, 0xffffffff, 0xff306082, 0xff76428a, - 0xfffbf236, 0xff99e550, 0xffd95763, 0xff37946e, - 0xff6abe30, 0xffac3232 -}; - -static const unsigned char icon_data_16[] = { - 0xf0, 0x80, 0x01, 0xf0, 0x80, 0x21, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, - 0x00, 0x01, 0x40, 0x01, 0x10, 0x01, 0x10, 0x01, 0x00, 0x01, 0x00, 0x01, - 0x30, 0x11, 0x00, 0x01, 0x00, 0x51, 0xf0, 0x22, 0xa0, 0x42, 0x80, 0x62, - 0x03, 0x50, 0x02, 0x34, 0x05, 0x22, 0x13, 0x06, 0x10, 0x37, 0x08, 0x35, - 0x12, 0x13, 0x09, 0x06, 0x22, 0x47, 0x25, 0x02, 0x13, 0x09, 0x06, 0x32, - 0x47, 0x08, 0x05, 0x08, 0x03, 0x19, 0x16, 0x32, 0x47, 0x18, 0x29, 0x16, - 0x42, 0x37, 0x18, 0x19, 0x26, 0x42, 0x47, 0x08 -}; - -static const unsigned char icon_data_32[] = { - 0xf0, 0x10, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, 0x10, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, - 0x10, 0x11, 0x90, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, - 0x90, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x90, 0x11, - 0x30, 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x00, 0x22, 0x50, 0x11, - 0x30, 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x32, 0x50, 0x11, 0x30, - 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x32, 0x30, 0x31, 0x10, 0x11, - 0x10, 0xb1, 0x52, 0x30, 0x31, 0x10, 0x11, 0x10, 0xb1, 0x52, 0x30, 0x31, - 0x10, 0x11, 0x10, 0xb1, 0x52, 0xf0, 0x10, 0xd2, 0xf0, 0x00, 0xe2, 0xf0, - 0x54, 0x92, 0x13, 0xc0, 0x84, 0x05, 0x62, 0x33, 0x80, 0x74, 0x55, 0x42, - 0x33, 0x09, 0x02, 0x30, 0x77, 0x08, 0x85, 0x32, 0x33, 0x19, 0x12, 0xc7, - 0x08, 0x65, 0x08, 0x12, 0x33, 0x19, 0x06, 0x52, 0x97, 0x08, 0x45, 0x18, - 0x02, 0x33, 0x19, 0x16, 0x62, 0x97, 0x08, 0x35, 0x18, 0x23, 0x29, 0x16, - 0x72, 0x97, 0x18, 0x15, 0x18, 0x23, 0x29, 0x26, 0x72, 0x97, 0x48, 0x13, - 0x39, 0x26, 0x72, 0x97, 0x48, 0x03, 0x39, 0x36, 0x82, 0x97, 0x38, 0x49, - 0x36, 0x82, 0x97, 0x38, 0x39, 0x46, 0x82, 0x97, 0x38, 0x29, 0x56, 0x92, - 0x97, 0x28, 0x29, 0x56, 0x92, 0x97, 0x28 -}; - -static const unsigned char icon_data_48[] = { - 0xf0, 0xa0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, - 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, 0xa0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, - 0x20, 0x21, 0xe0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, - 0xe0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x81, - 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, - 0x50, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, 0x50, 0x21, - 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, 0x50, 0x21, 0x20, 0x21, - 0x20, 0x21, 0x10, 0x32, 0x80, 0x21, 0x50, 0x21, 0x50, 0x21, 0x20, 0x21, - 0x20, 0x21, 0x52, 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x00, 0x72, - 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x82, 0x50, 0x51, 0x20, 0x21, - 0x20, 0xf1, 0x11, 0x82, 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x82, - 0xf0, 0xf0, 0x00, 0xe2, 0xf0, 0xe0, 0xf2, 0x02, 0xf0, 0xc0, 0xf2, 0x22, - 0xf0, 0xb0, 0xf2, 0x32, 0xf0, 0xa0, 0xf2, 0x42, 0xf0, 0x90, 0xf2, 0x52, - 0xf0, 0x80, 0x74, 0x15, 0xc2, 0x03, 0xf0, 0x50, 0xc4, 0x15, 0x92, 0x23, - 0xf0, 0x10, 0xe4, 0x35, 0x72, 0x33, 0x19, 0xc0, 0xc4, 0x85, 0x62, 0x43, - 0x19, 0x12, 0x70, 0x57, 0x18, 0xf5, 0x05, 0x52, 0x53, 0x19, 0x12, 0x40, - 0xb7, 0x18, 0xe5, 0x32, 0x53, 0x29, 0x22, 0xf7, 0x37, 0xb5, 0x08, 0x22, - 0x53, 0x29, 0x06, 0x72, 0xf7, 0xa5, 0x08, 0x12, 0x53, 0x29, 0x16, 0x92, - 0xe7, 0x85, 0x18, 0x02, 0x43, 0x39, 0x26, 0x92, 0xe7, 0x08, 0x65, 0x28, - 0x43, 0x39, 0x26, 0xa2, 0xe7, 0x18, 0x45, 0x28, 0x43, 0x39, 0x36, 0xa2, - 0xe7, 0x28, 0x25, 0x28, 0x33, 0x49, 0x36, 0xb2, 0xe7, 0x78, 0x33, 0x49, - 0x46, 0xb2, 0xe7, 0x68, 0x23, 0x59, 0x46, 0xb2, 0xe7, 0x68, 0x13, 0x59, - 0x56, 0xc2, 0xe7, 0x58, 0x79, 0x56, 0xc2, 0xe7, 0x58, 0x69, 0x66, 0xd2, - 0xd7, 0x58, 0x59, 0x76, 0xd2, 0xd7, 0x58, 0x49, 0x86, 0xe2, 0xe7, 0x38, - 0x39, 0x86, 0xf2, 0xe7, 0x38, 0x29, 0x86, 0xf2, 0x02, 0xe7, 0x38 -}; - -static const unsigned char icon_data_64[] = { - 0xf0, 0xf0, 0x30, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, - 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, - 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, - 0x31, 0x30, 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, - 0x30, 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, - 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, - 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, - 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, - 0xf0, 0x30, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x20, - 0x42, 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x00, - 0x62, 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, - 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0xb0, - 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0xb0, 0x31, - 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0x70, 0x71, 0x30, - 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, - 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, - 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, - 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, 0xb2, 0xf0, 0xf0, 0x50, - 0xf2, 0x92, 0xf0, 0xf0, 0x30, 0xf2, 0xb2, 0xf0, 0xf0, 0x20, 0xf2, 0xc2, - 0xf0, 0xf0, 0x10, 0xf2, 0xd2, 0xf0, 0xf0, 0x00, 0x94, 0xf2, 0x42, 0xf0, - 0xe0, 0xe4, 0xf2, 0x12, 0x23, 0xf0, 0xa0, 0xf4, 0x14, 0x05, 0xe2, 0x43, - 0xf0, 0x70, 0xf4, 0x14, 0x35, 0xc2, 0x43, 0x19, 0xf0, 0x30, 0xf4, 0x95, - 0xa2, 0x53, 0x29, 0xe0, 0xf4, 0x04, 0xd5, 0x82, 0x63, 0x29, 0x02, 0x90, - 0xc7, 0xf5, 0x65, 0x62, 0x73, 0x29, 0x12, 0x50, 0xf7, 0x27, 0xf5, 0x35, - 0x52, 0x73, 0x29, 0x06, 0x32, 0xf7, 0x87, 0xf5, 0x05, 0x08, 0x42, 0x73, - 0x39, 0x06, 0x32, 0xf7, 0xa7, 0xd5, 0x28, 0x22, 0x73, 0x39, 0x16, 0xa2, - 0xf7, 0x47, 0xb5, 0x38, 0x12, 0x73, 0x39, 0x26, 0xb2, 0xf7, 0x47, 0xa5, - 0x38, 0x02, 0x73, 0x39, 0x26, 0xd2, 0xf7, 0x47, 0x08, 0x75, 0x48, 0x63, - 0x49, 0x36, 0xd2, 0xf7, 0x47, 0x18, 0x65, 0x38, 0x63, 0x49, 0x36, 0xe2, - 0xf7, 0x47, 0x28, 0x45, 0x38, 0x53, 0x59, 0x46, 0xe2, 0xf7, 0x47, 0x38, - 0x15, 0x48, 0x53, 0x59, 0x46, 0xf2, 0xf7, 0x37, 0xa8, 0x43, 0x69, 0x56, - 0xf2, 0xf7, 0x37, 0x98, 0x33, 0x79, 0x56, 0xf2, 0xf7, 0x37, 0x98, 0x23, - 0x79, 0x66, 0xf2, 0x02, 0xf7, 0x37, 0x88, 0x13, 0x89, 0x66, 0xf2, 0x02, - 0xf7, 0x37, 0x88, 0x03, 0x89, 0x76, 0xf2, 0x12, 0xf7, 0x37, 0x78, 0x99, - 0x76, 0xf2, 0x12, 0xf7, 0x37, 0x78, 0x89, 0x86, 0xf2, 0x12, 0xf7, 0x37, - 0x78, 0x79, 0x96, 0xf2, 0x22, 0xf7, 0x37, 0x68, 0x69, 0xa6, 0xf2, 0x22, - 0xf7, 0x37, 0x68, 0x69, 0xa6, 0xf2, 0x22, 0xf7, 0x37, 0x68, 0x59, 0xb6, - 0xf2, 0x32, 0xf7, 0x37, 0x58, 0x59, 0xb6, 0xf2, 0x32, 0xf7, 0x37, 0x58, - 0x59, 0xb6, 0xf2, 0x32, 0xf7, 0x37, 0x58 -}; - -static const unsigned char icon_data_128[] = { - 0xf0, 0xf0, 0xf0, 0xf0, 0x70, 0x71, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0x70, 0x71, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf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0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, - 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, - 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, - 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, - 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, - 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, - 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, - 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, - 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, - 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, - 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, - 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xa0, - 0x42, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x70, 0x71, - 0x60, 0x82, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x70, - 0x71, 0x40, 0xa2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, - 0x70, 0x71, 0x20, 0xc2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, - 0x71, 0x70, 0x71, 0x00, 0xe2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, - 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, - 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, - 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, - 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, - 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, - 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0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 0xd9, 0xf6, 0x76, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, - 0xc8, 0xc9, 0xf6, 0x86, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xc9, - 0xf6, 0x86, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xb9, 0xf6, 0x96, - 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, - 0x52, 0xf7, 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, - 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, - 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8 -}; - #define ICON_(s) { s, ARRLEN(icon_data_##s), icon_data_##s } -static const icon_data_t icons[] = { - ICON_(16), - ICON_(32), - ICON_(48), - ICON_(64), - ICON_(128) -}; +#include "data.gen.h" #endif /* ICON_DATA_H */ - diff --git a/icon/img2data.c b/icon/img2data.c new file mode 100644 index 0000000..2223bf0 --- /dev/null +++ b/icon/img2data.c @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include + +/* macros */ +#define ARRLEN(a) (sizeof(a) / sizeof((a)[0])) + +/* globals */ +static unsigned long palette[16] = {0}; +static unsigned int palette_size = 0; +static unsigned int run_column = 0; +static unsigned int icon_sizes[16] = {0}; +static unsigned int icon_sizes_size = 0; + +/* functions */ +static void error(int eval, int err, const char *fmt, ...) +{ + va_list ap; + + fflush(stdout); + va_start(ap, fmt); + if (fmt) + vfprintf(stderr, fmt, ap); + va_end(ap); + if (err) + fprintf(stderr, "%s%s", fmt ? ": " : "", strerror(err)); + fputc('\n', stderr); + + if (eval) + exit(eval); +} + +static unsigned long color_to_ulong(Imlib_Color color) +{ + return (color.alpha << 24 & 0xff000000) | + (color.red << 16 & 0x00ff0000) | + (color.green << 8 & 0x0000ff00) | + (color.blue & 0x000000ff); +} + +static int to_palette(unsigned long color) +{ + unsigned int i; + + for (i = 0; i < palette_size; i++) { + if (palette[i] == color) + return i; + } + if (palette_size + 1 == 16) + error(EXIT_FAILURE, 0, "Error: More than 16 colors in palette"); + palette[palette_size] = color; + + return palette_size++; +} + +static void print_run(int color, unsigned int run_length) +{ + while (run_length > 0) { + int x = run_length / 16 >= 1 ? 16 : run_length; + + printf("0x%02x, ", (x - 1) << 4 | color); + run_length -= x; + if (++run_column % 12 == 0) + printf("\n\t"); + } +} + +static void print_palette(void) +{ + unsigned int i; + + printf("static const unsigned long icon_colors[] = {\n\t"); + for (i = 0; i < palette_size; i++) { + printf("0x%08lx, ", palette[i]); + if (i % 4 == 3) + printf("\n\t"); + } + printf("\n};\n\n"); +} + +static void print_icon_array(void) +{ + unsigned int i; + + printf("static const icon_data_t icons[] = {\n"); + for (i = 0; i < icon_sizes_size; i++) + printf("\tICON_(%d),\n", icon_sizes[i]); + printf("};\n\n"); +} + +static unsigned int print_encoded_image(const char *path) +{ + Imlib_Image image; + Imlib_Color color; + unsigned int width, height, x, y; + unsigned int run_length = 1; + int currentcolor = 0; + int lastcolor = -1; + + image = imlib_load_image(path); + + if (image == NULL) + error(EXIT_FAILURE, 0, "Error loading image: %s", path); + + imlib_context_set_image(image); + + width = imlib_image_get_width(); + height = imlib_image_get_height(); + + if (width != height) + error(EXIT_FAILURE, 0, "Image is not square: %s", path); + + printf("static const unsigned char icon_data_%d[] = {\n\t", width); + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + imlib_image_query_pixel(x, y, &color); + currentcolor = to_palette(color_to_ulong(color)); + if (currentcolor != lastcolor) { + if (lastcolor != -1) + print_run(lastcolor, run_length); + run_length = 1; + } else { + run_length++; + } + lastcolor = currentcolor; + } + } + print_run(lastcolor, run_length); + printf("\n};\n\n"); + + imlib_free_image(); + + return width; +} + +int main(int argc, char **argv) +{ + unsigned int img_size = 0; + unsigned int i; + + if (argc < 2) + error(EXIT_FAILURE, 0, "No icons provided"); + else if (argc-1 > ARRLEN(icon_sizes)) + error(EXIT_FAILURE, 0, "Too many icons"); + + for (i = 1; i < argc; i++) { + img_size = print_encoded_image(argv[i]); + run_column = 0; + icon_sizes[icon_sizes_size++] = img_size; + } + print_palette(); + print_icon_array(); + + return EXIT_SUCCESS; +}