You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB

  1. #!/bin/bash
  2. #
  3. # make macos icons using Inkscape
  4. mkdir macos_tmp
  5. # convert .svg files into .png files
  6. SIZES="16x16
  7. 32x32
  8. 128x128
  9. 256x256
  10. 512x512
  11. 1024x1024"
  12. ICONS="bitmap2component
  13. eeschema
  14. gerbview
  15. kicad
  16. pagelayout_editor
  17. pcbcalculator
  18. pcbnew"
  19. for pgm in $ICONS
  20. do
  21. output=""
  22. for size in $SIZES
  23. do
  24. sz=${size%x*}
  25. echo -e '\E[0;32m'"\nMaking the applications icons with size $size."
  26. # MacOS wants icons with 10% clearance on each side
  27. let "sub_sz = $sz * 8 / 10"
  28. sigma=3
  29. if [ $sz -eq 16 ]
  30. then
  31. sigma=2
  32. elif [ $sz -ge 512 ]
  33. then
  34. sigma=5
  35. fi
  36. # Offset the drop shadow by one smaller than the kernel
  37. let "off = $sigma - 1"
  38. # Use specialized icons for smaller sizes to keep pixel alignment
  39. if [ $sz -le 32 ]
  40. then
  41. inkscape sources/light/icon_${pgm}_${sz}.svg -o macos_tmp/${pgm}_small_${sz}px.png -w ${sub_sz} -h ${sub_sz} --export-area-snap
  42. else
  43. inkscape sources/light/icon_${pgm}.svg -o macos_tmp/${pgm}_small_${sz}px.png -w ${sub_sz} -h ${sub_sz} --export-area-snap
  44. fi
  45. convert macos_tmp/${pgm}_small_${sz}px.png \( +clone -background black -shadow 80x${sigma}+${off}+${off} \) +swap -background transparent -layers merge +repage -size $size xc:transparent +swap -gravity center -composite macos_tmp/${pgm}_${sz}px.png
  46. output+="macos_tmp/${pgm}_${sz}px.png "
  47. done
  48. if [ ${pgm} == "pcbcalculator" ]
  49. then
  50. # mismatch in the pcbcalculator icon names
  51. png2icns ../pcb_calculator/pcb_calculator.icns ${output}
  52. elif [ ${pgm} == "bitmap2component" ]
  53. then
  54. #bitmap2component does not have associated documents
  55. png2icns ../${pgm}/${pgm}.icns ${output}
  56. else
  57. png2icns ../${pgm}/${pgm}.icns ${output}
  58. cp ../${pgm}/${pgm}.icns ../${pgm}/${pgm}_doc.icns
  59. fi
  60. done
  61. # rm -rf macos_tmp