summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-08-27 18:00:56 +0200
committerRobin Gareus <robin@gareus.org>2019-08-27 18:03:57 +0200
commit8cc1f8f8cbdfae557164b1667137986dca0125b9 (patch)
tree168554b2a0cb2875bdbbf0a80ad27ffa6c2e73aa /tools
parent7f2bfa362f433a5065a19f91c05d26da748a80d8 (diff)
Update icon render tool
* add "grid" mode * re-build libwidgets as needed * add a convenient `make show` target
Diffstat (limited to 'tools')
-rw-r--r--tools/icons/icon.cc21
-rw-r--r--tools/icons/makefile19
2 files changed, 35 insertions, 5 deletions
diff --git a/tools/icons/icon.cc b/tools/icons/icon.cc
index b06463c0f4..584a9ebfc2 100644
--- a/tools/icons/icon.cc
+++ b/tools/icons/icon.cc
@@ -30,8 +30,9 @@
using namespace ArdourWidgets;
-static int wh = 64;
-static int sq = 1;
+static int wh = 64;
+static int sq = 1;
+static bool grid = false;
static uint32_t bg_color = 0x3d3d3dff; // gtk_background
static uint32_t fg_color = 0xeeeeecff; // gtk_foreground
@@ -119,6 +120,17 @@ draw_icon (cairo_t* cr, int pos, const enum ArdourIcon::Icon icon, const Gtkmm2e
int row = pos / sq;
cairo_save (cr);
cairo_translate (cr, col * wh, row * wh);
+ if (grid) {
+ cairo_rectangle (cr, .5, .5, wh - 1, wh - 1);
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgba (cr, 0, 0, 0, 1.0);
+ cairo_stroke (cr);
+ cairo_move_to (cr, wh * .5, 0);
+ cairo_line_to (cr, wh * .5, wh);
+ cairo_move_to (cr, 0, wh * .5);
+ cairo_line_to (cr, wh, wh * .5);
+ cairo_stroke (cr);
+ }
ArdourIcon::render (cr, icon, wh, wh, state, fg_color);
cairo_restore (cr);
}
@@ -129,8 +141,11 @@ main (int argc, char** argv)
const char* fn = "/tmp/ardour_icons.png";
int c = 0;
- while (EOF != (c = getopt (argc, argv, "o:s:t:"))) {
+ while (EOF != (c = getopt (argc, argv, "go:s:t:"))) {
switch (c) {
+ case 'g':
+ grid = true;
+ break;
case 't':
if (!load_colors (optarg)) {
std::cerr << "Error: failed to load color theme.\n";
diff --git a/tools/icons/makefile b/tools/icons/makefile
index 4e8e1c4f05..695ad600db 100644
--- a/tools/icons/makefile
+++ b/tools/icons/makefile
@@ -7,9 +7,24 @@ LDFLAGS = -L $(AD)/build/libs/pbd -lpbd -Xlinker -rpath=$(AD)/build/libs/pbd
LDFLAGS += -L $(AD)/build/libs/gtkmm2ext -lgtkmm2ext -Xlinker -rpath=$(AD)/build/libs/gtkmm2ext
LDFLAGS += -L $(AD)/build/libs/widgets -lwidgets -Xlinker -rpath=$(AD)/build/libs/widgets
-LOADLIBES = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4`
+LDLIBS = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4`
-icon: icon.cc
+icon: icon.cc libwidgets
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ icon.cc $(LDLIBS)
+
+libwidgets:
+ cd $(AD); ./waf build --targets=libwidgets
+
+show: icon
+ rm -f /tmp/ardour_icons-*.png
+ ./icon -g -s 22 -o /tmp/ardour_icons-22.png
+ ./icon -g -s 23 -o /tmp/ardour_icons-23.png
+ ./icon -g -s 44 -o /tmp/ardour_icons-44.png
+ ./icon -g -s 45 -o /tmp/ardour_icons-45.png
+ convert -append /tmp/ardour_icons-*.png /tmp/ardour_icons.png
+ display /tmp/ardour_icons.png &
clean:
rm -f icon
+
+.PHONY: show libwidgets clean