From 5a79bcdfadfc38e1c2c1ca593de442e42295a425 Mon Sep 17 00:00:00 2001 From: martin-s Date: Mon, 16 Jun 2008 08:54:13 +0000 Subject: [PATCH] Add:xpm:Added svg to png conversion and scaling git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1122 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/configure.in | 15 +++++++++++++++ navit/navit/xpm/Makefile.am | 14 ++++++++++++++ navit/navit/xpm/png2svg | 15 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100755 navit/navit/xpm/png2svg diff --git a/navit/configure.in b/navit/configure.in index 50e5ba6..49aa0cd 100644 --- a/navit/configure.in +++ b/navit/configure.in @@ -447,6 +447,21 @@ if test "x${enable_binding_dbus}" = "xyes" ; then fi AM_CONDITIONAL(USE_BINDING_DBUS, test "x${enable_binding_dbus}" = "xyes") +# svg +AC_ARG_ENABLE(svg, [ --disable-svg disable Scalable Vector Graphics], enable_svg=$enableval, enable_svg=yes) +AC_ARG_ENABLE(svg2png, [ --disable-svg2png disable conversion of svgs to pngs], enable_svg2png=$enableval, enable_svg2png=yes) +AC_ARG_ENABLE(svg2png_scaling, [ --enable-svg2png-scaling enable conversion of svgs to pngs with specified sizes], SVG2PNG_SCALES=$enableval, SVG2PNG_SCALES="8 16 32 48") +if test "x${enable_svg2png}" = "xyes" ; then + AC_PATH_PROG([KSVGTOPNG], [ksvgtopng], []) + if test ! -x "$KSVGTOPNG"; then + enable_svg2png = "no" + fi +fi +AC_SUBST(SVG2PNG_SCALES) +AM_CONDITIONAL(USE_SVG2PNG_SCALES, test "x${SVG2PNG_SCALES}" != "xyes" -a "x${SVG2PNG_SCALES}" != "x") +AM_CONDITIONAL(USE_SVG2PNG, test "x${enable_svg2png}" = "xyes") +AM_CONDITIONAL(USE_SVG, test "x${enable_svg}" = "xyes") + # NLS AC_ARG_ENABLE(nls, diff --git a/navit/navit/xpm/Makefile.am b/navit/navit/xpm/Makefile.am index 8687603..88680f3 100644 --- a/navit/navit/xpm/Makefile.am +++ b/navit/navit/xpm/Makefile.am @@ -3,6 +3,20 @@ xpm_DATA = airport.xpm attraction.xpm bank.xpm bar.xpm bus.xpm cafe.xpm camping. xpm_DATA += gc_reference.xpm gc_webcam.xpm gc_question.xpm gc_stages.xpm xpm_DATA += shopping.xpm heliport.xpm cursor.xpm peak.xpm mini_roundabout.xpm xpm_DATA += townhall.xpm level_crossing.xpm boat_ramp.xpm +svgs = gui_actions.svg gui_active.svg gui_bookmark.svg gui_display.svg gui_home.svg gui_inactive.svg gui_map.svg gui_maps.svg gui_rules.svg gui_settings.svg gui_sound.svg gui_tools.svg +if USE_SVG + xpm_DATA += $(svgs) +endif + +if USE_SVG2PNG +%.png:*.svg + $(srcdir)/png2svg "$@" +xpm_DATA += $(addsuffix .png,$(basename $(svgs))) +if USE_SVG2PNG_SCALES +xpm_DATA += $(foreach scale, @SVG2PNG_SCALES@, $(addsuffix _$(scale)_$(scale).png,$(basename $(svgs)))) +endif +endif + EXTRA_DIST = $(xpm_DATA) #burgerking.ico: # wget http://www.burgerking.de/favicon.ico -O burgerking.ico diff --git a/navit/navit/xpm/png2svg b/navit/navit/xpm/png2svg new file mode 100755 index 0000000..63ff1eb --- /dev/null +++ b/navit/navit/xpm/png2svg @@ -0,0 +1,15 @@ +#! /bin/sh +png=$1 +if [[ "$png" = *_[1-9]*_[1-9]*.png ]]; +then + svg=${png%_*_*.png}; + h=${png##*_} + w=${png%_$h} + h=${h%.png} + w=${w##*_} +else + w=$(grep 'width=".*px"' gui_actions.svg | head -1 | sed -e 's/px".*//' -e 's/.*"//') + h=$(grep 'height=".*px"' gui_actions.svg | head -1 | sed -e 's/px".*//' -e 's/.*"//') + svg=${png%.png} +fi +ksvgtopng $w $h $svg.svg $png -- 2.7.4