SPB Git

Repository Public

icone.py 5.5 KB 131 lines python

1#!/usr/bin/env python32# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# PROJECT METADATA8# -----------------------------------------------------------------------------9# Project          : Valo-Plex iOS10# File             : Scripts/icone.py11# Description      : dessine l'icône de l'app et la marque de l'écran de12#                    lancement : la petite façade de brique (composant Marque13#                    du site, src/components/Facade.tsx) sur fond papier. Aucun14#                    dégradé. usage : python3 Scripts/icone.py15# Module           : Scripts16# Repository       : https://git.spboucher.ai/valo-plex-ios17# Project Website  : https://www.valo-plex.com18# Created          : 2026-12-0119# Last Modified    : 2026-12-0120#21# =============================================================================22# AUTHOR & PROFESSIONAL AFFILIATION23# =============================================================================24#25# Author           : Simon-Pierre Boucher26# Position         : Professor of Finance27# Institution      : Université du Québec en Outaouais (UQO)28# Department       : Département des sciences administratives29# Organization     : SP Boucher30#31# Website          : https://spboucher.ai32# Git              : https://git.spboucher.ai33#34# =============================================================================35# OFFICIAL CONTACT DIRECTORY36# =============================================================================37#38# General          : info@spboucher.ai39# Professional     : contact@spboucher.ai40# Direct           : simon@spboucher.ai41# Research         : research@spboucher.ai42# Development      : dev@spboucher.ai43# Support          : support@spboucher.ai44# Security/Admin   : admin@spboucher.ai45# Notifications    : notifications@spboucher.ai46#47# Preferred Contact: support@spboucher.ai48#49# =============================================================================50# COPYRIGHT & INTELLECTUAL PROPERTY51# =============================================================================52#53# Copyright (c) 202654# Simon-Pierre Boucher55#56# All rights reserved where applicable.57#58# This file is governed by the applicable project license,59# copyright notices, institutional agreements and relevant law.60#61# Unless expressly authorized by the applicable license or62# rights holder, copying, redistribution, sublicensing,63# publication and commercial exploitation are not permitted.64#65# Existing third-party rights and notices remain unaffected.66#67# =============================================================================68# CONFIDENTIALITY & SECURITY69# =============================================================================70#71# Classification   : Public72# Distribution     : Public repository; use is governed by the project license73# Security Contact : admin@spboucher.ai74#75# Access to this source does not independently grant permission76# to redistribute or disclose confidential materials.77#78# Do not embed credentials, private keys, access tokens,79# certificates or confidential personal information.80#81# =============================================================================82# LICENSE & MAINTENANCE83# =============================================================================84#85# License          : None specified (no license file in this repository)86# Maintainer       : Simon-Pierre Boucher87# Technical Contact: dev@spboucher.ai88#89# =============================================================================90# END OF SP BOUCHER SOURCE HEADER91# =============================================================================9293import os94from PIL import Image, ImageDraw9596PAPIER, CARTON, ENCRE, BRIQUE, BRIQUE_FONCE = "#F3EEE4", "#FBF8F2", "#1C1B18", "#A23B2A", "#7A2A1E"97RACINE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "ValoPlex", "Resources", "Assets.xcassets")9899100def marque(taille, fond, echelle, sur=4):101    """La marque (boîte de 28 unités) centrée dans un carré, dessinée en suréchantillonnage."""102    n = taille * sur103    img = Image.new("RGBA", (n, n), fond)104    d = ImageDraw.Draw(img)105    k = n * echelle / 28106    ox = oy = (n - 28 * k) / 2107108    def r(x, y, w, h, fill=None, outline=None, trait=0):109        boite = [ox + x * k, oy + y * k, ox + (x + w) * k, oy + (y + h) * k]110        if outline:111            t = trait * k / 2112            d.rectangle([boite[0] - t, boite[1] - t, boite[2] + t, boite[3] + t], fill=outline)113            d.rectangle([boite[0] + t, boite[1] + t, boite[2] - t, boite[3] - t], fill=fill)114        else:115            d.rectangle(boite, fill=fill)116117    r(3, 5, 22, 20, fill=BRIQUE, outline=ENCRE, trait=1.5)       # mur de brique118    r(3.75, 14.5, 20.5, 1, fill=BRIQUE_FONCE)                     # plancher entre les deux niveaux119    r(1.5, 2.5, 25, 3.5, fill=ENCRE)                              # corniche120    for x, y in ((6.5, 8), (16.5, 8), (6.5, 17.5)):               # trois fenêtres121        r(x, y, 5, 5, fill=CARTON, outline=ENCRE, trait=0.8)122    r(17, 17.5, 4.5, 7.5, fill=ENCRE)                             # porte123    return img.resize((taille, taille), Image.LANCZOS)124125126icone = marque(1024, PAPIER, 0.66).convert("RGB")127icone.save(os.path.join(RACINE, "AppIcon.appiconset", "icone-1024.png"))128for facteur in (1, 2, 3):129    marque(96 * facteur, (0, 0, 0, 0), 1.0).save(os.path.join(RACINE, "LaunchMark.imageset", f"marque@{facteur}x.png"))130print("icône et marque écrites")131
Files main
Menu

Theme