3 # Convert SVG files to 1x and 2x PNGs. Dump a list of Qt resource
4 # file entries upon successful completion.
6 # Copyright 2014 Gerald Combs <gerald [AT] wireshark.org>
8 # Wireshark - Network traffic analyzer
9 # By Gerald Combs <gerald@wireshark.org>
10 # Copyright 1998 Gerald Combs
12 # SPDX-License-Identifier: GPL-2.0-or-later
14 # COMMON_ARGS="--export-area-page"
16 #SVGCLEANER=$( type -p svgcleaner )
18 # Running on WSL. Set as needed for Mac/linux.
19 INKSCAPE_EXE
="inkscape.com"
36 for SIZE
in 16x16
24x24
; do
41 TWO_X_WIDTH
=$
(( WIDTH
* 2 ))
42 TWO_X_HEIGHT
=$
(( HEIGHT
* 2 ))
43 ONE_X_ARGS
="--export-width=${WIDTH} --export-height=${HEIGHT}"
44 TWO_X_ARGS
="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
46 echo "Converting $SIZE_DIR"
47 cd $SIZE_DIR ||
exit 1
49 for ICON
in $ICONS ; do
50 echo "Converting $ICON"
52 ONE_X_SVG
="../../layouts.svg"
55 ICONNAME
="x-reset-$ICON"
56 ONE_X_PNG
=${ICONNAME}.png
57 TWO_X_PNG
=${ICONNAME}@
2x.png
59 if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
60 # shellcheck disable=SC2086
61 $INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
62 --export-filename="$ONE_X_PNG" $ONE_X_SVG ||
exit 1
63 QRC_FILES
="${QRC_FILES} ${SIZE_DIR}/${ONE_X_PNG}"
66 if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
67 # shellcheck disable=SC2086
68 $INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
69 --export-filename="$TWO_X_PNG" $TWO_X_SVG ||
exit 1
70 QRC_FILES
="${QRC_FILES} ${SIZE_DIR}/${TWO_X_PNG}"
79 for QRC_FILE
in $QRC_FILES ; do
80 echo " <file>stock_icons/${QRC_FILE}</file>"
83 echo "--------------------------------------"
86 for SIZE
in 48x48
96x96
; do
91 TWO_X_WIDTH
=$
(( WIDTH
* 2 ))
92 TWO_X_HEIGHT
=$
(( HEIGHT
* 2 ))
93 ONE_X_ARGS
="--export-width=${WIDTH} --export-height=${HEIGHT}"
94 TWO_X_ARGS
="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
96 echo "Converting $OUT_DIR"
98 for ICON
in $ICONS ; do
99 echo "Converting $ICON"
101 ONE_X_SVG
=${OUT_DIR}/layouts.svg
105 ONE_X_PNG
=${OUT_DIR}/${ICONNAME}.png
106 TWO_X_PNG
=${OUT_DIR}/${ICONNAME}@
2x.png
108 if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
109 # shellcheck disable=SC2086
110 $INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
111 --export-filename="$ONE_X_PNG" $ONE_X_SVG ||
exit 1
112 QRC_FILES
="${QRC_FILES} ${ICONNAME}.png"
115 if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
116 # shellcheck disable=SC2086
117 $INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
118 --export-filename="$TWO_X_PNG" $TWO_X_SVG ||
exit 1
119 QRC_FILES
="${QRC_FILES} ${ICONNAME}@2x.png"
126 for QRC_FILE
in $QRC_FILES ; do
127 echo " <file>${QRC_FILE}</file>"
130 # Editor modelines - https://www.wireshark.org/tools/modelines.html
135 # indent-tabs-mode: nil
138 # vi: set shiftwidth=4 tabstop=8 expandtab:
139 # :indentSize=4:tabSize=8:noTabs=true: