From: Severin Meyer Date: Fri, 5 Nov 2021 13:47:55 +0000 (+0100) Subject: Render Luma crosshairs with Inkscape to avoid rsvg inconsistencies X-Git-Tag: xonotic-v0.8.5~4^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7c54ef9a811c04c1143988d006b1a8e3275f547d;p=xonotic%2Fmediasource.git Render Luma crosshairs with Inkscape to avoid rsvg inconsistencies --- diff --git a/gfx/crosshairs/luma/gfx/common.filters b/gfx/crosshairs/luma/gfx/common.filters index 45de8ba..262a99a 100644 --- a/gfx/crosshairs/luma/gfx/common.filters +++ b/gfx/crosshairs/luma/gfx/common.filters @@ -1,20 +1,19 @@ - - - + + + - - - - - + + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair32.svg b/gfx/crosshairs/luma/gfx/crosshair32.svg index 0dc4cd6..f8d02f4 100644 --- a/gfx/crosshairs/luma/gfx/crosshair32.svg +++ b/gfx/crosshairs/luma/gfx/crosshair32.svg @@ -1,6 +1,4 @@ - - - + diff --git a/gfx/crosshairs/luma/gfx/crosshair33.svg b/gfx/crosshairs/luma/gfx/crosshair33.svg index 5807135..3d7ff4d 100644 --- a/gfx/crosshairs/luma/gfx/crosshair33.svg +++ b/gfx/crosshairs/luma/gfx/crosshair33.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair34.svg b/gfx/crosshairs/luma/gfx/crosshair34.svg index fee3e2b..e00deb0 100644 --- a/gfx/crosshairs/luma/gfx/crosshair34.svg +++ b/gfx/crosshairs/luma/gfx/crosshair34.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair35.svg b/gfx/crosshairs/luma/gfx/crosshair35.svg index ea7cb52..6d949a9 100644 --- a/gfx/crosshairs/luma/gfx/crosshair35.svg +++ b/gfx/crosshairs/luma/gfx/crosshair35.svg @@ -2,11 +2,11 @@ - + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair36.svg b/gfx/crosshairs/luma/gfx/crosshair36.svg index f8e7bfe..2c2539e 100644 --- a/gfx/crosshairs/luma/gfx/crosshair36.svg +++ b/gfx/crosshairs/luma/gfx/crosshair36.svg @@ -2,11 +2,11 @@ - + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair37.svg b/gfx/crosshairs/luma/gfx/crosshair37.svg index 62396c6..8fa444b 100644 --- a/gfx/crosshairs/luma/gfx/crosshair37.svg +++ b/gfx/crosshairs/luma/gfx/crosshair37.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair38.svg b/gfx/crosshairs/luma/gfx/crosshair38.svg index a21e04a..ecc4246 100644 --- a/gfx/crosshairs/luma/gfx/crosshair38.svg +++ b/gfx/crosshairs/luma/gfx/crosshair38.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair39.svg b/gfx/crosshairs/luma/gfx/crosshair39.svg index 28ea3f3..f950453 100644 --- a/gfx/crosshairs/luma/gfx/crosshair39.svg +++ b/gfx/crosshairs/luma/gfx/crosshair39.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair40.svg b/gfx/crosshairs/luma/gfx/crosshair40.svg index 8a92f34..21433f7 100644 --- a/gfx/crosshairs/luma/gfx/crosshair40.svg +++ b/gfx/crosshairs/luma/gfx/crosshair40.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair41.svg b/gfx/crosshairs/luma/gfx/crosshair41.svg index fde3bab..e8c073d 100644 --- a/gfx/crosshairs/luma/gfx/crosshair41.svg +++ b/gfx/crosshairs/luma/gfx/crosshair41.svg @@ -8,8 +8,8 @@ - - - + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair42.svg b/gfx/crosshairs/luma/gfx/crosshair42.svg index 971e84e..7c827c7 100644 --- a/gfx/crosshairs/luma/gfx/crosshair42.svg +++ b/gfx/crosshairs/luma/gfx/crosshair42.svg @@ -1,7 +1,7 @@ - - - + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair43.svg b/gfx/crosshairs/luma/gfx/crosshair43.svg index 9f850dd..7d37b5c 100644 --- a/gfx/crosshairs/luma/gfx/crosshair43.svg +++ b/gfx/crosshairs/luma/gfx/crosshair43.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair44.svg b/gfx/crosshairs/luma/gfx/crosshair44.svg index ef2110f..d899f35 100644 --- a/gfx/crosshairs/luma/gfx/crosshair44.svg +++ b/gfx/crosshairs/luma/gfx/crosshair44.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair45.svg b/gfx/crosshairs/luma/gfx/crosshair45.svg index 0d2c44e..3b16f08 100644 --- a/gfx/crosshairs/luma/gfx/crosshair45.svg +++ b/gfx/crosshairs/luma/gfx/crosshair45.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair46.svg b/gfx/crosshairs/luma/gfx/crosshair46.svg index ab3d212..c3ee1a2 100644 --- a/gfx/crosshairs/luma/gfx/crosshair46.svg +++ b/gfx/crosshairs/luma/gfx/crosshair46.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair47.svg b/gfx/crosshairs/luma/gfx/crosshair47.svg index 7082560..6798f1c 100644 --- a/gfx/crosshairs/luma/gfx/crosshair47.svg +++ b/gfx/crosshairs/luma/gfx/crosshair47.svg @@ -8,7 +8,7 @@ - - + + diff --git a/gfx/crosshairs/luma/gfx/crosshair48.svg b/gfx/crosshairs/luma/gfx/crosshair48.svg index df9b47b..86612f0 100644 --- a/gfx/crosshairs/luma/gfx/crosshair48.svg +++ b/gfx/crosshairs/luma/gfx/crosshair48.svg @@ -1,6 +1,4 @@ - - - + diff --git a/gfx/crosshairs/luma/gfx/crosshair49.svg b/gfx/crosshairs/luma/gfx/crosshair49.svg index 774077b..902ca0d 100644 --- a/gfx/crosshairs/luma/gfx/crosshair49.svg +++ b/gfx/crosshairs/luma/gfx/crosshair49.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair50.svg b/gfx/crosshairs/luma/gfx/crosshair50.svg index ed290b1..1903f18 100644 --- a/gfx/crosshairs/luma/gfx/crosshair50.svg +++ b/gfx/crosshairs/luma/gfx/crosshair50.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair51.svg b/gfx/crosshairs/luma/gfx/crosshair51.svg index 57c3bb6..451ba73 100644 --- a/gfx/crosshairs/luma/gfx/crosshair51.svg +++ b/gfx/crosshairs/luma/gfx/crosshair51.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair52.svg b/gfx/crosshairs/luma/gfx/crosshair52.svg index e32072e..97b30b0 100644 --- a/gfx/crosshairs/luma/gfx/crosshair52.svg +++ b/gfx/crosshairs/luma/gfx/crosshair52.svg @@ -1,6 +1,6 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshair53.svg b/gfx/crosshairs/luma/gfx/crosshair53.svg index f4356ba..d03d571 100644 --- a/gfx/crosshairs/luma/gfx/crosshair53.svg +++ b/gfx/crosshairs/luma/gfx/crosshair53.svg @@ -8,7 +8,7 @@ - - + + diff --git a/gfx/crosshairs/luma/gfx/crosshair54.svg b/gfx/crosshairs/luma/gfx/crosshair54.svg index 75ef1e2..38f63c0 100644 --- a/gfx/crosshairs/luma/gfx/crosshair54.svg +++ b/gfx/crosshairs/luma/gfx/crosshair54.svg @@ -1,6 +1,4 @@ - - - + diff --git a/gfx/crosshairs/luma/gfx/crosshair55.svg b/gfx/crosshairs/luma/gfx/crosshair55.svg index 7b67221..cf3e991 100644 --- a/gfx/crosshairs/luma/gfx/crosshair55.svg +++ b/gfx/crosshairs/luma/gfx/crosshair55.svg @@ -1,11 +1,11 @@ - + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair56.svg b/gfx/crosshairs/luma/gfx/crosshair56.svg index ee380a8..52909e6 100644 --- a/gfx/crosshairs/luma/gfx/crosshair56.svg +++ b/gfx/crosshairs/luma/gfx/crosshair56.svg @@ -1,11 +1,11 @@ - + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair57.svg b/gfx/crosshairs/luma/gfx/crosshair57.svg index 6dc531a..faf38ba 100644 --- a/gfx/crosshairs/luma/gfx/crosshair57.svg +++ b/gfx/crosshairs/luma/gfx/crosshair57.svg @@ -8,9 +8,9 @@ - - - + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair58.svg b/gfx/crosshairs/luma/gfx/crosshair58.svg index b32453a..ce75fd4 100644 --- a/gfx/crosshairs/luma/gfx/crosshair58.svg +++ b/gfx/crosshairs/luma/gfx/crosshair58.svg @@ -1,11 +1,13 @@ - - + + - - + + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair59.svg b/gfx/crosshairs/luma/gfx/crosshair59.svg index 8275d39..60eafad 100644 --- a/gfx/crosshairs/luma/gfx/crosshair59.svg +++ b/gfx/crosshairs/luma/gfx/crosshair59.svg @@ -1,11 +1,11 @@ - + - - - - + + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair60.svg b/gfx/crosshairs/luma/gfx/crosshair60.svg index bcb569a..537cc1d 100644 --- a/gfx/crosshairs/luma/gfx/crosshair60.svg +++ b/gfx/crosshairs/luma/gfx/crosshair60.svg @@ -12,8 +12,8 @@ - - - + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair61.svg b/gfx/crosshairs/luma/gfx/crosshair61.svg index 57dff7a..91449cb 100644 --- a/gfx/crosshairs/luma/gfx/crosshair61.svg +++ b/gfx/crosshairs/luma/gfx/crosshair61.svg @@ -1,9 +1,9 @@ - - - - + + + + diff --git a/gfx/crosshairs/luma/gfx/crosshair62.svg b/gfx/crosshairs/luma/gfx/crosshair62.svg index 6f17bf2..9ffe8fb 100644 --- a/gfx/crosshairs/luma/gfx/crosshair62.svg +++ b/gfx/crosshairs/luma/gfx/crosshair62.svg @@ -1,9 +1,9 @@ - - + + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair63.svg b/gfx/crosshairs/luma/gfx/crosshair63.svg index 0e41217..8cbeaa8 100644 --- a/gfx/crosshairs/luma/gfx/crosshair63.svg +++ b/gfx/crosshairs/luma/gfx/crosshair63.svg @@ -1,17 +1,17 @@ - - + + - + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair64.svg b/gfx/crosshairs/luma/gfx/crosshair64.svg index 47a81b0..2468e98 100644 --- a/gfx/crosshairs/luma/gfx/crosshair64.svg +++ b/gfx/crosshairs/luma/gfx/crosshair64.svg @@ -1,9 +1,9 @@ - + - - + + diff --git a/gfx/crosshairs/luma/gfx/crosshair65.svg b/gfx/crosshairs/luma/gfx/crosshair65.svg index 15506bb..5b1fbde 100644 --- a/gfx/crosshairs/luma/gfx/crosshair65.svg +++ b/gfx/crosshairs/luma/gfx/crosshair65.svg @@ -1,21 +1,21 @@ - - - - - - - - - + + + + + + + + + - + diff --git a/gfx/crosshairs/luma/gfx/crosshair66.svg b/gfx/crosshairs/luma/gfx/crosshair66.svg index 5025064..7f52851 100644 --- a/gfx/crosshairs/luma/gfx/crosshair66.svg +++ b/gfx/crosshairs/luma/gfx/crosshair66.svg @@ -1,10 +1,10 @@ - - - - - + + + + + diff --git a/gfx/crosshairs/luma/gfx/crosshairdot.svg b/gfx/crosshairs/luma/gfx/crosshairdot.svg index ac35d38..886f943 100644 --- a/gfx/crosshairs/luma/gfx/crosshairdot.svg +++ b/gfx/crosshairs/luma/gfx/crosshairdot.svg @@ -1,6 +1,4 @@ - - - + diff --git a/gfx/crosshairs/luma/gfx/crosshairmoustache.svg b/gfx/crosshairs/luma/gfx/crosshairmoustache.svg index 19a8598..8a4ea37 100644 --- a/gfx/crosshairs/luma/gfx/crosshairmoustache.svg +++ b/gfx/crosshairs/luma/gfx/crosshairmoustache.svg @@ -1,4 +1,4 @@ - + diff --git a/gfx/crosshairs/luma/gfx/crosshairtuba.svg b/gfx/crosshairs/luma/gfx/crosshairtuba.svg index 587e952..bf8b466 100644 --- a/gfx/crosshairs/luma/gfx/crosshairtuba.svg +++ b/gfx/crosshairs/luma/gfx/crosshairtuba.svg @@ -1,4 +1,4 @@ - + diff --git a/gfx/crosshairs/luma/render-crosshairs.sh b/gfx/crosshairs/luma/render-crosshairs.sh deleted file mode 100755 index 52569e2..0000000 --- a/gfx/crosshairs/luma/render-crosshairs.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -e -# TASK -# Render crosshairs from gfx/crosshair*.svg to DATADIR/gfx/crosshair*.tga, -# if they are newer than their target tga file. -# -# NOTES -# To compensate for filter rendering errors and to reduce rbg noise, -# the svg files are rendered at a large size and then scaled down. -# -# DEPENDENCIES -# rsvg-convert (librsvg) -# convert (imagemagick) -# -# USAGE -# ./render-svg.sh DATADIR -# -# USAGE EXAMPLE -# ./render-crosshairs.sh ~/.xonotic/data - - -# Check for argument -if [ -z "$1" ]; then - echo "Usage: $0 DATADIR" - exit 1 -fi - - -data="$1"; shift -maxScale=8 -maxPixels=100000000 - - -for svg in gfx/*.svg; do - ext="${svg##*.}" - dir="$data/${svg%/*}" - tga="$data/${svg%.*}.tga" - - if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ "$svg" -nt "$tga" ]; then - echo "Rendering $tga" - - w=$(identify -format "%w" "$svg") - h=$(identify -format "%h" "$svg") - scale=$(echo "s=sqrt($maxPixels/$w/$h);if(s>$maxScale)s=$maxScale;s" | bc) - - mkdir -p "$dir" - rsvg-convert -z "$scale" "$svg" | convert - -scale "$w" "$tga" - fi -done diff --git a/gfx/crosshairs/luma/render.sh b/gfx/crosshairs/luma/render.sh new file mode 100755 index 0000000..4d93ba2 --- /dev/null +++ b/gfx/crosshairs/luma/render.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +# Task: +# Render SVG files from ./path/file.svg to OUTDIR/path/file.tga +# Overwrites existing tga files. +# +# Usage: +# ./render.sh OUTDIR SVG... +# +# Examples: +# One file: ./render.sh ~/.xonotic/data gfx/crosshair64.svg +# All files: ./render.sh ~/.xonotic/data $(find . -name "*.svg") +# +# Dependencies: +# Inkscape (1.0.1) +# ImageMagick (7.0.7) + +outDir="$1"; shift + +for svg in "$@"; do + # Extract name components + svgDir=$(dirname -- "$svg") + svgName=$(basename -- "$svg" .svg) + + # Compose target file names + dir="$outDir/$svgDir" + tga="$dir/$svgName.tga" + tmp="$dir/$svgName.tmp.png" + + # Ensure target directory exists + mkdir --parent "$dir" + + # Render image + inkscape --export-filename "$tmp" "$svg" + convert -auto-orient "$tmp" -compress RLE "$tga" + rm "$tmp" +done