diff --git a/docs/builds.md b/docs/builds.md index 51b43fe..ed9e136 100644 --- a/docs/builds.md +++ b/docs/builds.md @@ -87,7 +87,8 @@ dem Godot-Template. Das Manifest referenziert nur `@mipmap/icon`; die Warnung ist folgenlos. - Paket: `de.rinkplanner.app`, Label „Rinkplanner“, Version 0.1.0 -- App-Icon aus `rinkplanner/icon.svg` (Launcher-Icons unter +- App-Icon aus der Silhouetten-Vorlage, erzeugt mit + `tools/make_app_icons.py` (Launcher-Icons unter `rinkplanner/assets/icons/android/`) - `minSdk 24`, `targetSdk 36`, ABI **arm64-v8a** (Galaxy Tab S9+) - Landscape, Immersive Mode, `resizeableActivity=true` diff --git a/rinkplanner/assets/icons/android/ic_launcher_192.png b/rinkplanner/assets/icons/android/ic_launcher_192.png index 6e3295a..f2b3b0c 100644 Binary files a/rinkplanner/assets/icons/android/ic_launcher_192.png and b/rinkplanner/assets/icons/android/ic_launcher_192.png differ diff --git a/rinkplanner/assets/icons/android/ic_launcher_background_432.png b/rinkplanner/assets/icons/android/ic_launcher_background_432.png index 4e8b06f..1757ee7 100644 Binary files a/rinkplanner/assets/icons/android/ic_launcher_background_432.png and b/rinkplanner/assets/icons/android/ic_launcher_background_432.png differ diff --git a/rinkplanner/assets/icons/android/ic_launcher_foreground_432.png b/rinkplanner/assets/icons/android/ic_launcher_foreground_432.png index 2ed74ae..3c5fc7c 100644 Binary files a/rinkplanner/assets/icons/android/ic_launcher_foreground_432.png and b/rinkplanner/assets/icons/android/ic_launcher_foreground_432.png differ diff --git a/rinkplanner/assets/icons/android/ic_launcher_monochrome_432.png b/rinkplanner/assets/icons/android/ic_launcher_monochrome_432.png index b49a278..3c5fc7c 100644 Binary files a/rinkplanner/assets/icons/android/ic_launcher_monochrome_432.png and b/rinkplanner/assets/icons/android/ic_launcher_monochrome_432.png differ diff --git a/rinkplanner/assets/icons/app_icon.png b/rinkplanner/assets/icons/app_icon.png new file mode 100644 index 0000000..bf70948 Binary files /dev/null and b/rinkplanner/assets/icons/app_icon.png differ diff --git a/rinkplanner/icon.svg.import b/rinkplanner/assets/icons/app_icon.png.import similarity index 69% rename from rinkplanner/icon.svg.import rename to rinkplanner/assets/icons/app_icon.png.import index 25206d0..e7e1868 100644 --- a/rinkplanner/icon.svg.import +++ b/rinkplanner/assets/icons/app_icon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://c360p00qqrprd" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +uid="uid://dx1ysnce0moky" +path="res://.godot/imported/app_icon.png-9a69111674c8dca1e760c9c054aa6873.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +source_file="res://assets/icons/app_icon.png" +dest_files=["res://.godot/imported/app_icon.png-9a69111674c8dca1e760c9c054aa6873.ctex"] [params] @@ -38,6 +38,3 @@ process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 detect_3d/compress_to=1 -svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false diff --git a/rinkplanner/assets/icons/icon_foreground.svg b/rinkplanner/assets/icons/icon_foreground.svg deleted file mode 100644 index fb2e96c..0000000 --- a/rinkplanner/assets/icons/icon_foreground.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/rinkplanner/assets/icons/icon_foreground.svg.import b/rinkplanner/assets/icons/icon_foreground.svg.import deleted file mode 100644 index dd6ed88..0000000 --- a/rinkplanner/assets/icons/icon_foreground.svg.import +++ /dev/null @@ -1,43 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://c57tr8h4rw10t" -path="res://.godot/imported/icon_foreground.svg-9362c3bcea0c351cf11ae5f264f1c60b.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/icons/icon_foreground.svg" -dest_files=["res://.godot/imported/icon_foreground.svg-9362c3bcea0c351cf11ae5f264f1c60b.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 -svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false diff --git a/rinkplanner/icon.svg b/rinkplanner/icon.svg deleted file mode 100644 index 5155529..0000000 --- a/rinkplanner/icon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/rinkplanner/project.godot b/rinkplanner/project.godot index 8173750..f9d2499 100644 --- a/rinkplanner/project.godot +++ b/rinkplanner/project.godot @@ -13,7 +13,7 @@ config_version=5 config/name="Rinkplanner" run/main_scene="res://scenes/whiteboard/whiteboard.tscn" config/features=PackedStringArray("4.5", "Forward Plus") -config/icon="res://icon.svg" +config/icon="res://assets/icons/app_icon.png" [editor_plugins] diff --git a/tools/make_app_icons.py b/tools/make_app_icons.py new file mode 100644 index 0000000..350f61d --- /dev/null +++ b/tools/make_app_icons.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Erzeugt die App-Icons aus einer Silhouetten-Vorlage. + +Aufruf: + python3 tools/make_app_icons.py pfad/zur/silhouette.png + +Die Vorlage muss eine Silhouette mit Alphakanal sein (Form = Deckkraft). +Erzeugt: + rinkplanner/assets/icons/app_icon.png 1024x1024 (Desktop/macOS) + rinkplanner/assets/icons/android/ic_launcher_192.png Legacy-Launcher + .../ic_launcher_foreground_432.png Adaptive Foreground + .../ic_launcher_background_432.png Adaptive Background + .../ic_launcher_monochrome_432.png Themed Icon +""" + +from pathlib import Path +import sys + +from PIL import Image, ImageDraw + +REPO = Path(__file__).resolve().parent.parent +ICONS = REPO / "rinkplanner" / "assets" / "icons" +ANDROID = ICONS / "android" + +BACKGROUND = (11, 18, 32, 255) # #0b1220, passt zur App-Oberfläche +SILHOUETTE = (255, 255, 255, 255) +MASTER_SIZE = 1024 +CORNER_RADIUS = 220 + + +def load_mask(path: Path) -> Image.Image: + source = Image.open(path).convert("RGBA") + return source.getchannel("A") + + +def fitted(mask: Image.Image, target_height: int) -> Image.Image: + bbox = mask.getbbox() + if bbox is None: + raise SystemExit("Die Vorlage enthält keine sichtbare Silhouette.") + cropped = mask.crop(bbox) + scale = target_height / cropped.height + size = (max(1, round(cropped.width * scale)), target_height) + return cropped.resize(size, Image.LANCZOS) + + +def tinted(mask: Image.Image, color) -> Image.Image: + layer = Image.new("RGBA", mask.size, color) + layer.putalpha(mask) + return layer + + +def rounded_background(size: int, radius: int) -> Image.Image: + tile = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + draw = ImageDraw.Draw(tile) + draw.rounded_rectangle((0, 0, size - 1, size - 1), radius=radius, fill=BACKGROUND) + return tile + + +def compose_master(mask: Image.Image) -> Image.Image: + tile = rounded_background(MASTER_SIZE, CORNER_RADIUS) + shape = fitted(mask, int(MASTER_SIZE * 0.74)) + position = ( + (MASTER_SIZE - shape.width) // 2, + (MASTER_SIZE - shape.height) // 2, + ) + tile.alpha_composite(tinted(shape, SILHOUETTE), position) + return tile + + +def compose_foreground(mask: Image.Image) -> Image.Image: + canvas = Image.new("RGBA", (432, 432), (0, 0, 0, 0)) + shape = fitted(mask, int(432 * 0.60)) + position = ((432 - shape.width) // 2, (432 - shape.height) // 2) + canvas.alpha_composite(tinted(shape, SILHOUETTE), position) + return canvas + + +def main() -> None: + if len(sys.argv) != 2: + raise SystemExit("Aufruf: python3 tools/make_app_icons.py ") + source = Path(sys.argv[1]) + if not source.exists(): + raise SystemExit(f"Vorlage nicht gefunden: {source}") + + ANDROID.mkdir(parents=True, exist_ok=True) + mask = load_mask(source) + + master = compose_master(mask) + master.save(ICONS / "app_icon.png") + master.resize((192, 192), Image.LANCZOS).save(ANDROID / "ic_launcher_192.png") + + foreground = compose_foreground(mask) + foreground.save(ANDROID / "ic_launcher_foreground_432.png") + + background = Image.new("RGBA", (432, 432), BACKGROUND) + background.save(ANDROID / "ic_launcher_background_432.png") + + monochrome = Image.new("RGBA", (432, 432), (0, 0, 0, 0)) + monochrome.alpha_composite(foreground) + monochrome.save(ANDROID / "ic_launcher_monochrome_432.png") + + print(f"Vorlage: {source}") + for path in sorted(ICONS.rglob("*.png")): + print(f" {path.relative_to(REPO)}") + + +if __name__ == "__main__": + main()