13
0

Update icon rendering tool

This commit is contained in:
Robin Gareus 2024-04-25 02:32:01 +02:00
parent f1a3eb1e3d
commit 97becda83a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 37 additions and 12 deletions

View File

@ -196,7 +196,10 @@ main (int argc, char** argv)
sq = ceil (sqrt (ArdourIcon::NoIcon + 3)); sq = ceil (sqrt (ArdourIcon::NoIcon + 3));
cairo_surface_t* cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2 * bd + wh * sq, 2 * bd + wh * sq); int w = sq;
int h = ceil ((ArdourIcon::NoIcon + 3.0) / sq);
cairo_surface_t* cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2 * bd + wh * w, 2 * bd + wh * h);
cairo_t* cr = cairo_create (cs); cairo_t* cr = cairo_create (cs);
Gtkmm2ext::set_source_rgba (cr, bg_color); Gtkmm2ext::set_source_rgba (cr, bg_color);
@ -214,7 +217,7 @@ main (int argc, char** argv)
if (bd > 0) { if (bd > 0) {
Gtkmm2ext::set_source_rgba (cr, fg_color); Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_set_line_width (cr, 1); cairo_set_line_width (cr, 1);
cairo_rectangle (cr, bd - .5, bd - .5, 1 + wh * sq, 1 + wh * sq); cairo_rectangle (cr, bd - .5, bd - .5, 1 + wh * w, 1 + wh * h);
cairo_stroke (cr); cairo_stroke (cr);
cairo_set_font_size (cr, fs); cairo_set_font_size (cr, fs);
for (int rc = 0; rc < sq; ++rc) { for (int rc = 0; rc < sq; ++rc) {
@ -228,6 +231,10 @@ main (int argc, char** argv)
); );
cairo_show_text (cr, tmp); cairo_show_text (cr, tmp);
if (rc >= h) {
continue;
}
snprintf (tmp, sizeof(tmp), "%d", rc + 1); snprintf (tmp, sizeof(tmp), "%d", rc + 1);
cairo_text_extents (cr, tmp, &extents); cairo_text_extents (cr, tmp, &extents);
cairo_move_to (cr, cairo_move_to (cr,

View File

@ -1,15 +1,33 @@
ICONFLAGS?=-g ICONFLAGS?=-g
AD = ../.. AD = ../..
CXXFLAGS = -Wall BL = ../../build/libs
TK = ../../build/libs/tk
CXXFLAGS = -Wall -fsanitize=address
CPPFLAGS = -I $(AD)/libs/gtkmm2ext -I $(AD)/libs/widgets -I $(AD)/libs/pbd -I $(AD)/build/libs/pbd CPPFLAGS = -I $(AD)/libs/gtkmm2ext -I $(AD)/libs/widgets -I $(AD)/libs/pbd -I $(AD)/build/libs/pbd
CPPFLAGS += `pkg-config --cflags cairo cairomm-1.0 libxml-2.0 glibmm-2.4 gtkmm-2.4` CPPFLAGS += -I $(AD)/libs/tk/ydkmm/ydkmm -I $(AD)/libs/tk/ydk/ydk/
CPPFLAGS += -I $(AD)/libs/tk/ytkmm/ytkmm -I $(AD)/libs/tk/ytk/ytk/
CPPFLAGS += -I $(AD)/libs/tk/ztkmm/ztkmm/ -I $(AD)/libs/tk/ztk/ztk/
CPPFLAGS += -I $(AD)/libs/tk/ydk-pixbuf/ydk-pixbuf/
CPPFLAGS += `pkg-config --cflags cairo pangomm-1.4 cairomm-1.0 libxml-2.0 glibmm-2.4 giomm-2.4`
LDFLAGS = -L$(AD)/build/libs/pbd -Wl,-rpath=$(AD)/build/libs/pbd LDFLAGS = -L$(BL)/pbd -Wl,-rpath=$(BL)/pbd
LDFLAGS += -L$(AD)/build/libs/gtkmm2ext -Wl,-rpath=$(AD)/build/libs/gtkmm2ext LDFLAGS += -L$(BL)/gtkmm2ext -Wl,-rpath=$(BL)/gtkmm2ext
LDFLAGS += -L$(AD)/build/libs/widgets -Wl,-rpath=$(AD)/build/libs/widgets LDFLAGS += -L$(BL)/widgets -Wl,-rpath=$(BL)/widgets
LDLIBS = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4` -lpbd -lgtkmm2ext -lwidgets LDFLAGS += -L$(TK)/ztk -Wl,-rpath=$(TK)/ztk
LDFLAGS += -L$(TK)/ydk -Wl,-rpath=$(TK)/ydk
LDFLAGS += -L$(TK)/ytk -Wl,-rpath=$(TK)/ytk
LDFLAGS += -L$(TK)/ydk-pixbuf -Wl,-rpath=$(TK)/ydk-pixbuf
LDFLAGS += -L$(TK)/ztkmm -Wl,-rpath=$(TK)/ztkmm
LDFLAGS += -L$(TK)/ydkmm -Wl,-rpath=$(TK)/ydkmm
LDFLAGS += -L$(TK)/ytkmm -Wl,-rpath=$(TK)/ytkmm
LDLIBS = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4`
LDLIBS += -lztk -lydk -lytk -lydk-pixbuf -lztkmm -lydkmm -lytkmm
LDLIBS += -lpbd -lgtkmm2ext -lwidgets
icon: icon.cc libwidgets icon: icon.cc libwidgets
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ icon.cc $(LDLIBS) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ icon.cc $(LDLIBS)
@ -19,10 +37,10 @@ libwidgets:
show: icon show: icon
rm -f /tmp/ardour_icons-*.png rm -f /tmp/ardour_icons-*.png
./icon $(ICONFLAGS) -s 22 -o /tmp/ardour_icons-22.png ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 22 -o /tmp/ardour_icons-22.png
./icon $(ICONFLAGS) -s 23 -o /tmp/ardour_icons-23.png ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 23 -o /tmp/ardour_icons-23.png
./icon $(ICONFLAGS) -s 44 -o /tmp/ardour_icons-44.png ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 44 -o /tmp/ardour_icons-44.png
./icon $(ICONFLAGS) -s 45 -o /tmp/ardour_icons-45.png ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 45 -o /tmp/ardour_icons-45.png
convert -gravity center \ convert -gravity center \
/tmp/ardour_icons-*.png \ /tmp/ardour_icons-*.png \
-background none \ -background none \