SPB Git

Repository Public

icone.swift 6.5 KB 140 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : Lou-Ka Admin iOS9// File             : Scripts/icone.swift10// Description      : dessine l'icône de l'app (1024 × 1024, variantes claire et11//                    sombre) sans outil graphique : la porte « Seuil » de12//                    Lou-Ka en filet clair sur fond charbon, poignée vert forêt13//                    clair. L'app publique porte une porte pleine sur fond14//                    ivoire : les deux ne se confondent pas. usage : swift15//                    Scripts/icone.swift <dossier de sortie>16// Module           : Scripts17// Repository       : https://git.spboucher.ai/lou-ka-admin-ios18// Project Website  : https://www.lou-ka.com19// Created          : 2026-11-3020// Last Modified    : 2026-11-3021//22// =============================================================================23// AUTHOR & PROFESSIONAL AFFILIATION24// =============================================================================25//26// Author           : Simon-Pierre Boucher27// Position         : Professor of Finance28// Institution      : Université du Québec en Outaouais (UQO)29// Department       : Département des sciences administratives30// Organization     : SP Boucher31//32// Website          : https://spboucher.ai33// Git              : https://git.spboucher.ai34//35// =============================================================================36// OFFICIAL CONTACT DIRECTORY37// =============================================================================38//39// General          : info@spboucher.ai40// Professional     : contact@spboucher.ai41// Direct           : simon@spboucher.ai42// Research         : research@spboucher.ai43// Development      : dev@spboucher.ai44// Support          : support@spboucher.ai45// Security/Admin   : admin@spboucher.ai46// Notifications    : notifications@spboucher.ai47//48// Preferred Contact: support@spboucher.ai49//50// =============================================================================51// COPYRIGHT & INTELLECTUAL PROPERTY52// =============================================================================53//54// Copyright (c) 202655// Simon-Pierre Boucher56//57// All rights reserved where applicable.58//59// This file is governed by the applicable project license,60// copyright notices, institutional agreements and relevant law.61//62// Unless expressly authorized by the applicable license or63// rights holder, copying, redistribution, sublicensing,64// publication and commercial exploitation are not permitted.65//66// Existing third-party rights and notices remain unaffected.67//68// =============================================================================69// CONFIDENTIALITY & SECURITY70// =============================================================================71//72// Classification   : Public73// Distribution     : Public repository; use is governed by the project license74// Security Contact : admin@spboucher.ai75//76// Access to this source does not independently grant permission77// to redistribute or disclose confidential materials.78//79// Do not embed credentials, private keys, access tokens,80// certificates or confidential personal information.81//82// =============================================================================83// LICENSE & MAINTENANCE84// =============================================================================85//86// License          : None specified (no license file in this repository)87// Maintainer       : Simon-Pierre Boucher88// Technical Contact: dev@spboucher.ai89//90// =============================================================================91// END OF SP BOUCHER SOURCE HEADER92// =============================================================================9394import AppKit95import CoreGraphics9697func color(_ hex: UInt32, _ a: CGFloat = 1) -> CGColor {98    CGColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255, blue: CGFloat(hex & 0xFF) / 255, alpha: a)99}100101/// Géométrie de la marque sur une grille de 64 (mêmes tracés que le symbole du site), agrandie et centrée.102func draw(background: UInt32, line: UInt32, handle: UInt32, to url: URL) {103    let size = 1024104    let ctx = CGContext(data: nil, width: size, height: size, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpace(name: CGColorSpace.sRGB)!,105                        bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)!106    ctx.setFillColor(color(background))107    ctx.fill(CGRect(x: 0, y: 0, width: size, height: size))108    // grille 64 → 600 points, centrée ; l'axe y de la grille descend109    let scale: CGFloat = 10.4, ox: CGFloat = (1024 - 64 * scale) / 2, oy: CGFloat = (1024 - 66 * scale) / 2110    func p(_ x: CGFloat, _ y: CGFloat) -> CGPoint { CGPoint(x: ox + x * scale, y: 1024 - (oy + y * scale)) }111    ctx.setLineCap(.round); ctx.setLineJoin(.round)112    ctx.setStrokeColor(color(line))113    // chambranle : deux montants et un linteau, pas de traverse basse114    ctx.setLineWidth(2.6 * scale)115    ctx.move(to: p(15, 60)); ctx.addLine(to: p(15, 9))116    ctx.addArc(tangent1End: p(15, 6), tangent2End: p(18, 6), radius: 3 * scale)117    ctx.addLine(to: p(46, 6))118    ctx.addArc(tangent1End: p(49, 6), tangent2End: p(49, 9), radius: 3 * scale)119    ctx.addLine(to: p(49, 60))120    ctx.strokePath()121    // battant entrouvert, en filet (l'app publique le remplit)122    ctx.setLineWidth(2.0 * scale)123    ctx.move(to: p(20.5, 11.2)); ctx.addLine(to: p(40.5, 15)); ctx.addLine(to: p(40.5, 52.6)); ctx.addLine(to: p(20.5, 57.2)); ctx.closePath()124    ctx.strokePath()125    // seuil126    ctx.setLineWidth(2.6 * scale)127    ctx.move(to: p(8, 60)); ctx.addLine(to: p(56, 60)); ctx.strokePath()128    // poignée129    ctx.setFillColor(color(handle))130    let c = p(36.2, 34.5), r = 2.3 * scale131    ctx.fillEllipse(in: CGRect(x: c.x - r, y: c.y - r, width: 2 * r, height: 2 * r))132    let rep = NSBitmapImageRep(cgImage: ctx.makeImage()!)133    try! rep.representation(using: .png, properties: [:])!.write(to: url)134}135136let out = URL(fileURLWithPath: CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : ".")137draw(background: 0x181C1A, line: 0xF1F3EE, handle: 0x86C2A4, to: out.appendingPathComponent("icon-1024.png"))138draw(background: 0x0C120F, line: 0xD5DAD3, handle: 0x86C2A4, to: out.appendingPathComponent("icon-1024-dark.png"))139print("icônes écrites dans \(out.path)")140
Files main
Menu

Theme