kicad/resources/bitmaps_png/mk_icn_res.sh

73 lines
2.5 KiB
Bash
Raw Normal View History

2014-01-09 15:01:59 +00:00
#!/bin/bash
#
# make icons using Inkscape
2022-01-22 18:22:58 +00:00
ICON="kicad
pcbnew
eeschema
gerbview
bitmap2component
pcbcalculator"
SIZE="16x16
24x24
32x32
48x48
64x64
128x128"
2014-01-09 15:01:59 +00:00
# create output directories
2022-01-22 18:22:58 +00:00
rm -r ../resources/linux/icons/hicolor/*
rm -r ../resources/linux/icons-nightly/hicolor/*
mkdir -p ../resources/linux/icons/hicolor/scalable/mimetypes ../resources/linux/icons/hicolor/scalable/apps
mkdir -p ../resources/linux/icons-nightly/hicolor/scalable/apps
2014-01-09 15:01:59 +00:00
echo -e '\E[0;34m'"Directory \"scalable\" for .svg icons was created."
2022-01-22 18:22:58 +00:00
tput sgr0
2014-01-09 15:01:59 +00:00
# copy sources to the scalable dir
2022-01-22 18:22:58 +00:00
cp ./sources/light/icon_kicad.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-project.svg
cp ./sources/light/icon_pcbnew.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-pcb.svg
cp ./sources/light/icon_eeschema.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-schematic.svg
2014-01-09 15:01:59 +00:00
2022-01-22 18:22:58 +00:00
for icon in $ICON
do
cp ./sources/light/icon_$icon.svg ../resources/linux/icons/hicolor/scalable/apps/$icon.svg
done
2014-01-09 15:01:59 +00:00
2022-01-22 18:22:58 +00:00
cp ./sources/light/icon_kicad_nightly.svg ../resources/linux/icons-nightly/hicolor/scalable/apps/kicad.svg
2014-01-09 15:01:59 +00:00
2022-01-22 18:22:58 +00:00
echo -e '\E[0;34m'"Sources of icons were copied."
tput sgr0
# convert .svg files into .png files
for size in $SIZE
2014-01-09 15:01:59 +00:00
do
sz=${size%x*}
2022-01-22 18:22:58 +00:00
source_sz=""
2022-01-22 18:22:58 +00:00
if [ $sz -le 32 ]
2014-01-09 15:01:59 +00:00
then
2022-01-22 18:22:58 +00:00
source_sz="_$sz"
2014-01-09 15:01:59 +00:00
fi
2022-01-22 18:22:58 +00:00
echo -e '\E[0;32m'"\nMaking icons with size $size from \"source$source_sz\"."
tput sgr0
mkdir -p ../resources/linux/icons/hicolor/$size/mimetypes ../resources/linux/icons/hicolor/$size/apps
mkdir -p ../resources/linux/icons-nightly/hicolor/$size/apps
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-project.png -w $sz -h $sz --export-area-snap ./sources/light/icon_kicad${source_sz}.svg
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-pcb.png -w $sz -h $sz --export-area-snap ./sources/light/icon_pcbnew${source_sz}.svg
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-schematic.png -w $sz -h $sz --export-area-snap ./sources/light/icon_eeschema${source_sz}.svg
for icon in $ICON
do
inkscape -o ../resources/linux/icons/hicolor/$size/apps/$icon.png -w $sz -h $sz --export-area-snap ./sources/light/icon_${icon}${source_sz}.svg
done
inkscape -o ../resources/linux/icons-nightly/hicolor/$size/apps/kicad.png -w $sz -h $sz --export-area-snap ./sources/light/icon_kicad_nightly${source_sz}.svg
done