Icons and icon tool update

This commit is contained in:
furrtek 2017-02-03 08:21:12 +00:00
parent c352458114
commit f9dd3f5a96
51 changed files with 891 additions and 800 deletions

File diff suppressed because it is too large Load Diff

View File

@ -71,7 +71,7 @@ private:
{ 8, 0, 232, 16 }
};
std::array<Button, 40> buttons;
std::array<Button, 40> buttons { };
Button button_lowercase {
{ 21 * 8, 270, 32, 24 },

View File

@ -98,7 +98,7 @@ private:
};
Image bmp_speaker {
{ 204, 8, 16, 16 },
&bitmap_speaker,
&bitmap_icon_speaker,
ui::Color::white(),
ui::Color::black()
};

View File

@ -88,9 +88,9 @@ SystemStatusView::SystemStatusView() {
title.set_style(&style_systemstatus);
if (!portapack::persistent_memory::ui_config_textentry())
button_textentry.set_bitmap(&bitmap_keyboard);
button_textentry.set_bitmap(&bitmap_icon_keyboard);
else
button_textentry.set_bitmap(&bitmap_unistroke);
button_textentry.set_bitmap(&bitmap_icon_unistroke);
if (portapack::persistent_memory::stealth_mode())
button_stealth.set_foreground(ui::Color::green());
@ -152,9 +152,9 @@ void SystemStatusView::on_textentry() {
portapack::persistent_memory::set_config_textentry(cfg ^ 1);
if (!cfg)
button_textentry.set_bitmap(&bitmap_unistroke);
button_textentry.set_bitmap(&bitmap_icon_unistroke);
else
button_textentry.set_bitmap(&bitmap_keyboard);
button_textentry.set_bitmap(&bitmap_icon_keyboard);
}
void SystemStatusView::on_camera() {
@ -292,7 +292,7 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
{ "CCIR", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Nordic/BTLE", ui::Color::grey(), &bitmap_icon_nordic, [&nav](){ nav.push<NotImplementedView>(); } },
{ "POCSAG", ui::Color::cyan(), nullptr, [&nav](){ nav.push<POCSAGAppView>(); } },
{ "SIGFOX", ui::Color::grey(), &bitmap_icon_foxhunt, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
{ "SIGFOX", ui::Color::grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
{ "Transponders", ui::Color::green(), nullptr, [&nav](){ nav.push<TranspondersMenuView>(); } },
} });
on_left = [&nav](){ nav.pop(); };
@ -351,7 +351,7 @@ void SystemMenuView::hackrf_mode(NavigationView& nav) {
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items<12>({ {
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::cyan(), &bitmap_icon_receiver, [&nav](){ nav.push<ReceiverMenuView>(); } },
{ "Receivers", ui::Color::cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiverMenuView>(); } },
{ "Capture", ui::Color::cyan(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } }, //CaptureAppView
{ "Replay", ui::Color::grey(), &bitmap_icon_replay, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Code transmitters", ui::Color::green(), &bitmap_icon_codetx, [&nav](){ nav.push<TransmitterCodedMenuView>(); } },

View File

@ -72,7 +72,7 @@ private:
ImageButton button_back {
{ 2, 0 * 16, 16, 16 },
&bitmap_previous,
&bitmap_icon_previous,
Color::white(),
Color::dark_grey()
};
@ -84,28 +84,28 @@ private:
ImageButton button_stealth {
{ 152, 0, 2 * 8, 1 * 16 },
&bitmap_stealth,
&bitmap_icon_stealth,
Color::light_grey(),
Color::dark_grey()
};
ImageButton button_textentry {
{ 170, 0, 2 * 8, 1 * 16 },
&bitmap_unistroke,
&bitmap_icon_unistroke,
Color::white(),
Color::dark_grey()
};
ImageButton button_camera {
{ 188, 0, 2 * 8, 1 * 16 },
&bitmap_camera,
&bitmap_icon_camera,
Color::white(),
Color::dark_grey()
};
ImageButton button_sleep {
{ 206, 0, 2 * 8, 1 * 16 },
&bitmap_sleep,
&bitmap_icon_sleep,
Color::white(),
Color::dark_grey()
};

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

View File

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View File

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

View File

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

View File

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 143 B

View File

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 146 B

View File

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

View File

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

View File

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 117 B

View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View File

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

View File

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 127 B

View File

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 141 B

View File

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 112 B

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

BIN
firmware/graphics/more.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

BIN
firmware/graphics/stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

View File

@ -21,51 +21,95 @@
import sys
import struct
from PIL import Image
from os import listdir
from os import path
usage_message = """
1BPP PortaPack bitmap generator
1BPP PortaPack bitmap.hpp generator
Usage: <command> <name> <filename>
Usage: <directory>
"""
if len(sys.argv) < 3:
if len(sys.argv) < 1:
print(usage_message)
sys.exit(-1)
c = 0
data = 0
def convert_png(file):
c = 0
data = 0
im = Image.open(sys.argv[2])
rgb_im = im.convert('RGBA')
im = Image.open(file)
rgb_im = im.convert('RGBA')
if rgb_im.size[0] % 8 or rgb_im.size[1] % 8:
print('Bitmap size isn\'t a multiple of 8')
sys.exit(-1)
if rgb_im.size[0] % 8 or rgb_im.size[1] % 8:
print(file + ": Size isn\'t a multiple of 8")
sys.exit(-1)
name = sys.argv[1]
name = path.basename(file).split(".")[0].lower();
print "static constexpr uint8_t bitmap_" + name + "_data[] = {"
print ' ', # Tab
f.write("static constexpr uint8_t bitmap_" + name + "_data[] = {\n")
f.write(' ') # Tab
for i in range(rgb_im.size[0]):
for j in range(rgb_im.size[1]):
r, g, b, a = rgb_im.getpixel((j, i))
data >>= 1
if r > 127 and g > 127 and b > 127 and a > 127:
data += 128
if j % 8 == 7:
print "0x%0.2X," % data,
data = 0
for i in range(rgb_im.size[1]):
for j in range(rgb_im.size[0]):
r, g, b, a = rgb_im.getpixel((j, i))
data >>= 1
if r > 127 and g > 127 and b > 127 and a > 127:
data += 128
if j % 8 == 7:
f.write("0x%0.2X, " % data)
data = 0
print ''
if i < rgb_im.size[0] - 1:
print ' ', # Tab
f.write("\n")
if i < rgb_im.size[0] - 1:
f.write(' ') # Tab
print "};"
print ''
print "static constexpr Bitmap bitmap_" + name + " {"
print " { " + str(rgb_im.size[0]) + ", " + str(rgb_im.size[1]) + " }, bitmap_" + name+ "_data"
print "};"
f.write("};\n")
f.write("static constexpr Bitmap bitmap_" + name + " {\n")
f.write(" { " + str(rgb_im.size[0]) + ", " + str(rgb_im.size[1]) + " }, bitmap_" + name+ "_data\n")
f.write("};\n\n")
return
count = 0
f = open('bitmap.hpp', 'w')
f.write("/*\n")
f.write(" * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.\n")
f.write(" * Copyright (C) 2016 Furrtek\n")
f.write(" *\n")
f.write(" * This file is part of PortaPack.\n")
f.write(" *\n")
f.write(" * This program is free software; you can redistribute it and/or modify\n")
f.write(" * it under the terms of the GNU General Public License as published by\n")
f.write(" * the Free Software Foundation; either version 2, or (at your option)\n")
f.write(" * any later version.\n")
f.write(" *\n")
f.write(" * This program is distributed in the hope that it will be useful,\n")
f.write(" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n")
f.write(" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")
f.write(" * GNU General Public License for more details.\n")
f.write(" *\n")
f.write(" * You should have received a copy of the GNU General Public License\n")
f.write(" * along with this program; see the file COPYING. If not, write to\n")
f.write(" * the Free Software Foundation, Inc., 51 Franklin Street,\n")
f.write(" * Boston, MA 02110-1301, USA.\n")
f.write(" */\n\n")
f.write("// This file was generated by make_bitmap.py\n\n")
f.write("#ifndef __BITMAP_HPP__\n")
f.write("#define __BITMAP_HPP__\n\n")
f.write("#include \"ui.hpp\"\n\n")
f.write("namespace ui {\n\n")
for file in listdir(sys.argv[1]):
if file.endswith(".png"):
convert_png(sys.argv[1] + file)
count += 1
f.write("\n")
f.write("} /* namespace ui */\n\n")
f.write("#endif/*__BITMAP_HPP__*/\n")
print "Converted " + str(count) + " files"