Update icon render tool
* add "grid" mode * re-build libwidgets as needed * add a convenient `make show` target
This commit is contained in:
parent
7f2bfa362f
commit
8cc1f8f8cb
@ -30,8 +30,9 @@
|
|||||||
|
|
||||||
using namespace ArdourWidgets;
|
using namespace ArdourWidgets;
|
||||||
|
|
||||||
static int wh = 64;
|
static int wh = 64;
|
||||||
static int sq = 1;
|
static int sq = 1;
|
||||||
|
static bool grid = false;
|
||||||
|
|
||||||
static uint32_t bg_color = 0x3d3d3dff; // gtk_background
|
static uint32_t bg_color = 0x3d3d3dff; // gtk_background
|
||||||
static uint32_t fg_color = 0xeeeeecff; // gtk_foreground
|
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;
|
int row = pos / sq;
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, col * wh, row * wh);
|
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);
|
ArdourIcon::render (cr, icon, wh, wh, state, fg_color);
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
}
|
}
|
||||||
@ -129,8 +141,11 @@ main (int argc, char** argv)
|
|||||||
const char* fn = "/tmp/ardour_icons.png";
|
const char* fn = "/tmp/ardour_icons.png";
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while (EOF != (c = getopt (argc, argv, "o:s:t:"))) {
|
while (EOF != (c = getopt (argc, argv, "go:s:t:"))) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'g':
|
||||||
|
grid = true;
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
if (!load_colors (optarg)) {
|
if (!load_colors (optarg)) {
|
||||||
std::cerr << "Error: failed to load color theme.\n";
|
std::cerr << "Error: failed to load color theme.\n";
|
||||||
|
@ -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/gtkmm2ext -lgtkmm2ext -Xlinker -rpath=$(AD)/build/libs/gtkmm2ext
|
||||||
LDFLAGS += -L $(AD)/build/libs/widgets -lwidgets -Xlinker -rpath=$(AD)/build/libs/widgets
|
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:
|
clean:
|
||||||
rm -f icon
|
rm -f icon
|
||||||
|
|
||||||
|
.PHONY: show libwidgets clean
|
||||||
|
Loading…
Reference in New Issue
Block a user