1
0
Fork 0

iconbits: cleanups, add documentation.

master
Pavel Machek 2024-07-19 13:29:25 +02:00
parent b51a856576
commit 62cb337105
2 changed files with 18 additions and 7 deletions

View File

@ -3,5 +3,18 @@
Bitmap editor suitable for creating icons and fonts for BangleJS2.
You'll want to run a copy of this in simulator, and another one on
watch to view the results. Draw using the provided tools, then press
the button, and you'll get result on the console.
watch to view the results.
Draw using the provided tools, then press the button, and you'll get
result on the console; you can also use "dump();" on command
line. show_icon() takes same parameter as is used in app-icon.js
files, you can just copy&paste it to get an icon. By using
"for_screen();" command, then taking a screenshot, you can easily
generate app.png file.
It is also possible to load existing icon into editor, using
"load_icon("");" command. At the end of iconbits.app.js file there are
more utility functions.

View File

@ -235,11 +235,9 @@ Bangle.on("lock", function() {
}
function do_draw(from, to) {
print("do-draw", from, to);
from = transform(from);
to = transform(to);
if (from && to) {
print("__draw", from, to);
__draw(sg, from, to);
}
update();
@ -327,7 +325,6 @@ Bangle.on("lock", function() {
if (!line_from) {
line_from = to;
} else {
print("draw -- ", line_from, to);
do_draw(line_from, to);
line_from = null;
}
@ -335,7 +332,8 @@ Bangle.on("lock", function() {
}
drawUtil();
}
function on_btn(n) {
function dump(n) {
function f(i) {
return "\\x" + i.toString(16).padStart(2, '0');
}
@ -361,7 +359,7 @@ drawArea();
Bangle.setUI({
"mode": "custom",
"drag": on_drag,
"btn": on_btn,
"btn": dump,
});
drawUtil();