mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 11:02:19 +08:00
selfdrive/assets: rasterize SVGs (#35243)
* selfdrive/assets: rasterize SVGs * do entire assets dir * fixed size - 4096px is a lot * optimise them too * use inkscape * regenerate * abandon runtime svg
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc472f0e575e314c4006cb6e9845fb9fb9a13cf08fe74fbe1593dee53c20d977
|
||||
size 4329
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fdb0be280ac3a78bf95f5b92fafe94de5084ecc06836459c3a9fe1912a5b2454
|
||||
size 10479
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e2a992a83eaa87762e12dc226f36af48e1cdbfc3b83ef75b6a2fc4103e3697a0
|
||||
size 9120
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7c11f831c17080a8ffaa8469cf91a079a4abfb72e5238afe02b92bceb3442db0
|
||||
size 2656
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cbfed12ddb5731b7b568539fe59f382356b46fdd146a9e0a1b768d3e5efd0378
|
||||
size 4350
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:911f59f248015600da7ecc689398103d47dfc57f6be17ac8c8e543a726a6c64b
|
||||
size 3311
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f23fabbf60fff6ef88ba6f27f2775b1ae6be172a994e41267983a9ec0f984bfc
|
||||
size 15059
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1e58deb1778cf2826339f27e9f09eecc79ea137c1436210c14b71c352a649c77
|
||||
size 34953
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8f37a02dd914405c6f86f415700dd5985eb976b923e7abd6580d2da76533594e
|
||||
size 9466
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6b2dad33fead9f064c3a548651d6ef37daf82b6127c329683f538ec6e986ecbc
|
||||
size 11204
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:64d9dc106172d3a54088ef51a27a48145154ca040c43ecbc8d626fa42e38886e
|
||||
size 9352
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:94246db66e774cbaee618931f76ecc38ecb72eca097d1e6c20a8dec2a5f8cd29
|
||||
size 7087
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3b89b8803bb610515aef051c93b833dc62f8c847558873cfd50a0b240c968449
|
||||
size 4911
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5f2745ce89c926e507888ea7c6df1884aab045887048cf0d813407396a2e6b18
|
||||
size 5894
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8b7f0971cf612b905ccb338e40921932773538517fc9f0f7a4a847ad596287a9
|
||||
size 7171
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a2afacf302bcdc3f5e0d2f734508e8fea6f803813098d52fa6b878c765ba7a58
|
||||
size 9360
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7dfe50815c76d459dc104ce4a5e4b5dfd882e11b65e07706cacd336e69e788f4
|
||||
size 9756
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:304ab97ac9724a7a133a36c2d14da9fe8ab660c9a29abb99cc0a4828f94d8801
|
||||
size 9627
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8eac201013322db1580649a253da7ae38eb9f16f6089234e769b746951e874ee
|
||||
size 7171
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b9218e02c42b0f80858477255e24a97da4cf0b2898fc76f3806409d65b104668
|
||||
size 4510
|
||||
@@ -1,10 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
for svg in $(find icons/ images/ -type f | grep svg$); do
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
# sudo apt install inkscape
|
||||
|
||||
for svg in $(find $DIR -type f | grep svg$); do
|
||||
bunx svgo $svg --multipass --pretty --indent 2
|
||||
|
||||
# convert to PNG
|
||||
# sudo apt install inkscape
|
||||
convert -background none -resize 400% -density 384 $svg "${svg%.svg}.png"
|
||||
png="${svg%.svg}.png"
|
||||
width=$(inkscape --query-width "$svg")
|
||||
height=$(inkscape --query-height "$svg")
|
||||
if (( $(echo "$width > $height" | bc -l) )); then
|
||||
export_dim="--export-width=512"
|
||||
else
|
||||
export_dim="--export-height=512"
|
||||
fi
|
||||
inkscape "$svg" --export-filename="$png" $export_dim
|
||||
|
||||
optipng -o7 -strip all "$png"
|
||||
done
|
||||
|
||||
@@ -80,10 +80,7 @@ class GuiApplication:
|
||||
|
||||
def _load_texture_from_image(self, image_path: str, width: int, height: int, alpha_premultiply = False, keep_aspect_ratio=True):
|
||||
"""Load and resize a texture, storing it for later automatic unloading."""
|
||||
if image_path.endswith('.svg'):
|
||||
image = self._load_image_from_svg(image_path)
|
||||
else:
|
||||
image = rl.load_image(image_path)
|
||||
image = rl.load_image(image_path)
|
||||
|
||||
if alpha_premultiply:
|
||||
rl.image_alpha_premultiply(image)
|
||||
@@ -112,10 +109,6 @@ class GuiApplication:
|
||||
rl.unload_image(image)
|
||||
return texture
|
||||
|
||||
def _load_image_from_svg(self, svg_path: str):
|
||||
# TODO: Implement SVG loading
|
||||
assert(0)
|
||||
|
||||
def close(self):
|
||||
if not rl.is_window_ready():
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user